Esempio n. 1
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);
           }*/
     }
 }
Esempio n. 2
0
 public function handle($stanza, $parent = false)
 {
     $jid = explode('/', (string) $stanza->attributes()->from);
     $to = current(explode('/', (string) $stanza->attributes()->to));
     if ($stanza->composing) {
         $this->event('composing', array($jid[0], $to));
     }
     if ($stanza->paused) {
         $this->event('paused', array($jid[0], $to));
     }
     if ($stanza->gone) {
         $this->event('gone', array($jid[0], $to));
     }
     if ($stanza->body || $stanza->subject) {
         if ($stanza->request) {
             $from = (string) $stanza->attributes()->from;
             $id = (string) $stanza->attributes()->id;
             \Moxl\Stanza\Message::receipt($from, $id);
         }
         $m = new \Modl\Message();
         $m->set($stanza, $parent);
         if (!preg_match('#^\\?OTR#', $m->body)) {
             $md = new \Modl\MessageDAO();
             $md->set($m);
             $this->pack($m);
             $this->deliver();
         }
     }
 }