Example #1
0
 public function handle($stanza, $parent = false)
 {
     $message = $stanza->forwarded->message;
     $jid = explode('/', (string) $message->attributes()->from);
     $to = current(explode('/', (string) $message->attributes()->to));
     $evt = new \Event();
     if ($message->composing) {
         $evt->runEvent('composing', array($jid[0], $to));
     }
     if ($message->paused) {
         $evt->runEvent('paused', array($jid[0], $to));
     }
     if ($message->gone) {
         $evt->runEvent('gone', array($jid[0], $to));
     }
     if ($message->body || $message->subject) {
         $m = new \modl\Message();
         $m->set($message, $stanza->forwarded);
         if (!preg_match('#^\\?OTR#', $m->body)) {
             $md = new \modl\MessageDAO();
             $md->set($m);
             $this->pack($m);
             $this->deliver();
         }
     }
 }
Example #2
0
 public function handle($stanza, $parent = false)
 {
     $from = (string) $parent->attributes()->from;
     $to = (string) $parent->attributes()->to;
     $id = (string) $parent->attributes()->id;
     $action = (string) $stanza->attributes()->action;
     $evt = new \Event();
     $evt->runEvent('ack', array($from, $id));
     /*$ack = new Send;
       $ack->setTo($to)
           ->setId($id)
           ->request();*/
     switch ($action) {
         case 'session-initiate':
             $evt->runEvent('jinglesessioninitiate', $stanza);
             break;
         case 'transport-info':
             $evt->runEvent('jingletransportinfo', $stanza);
             break;
         case 'session-terminate':
             $evt->runEvent('jinglesessionterminate', $stanza);
             break;
         case 'session-accept':
             $evt->runEvent('jinglesessionaccept', $stanza);
             break;
     }
 }
Example #3
0
 public function handle($stanza, $parent = false)
 {
     $jid = explode('/', (string) $stanza->attributes()->from);
     $to = current(explode('/', (string) $stanza->attributes()->to));
     $evt = new \Event();
     if ($stanza->composing) {
         $evt->runEvent('composing', array($jid[0], $to));
     }
     if ($stanza->paused) {
         $evt->runEvent('paused', array($jid[0], $to));
     }
     if ($stanza->gone) {
         $evt->runEvent('gone', array($jid[0], $to));
     }
     if ($stanza->body || $stanza->subject) {
         $m = new \modl\Message();
         $m->set($stanza, $parent);
         if ($stanza->request) {
             $from = (string) $stanza->attributes()->from;
             $id = (string) $stanza->attributes()->id;
             \Moxl\Stanza\Message::receipt($from, $id);
         }
         if (!preg_match('#^\\?OTR#', $m->body)) {
             $md = new \modl\MessageDAO();
             $md->set($m);
             $this->pack($m);
             $this->deliver();
         }
         // Can we remove this ?
         /*if($m->type == 'groupchat' && $m->subject != '') {
               $evt->runEvent('subject', $m);
           }*/
     }
 }
Example #4
0
 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $from = current(explode('/', (string) $stanza->attributes()->from));
     $cd = new \modl\ContactDAO();
     $c = $cd->get($from);
     if ($c == null) {
         $c = new \modl\Contact();
         $c->jid = $from;
     }
     $c->loclatitude = $this->_geo['latitude'];
     $c->loclongitude = $this->_geo['longitude'];
     $c->localtitude = $this->_geo['altitude'];
     $c->loccountry = $this->_geo['country'];
     $c->loccountrycode = $this->_geo['countrycode'];
     $c->locregion = $this->_geo['region'];
     $c->locpostalcode = $this->_geo['postalcode'];
     $c->loclocality = $this->_geo['locality'];
     $c->locstreet = $this->_geo['street'];
     $c->locbuilding = $this->_geo['building'];
     $c->loctext = $this->_geo['text'];
     $c->locuri = $this->_geo['uri'];
     $c->loctimestamp = date('Y-m-d H:i:s', time());
     $cd->set($c);
     $evt->runEvent('locationpublished', $c);
 }
Example #5
0
File: Get.php Project: Hywan/moxl
 public function errorItemNotFound($error)
 {
     $evt = new \Event();
     if ($this->_me) {
         $evt->runEvent('myvcardinvalid');
     }
 }
Example #6
0
 public function handle($stanza, $parent = false)
 {
     if ($stanza["type"] == "result") {
         $evt = new \Event();
         $evt->runEvent('groupremoved', $this->_node);
     }
 }
Example #7
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 #8
0
 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $tab = array();
     $nd = new \modl\ItemDAO();
     $n = new \modl\Item();
     $n->setMetadata($stanza->query->x, $this->_to, $this->_node);
     $nd->set($n);
     $evt->runEvent('pubsubmetadata', array($this->_to, $this->_node));
 }
Example #9
0
 public function handle($stanza, $parent = false)
 {
     $jid = current(explode('/', (string) $parent->attributes()->from));
     $evt = new \Event();
     $cd = new \modl\ContactDAO();
     $c = $cd->get($jid);
     if ($c == null) {
         $c = new \modl\Contact();
     }
     $p = new \Picture();
     $p->fromBase((string) $stanza->items->item->data);
     $p->set($jid);
     $evt->runEvent('vcard', $c);
 }
