示例#1
0
文件: Muc.php 项目: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $p = new \modl\Presence();
     $p->setPresence($stanza);
     $pd = new \modl\PresenceDAO();
     $pd->set($p);
     $this->deliver();
 }
示例#2
0
文件: Chat.php 项目: 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);
 }
示例#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();
 }
示例#4
0
文件: Presence.php 项目: Hywan/moxl
 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();
     }
 }
示例#5
0
文件: User.php 项目: sugaryog/movim
 function desauth()
 {
     $pd = new modl\PresenceDAO();
     $pd->clearPresence($this->username);
     $s = \Sessionx::start();
     $s->destroy();
     $sess = Session::start();
     Session::dispose();
 }
示例#6
0
文件: Rooms.php 项目: 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;
     }
 }