Exemplo n.º 1
0
Arquivo: Caps.php Projeto: movim/moxl
 public function handle($stanza, $parent = false)
 {
     $node = $stanza->attributes()->node . '#' . $stanza->attributes()->ver;
     $to = (string) $parent->attributes()->from;
     $cd = new \Modl\CapsDAO();
     $c = $cd->get($node);
     if (!$c && $parent->getName() != 'streamfeatures') {
         $d = new Request();
         $d->setTo($to)->setNode($node)->request();
     }
 }
Exemplo n.º 2
0
 function prepareContact($jid)
 {
     if (!$this->validateJid($jid)) {
         return;
     }
     $cd = new \Modl\ContactDAO();
     $c = $cd->get($jid, true);
     if ($c == null || $c->created == null || $c->isOld()) {
         if ($c == null) {
             $c = new \Modl\Contact();
             $c->jid = $jid;
         }
         $this->ajaxRefreshVcard($jid);
     }
     $cr = $cd->getRosterItem($jid);
     $view = $this->tpl();
     $pd = new \Modl\PostnDAO();
     $gallery = $pd->getGallery($jid, 0, 12);
     $blog = $pd->getPublic($jid, 'urn:xmpp:microblog:0', 0, 4);
     $presencestxt = getPresencesTxt();
     $view->assign('edit', $this->call('ajaxEditContact', "'" . echapJS($jid) . "'"));
     $view->assign('delete', $this->call('ajaxDeleteContact', "'" . echapJS($jid) . "'"));
     if (isset($c)) {
         $view->assign('mood', getMood());
         $view->assign('contact', $c);
         $view->assign('contactr', $cr);
         if ($cr->node != null && $cr->ver != null && $cr->node && $cr->ver) {
             $node = $cr->node . '#' . $cr->ver;
             $cad = new \Modl\CapsDAO();
             $caps = $cad->get($node);
             if ($cr->value != null) {
                 $view->assign('presence', $presencestxt[$cr->value]);
             }
             if (isset($caps) && $caps->name != '' && $caps->type != '') {
                 $clienttype = getClientTypes();
                 $view->assign('caps', $caps);
                 $view->assign('clienttype', $clienttype);
             }
         } else {
             $view->assign('caps', null);
         }
         $view->assign('gallery', $gallery);
         $view->assign('blog', $blog);
         $view->assign('chat', $this->call('ajaxChat', "'" . echapJS($c->jid) . "'"));
         return $view->draw('_contact', true);
     } elseif (isset($cr)) {
         $view->assign('contact', null);
         $view->assign('contactr', $cr);
         $view->assign('chat', $this->call('ajaxChat', "'" . echapJS($cr->jid) . "'"));
         return $view->draw('_contact', true);
     } else {
         return $this->prepareEmpty(0, $jid);
     }
 }
Exemplo n.º 3
0
 private function getCaps()
 {
     $capsdao = new \Modl\CapsDAO();
     $caps = $capsdao->getAll();
     $capsarr = array();
     foreach ($caps as $c) {
         $capsarr[$c->node] = $c;
     }
     return $capsarr;
 }
Exemplo n.º 4
0
 public function getCaps()
 {
     if (!empty($this->node) && !empty($this->ver)) {
         $node = $this->node . '#' . $this->ver;
         $cad = new \Modl\CapsDAO();
         return $cad->get($node);
     }
 }