コード例 #1
0
ファイル: Visio.php プロジェクト: christine-ho-dev/movim
 function onSessionInitiate($jingle)
 {
     $jts = new \JingletoSDP($jingle);
     $sdp = $jts->generate();
     $cd = new \Modl\ContactDAO();
     $contact = $cd->get(cleanJid((string) $jingle->attributes()->initiator));
     if (!isset($contact)) {
         $contact = new Modl\Contact();
     }
     if ($sdp) {
         RPC::call('movim_desktop_notification', $contact->getTrueName(), $this->__('visio.calling'), $contact->getPhoto('m'));
         //RPC::call('Popup.setJid', (string)$jingle->attributes()->initiator);
         RPC::call('onOffer', $sdp);
     }
 }
コード例 #2
0
ファイル: Presence.php プロジェクト: Nyco/movim
 public function setPresence($stanza)
 {
     $jid = explode('/', (string) $stanza->attributes()->from);
     if ($stanza->attributes()->to) {
         $to = current(explode('/', (string) $stanza->attributes()->to));
     } else {
         $to = $jid[0];
     }
     $this->session = $to;
     $this->jid = $jid[0];
     if (isset($jid[1])) {
         $this->resource = $jid[1];
     } else {
         $this->resource = 'default';
     }
     $this->status = (string) $stanza->status;
     if ($stanza->c) {
         $this->node = (string) $stanza->c->attributes()->node;
         $this->ver = (string) $stanza->c->attributes()->ver;
     }
     if ($stanza->priority) {
         $this->priority = (string) $stanza->priority;
     }
     if ((string) $stanza->attributes()->type == 'error') {
         $this->value = 6;
     } elseif ((string) $stanza->attributes()->type == 'unavailable') {
         $this->value = 5;
     } elseif ((string) $stanza->show == 'away') {
         $this->value = 2;
     } elseif ((string) $stanza->show == 'dnd') {
         $this->value = 3;
     } elseif ((string) $stanza->show == 'xa') {
         $this->value = 4;
     } else {
         $this->value = 1;
     }
     // Specific XEP
     if ($stanza->x) {
         foreach ($stanza->children() as $name => $c) {
             switch ($c->attributes()->xmlns) {
                 case 'jabber:x:signed':
                     $this->publickey = (string) $c;
                     break;
                 case 'http://jabber.org/protocol/muc#user':
                     $this->muc = true;
                     if ($c->item->attributes()->jid) {
                         $this->mucjid = cleanJid((string) $c->item->attributes()->jid);
                     } else {
                         $this->mucjid = (string) $stanza->attributes()->from;
                     }
                     $this->mucrole = (string) $c->item->attributes()->role;
                     $this->mucaffiliation = (string) $c->item->attributes()->affiliation;
                     break;
                 case 'vcard-temp:x:update':
                     $this->photo = true;
                     break;
             }
         }
     }
     if ($stanza->delay) {
         $this->delay = gmdate('Y-m-d H:i:s', strtotime((string) $stanza->delay->attributes()->stamp));
     }
     if ($stanza->query) {
         $this->last = (int) $stanza->query->attributes()->seconds;
     }
 }
コード例 #3
0
ファイル: Presence.php プロジェクト: Anon215/movim
 public function setPresence($stanza)
 {
     $jid = explode('/', (string) $stanza->attributes()->from);
     if ($stanza->attributes()->to) {
         $to = current(explode('/', (string) $stanza->attributes()->to));
     } else {
         $to = $jid[0];
     }
     $this->__set('session', $to);
     $this->__set('jid', $jid[0]);
     if (isset($jid[1])) {
         $this->__set('resource', $jid[1]);
     } else {
         $this->__set('resource', 'default');
     }
     $this->__set('status', (string) $stanza->status);
     if ($stanza->c) {
         $this->__set('node', (string) $stanza->c->attributes()->node);
         $this->__set('ver', (string) $stanza->c->attributes()->ver);
     }
     if ($stanza->priority) {
         $this->__set('priority', (string) $stanza->priority);
     }
     if ((string) $stanza->attributes()->type == 'error') {
         $this->__set('value', 6);
     } elseif ((string) $stanza->attributes()->type == 'unavailable') {
         $this->__set('value', 5);
     } elseif ((string) $stanza->show == 'away') {
         $this->__set('value', 2);
     } elseif ((string) $stanza->show == 'dnd') {
         $this->__set('value', 3);
     } elseif ((string) $stanza->show == 'xa') {
         $this->__set('value', 4);
     } else {
         $this->__set('value', 1);
     }
     // Specific XEP
     if ($stanza->x) {
         foreach ($stanza->children() as $name => $c) {
             switch ($c->attributes()->xmlns) {
                 case 'jabber:x:signed':
                     $this->__set('publickey', (string) $c);
                     break;
                 case 'http://jabber.org/protocol/muc#user':
                     $this->__set('muc            ', true);
                     if ($c->item->attributes()->jid) {
                         $this->__set('mucjid', cleanJid((string) $c->item->attributes()->jid));
                     } else {
                         $this->__set('mucjid', (string) $stanza->attributes()->from);
                     }
                     $this->__set('mucrole', (string) $c->item->attributes()->role);
                     $this->__set('mucaffiliation', (string) $c->item->attributes()->affiliation);
                     break;
                 case 'vcard-temp:x:update':
                     $this->__set('photo', true);
                     break;
             }
         }
     }
     if ($stanza->delay) {
         $this->__set('delay', gmdate('Y-m-d H:i:s', strtotime((string) $stanza->delay->attributes()->stamp)));
     }
     if ($stanza->query) {
         $this->__set('last', (int) $stanza->query->attributes()->seconds);
     }
 }