Example #1
0
File: Muc.php Project: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $p = new \modl\Presence();
     $p->setPresence($stanza);
     $pd = new \modl\PresenceDAO();
     $pd->set($p);
     $this->deliver();
 }
Example #2
0
File: Chat.php Project: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $p = new \modl\Presence();
     $p->setPresence($stanza);
     $pd = new \modl\PresenceDAO();
     $pd->set($p);
     $evt = new \Event();
     $evt->runEvent('mypresence', $stanza);
 }
Example #3
0
 public function handle($stanza, $parent = false)
 {
     if ($this->_muc) {
         // We clear all the old messages
         $md = new \modl\MessageDAO();
         $md->deleteContact($this->_to);
         $md = new \modl\PresenceDAO();
         $md->clearMuc($this->_to);
     }
     $this->deliver();
 }
Example #4
0
 public function handle($stanza, $parent = false)
 {
     // Subscribe request
     if ((string) $stanza->attributes()->type == 'subscribe') {
         $session = \Session::start();
         $notifs = $session->get('activenotifs');
         $notifs[(string) $stanza->attributes()->from] = 'sub';
         $session->set('activenotifs', $notifs);
         $evt = new \Event();
         $evt->runEvent('subscribe', (string) $stanza->attributes()->from);
     } else {
         $p = new \modl\Presence();
         $p->setPresence($stanza);
         $pd = new \modl\PresenceDAO();
         $pd->set($p);
         /*if($p->photo) {
               $r = new Get;
               $r->setTo(echapJid((string)$stanza->attributes()->from))->request();
           }*/
         if ($p->muc && isset($stanza->x) && isset($stanza->x->status)) {
             $code = (string) $stanza->x->status->attributes()->code;
             if (isset($code) && $code == '110') {
                 if ($p->value != 5 && $p->value != 6) {
                     $this->method('muc_handle');
                     $this->pack($p);
                 } elseif ($p->value == 5) {
                     $pd->clearMuc($p->jid);
                     $this->method('unavailable_handle');
                     $this->pack($p);
                     $this->deliver();
                 }
             }
         } else {
             $cd = new \Modl\ContactDAO();
             $c = $cd->getRosterItem($p->jid, true);
             $this->pack($c);
             if ($p->value == 5 || $p->value == 6) {
                 $pd->delete($p);
             }
         }
         $this->deliver();
     }
 }
Example #5
0
 function desauth()
 {
     $pd = new modl\PresenceDAO();
     $pd->clearPresence($this->username);
     $s = \Sessionx::start();
     $s->destroy();
     $sess = Session::start();
     Session::dispose();
 }
Example #6
0
File: Rooms.php Project: Trim/movim
 function checkConnected($room, $resource = false)
 {
     if (!$this->validateRoom($room)) {
         return;
     }
     if ($resource && !$this->validateResource($resource)) {
         Notification::append(null, $this->__('chatrooms.bad_id'));
         return;
     }
     $pd = new \modl\PresenceDAO();
     if ($resource == false) {
         $session = \Sessionx::start();
         $resource = $session->user;
     }
     $presence = $pd->getPresence($room, $resource);
     if ($presence != null) {
         return true;
     } else {
         return false;
     }
 }