Example #10
0
File: Tune.php Project: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $to = current(explode('/', (string) $parent->attributes()->to));
     $from = current(explode('/', (string) $parent->attributes()->from));
     if (isset($stanza->items->item->tune) && $stanza->items->item->tune->count() > 0) {
         $cd = new \modl\ContactDAO();
         $c = $cd->get($from);
         if ($c != null) {
             $c->setTune($stanza);
             $cd->set($c);
         }
         $evt = new \Event();
         $evt->runEvent('tune', $from);
     }
 }
Example #11
0
 public function handle($stanza, $parent = false)
 {
     $jid = current(explode('/', (string) $parent->attributes()->from));
     $evt = new \Event();
     $cd = new \modl\ContactDAO();
     $c = $cd->get($jid);
     if ($c == null) {
         $c = new \modl\Contact();
     }
     $c->jid = $jid;
     $vcard = $stanza->items->item->vcard;
     $c->setVcard4($vcard);
     $c->createThumbnails();
     $cd->set($c);
     $evt->runEvent('vcard', $c);
 }
Example #12
0
 /**
  * Deliver the packet
  *
  * @return void
  */
 public final function deliver()
 {
     $action_ns = 'Moxl\\Xec\\Action';
     if (get_parent_class($this) == $action_ns || get_parent_class(get_parent_class($this)) == $action_ns) {
         $class = str_replace(array($action_ns, '\\'), array('', '_'), get_class($this));
         $key = strtolower(substr($class, 1));
     } else {
         $class = strtolower(get_class($this));
         $pos = strrpos($class, '\\');
         $key = substr($class, $pos + 1);
     }
     if ($this->method) {
         $key = $key . '_' . $this->method;
     }
     Utils::log('Package : Event "' . $key . '" from "' . $this->packet->from . '" fired');
     $evt = new \Event();
     $evt->runEvent($key, $this->packet);
 }
Example #13
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 #14
0
 public function error($error)
 {
     $evt = new \Event();
     $evt->runEvent('nostream', array('from' => $this->_to, 'node' => $this->_node));
 }
Example #15
0
File: Set.php Project: Hywan/moxl
 public function errorNotAllowed($stanza)
 {
     $evt = new \Event();
     $evt->runEvent('myvcardinvalid', 'vcardfeaturenotimpl');
 }
Example #16
0
 public function error($error)
 {
     $evt = new \Event();
     $evt->runEvent('creationerror', $this->_node);
 }
Example #17
0
 public function handle($number, $message)
 {
     $evt = new \Event();
     $evt->runEvent('moxlerror', array($number, $message));
 }
Example #18
0
File: Get.php Project: Hywan/moxl
 public function errorNotAuthorized($stanza)
 {
     $evt = new \Event();
     $evt->runEvent('nonotificationautorized');
 }
Example #19
0
 public function errorItemNotFound($stanza)
 {
     parent::errorItemNotFound($stanza);
     $evt = new \Event();
     $evt->runEvent('groupsubscribedlist', array());
 }
Example #20
0
File: Muc.php Project: Hywan/moxl
 public function errorNotAcceptable($stanza, $message)
 {
     $evt = new \Event();
     $evt->runEvent('bookmarkerror', $message);
 }
Example #21
0
 public function errorNotAcceptable($error)
 {
     $evt = new \Event();
     $evt->runEvent('pubsuberror', "The server cannot accept this action");
 }
Example #22
0
 public function errorNotAcceptable($stanza)
 {
     $evt = new \Event();
     $evt->runEvent('nodecreationerror');
 }
Example #23
0
 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $evt->runEvent('pubsubaffiliationssubmited', $stanza);
 }
Example #24
0
 case 'message':
     $msg = $msg->body;
     break;
 case 'ping':
     // And we say that we are ready !
     $obj = new \StdClass();
     $obj->func = 'pong';
     echo base64_encode(gzcompress(json_encode($obj), 9)) . "";
     break;
 case 'down':
     $evt = new Event();
     $evt->runEvent('session_down');
     break;
 case 'up':
     $evt = new Event();
     $evt->runEvent('session_up');
     break;
 case 'unregister':
     \Moxl\Stanza\Stream::end();
     if (isset($conn)) {
         $conn->close();
     }
     $loop->stop();
     break;
 case 'register':
     if (isset($conn) && is_resource($conn->stream)) {
         $conn->stream->close();
     }
     $cd = new \Modl\ConfigDAO();
     $config = $cd->get();
     $port = 5222;
Example #25
0
 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $evt->runEvent('notificationdelete', $this->_id);
 }
Example #26
0
 public function errorItemNotFound($error)
 {
     $evt = new \Event();
     $evt->runEvent('groupsubscribedlisterror', $error);
 }
Example #27
0
 public function errorItemNotFound($stanza)
 {
     $evt = new \Event();
     $evt->runEvent('commentpublisherror');
 }