Пример #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);
           }*/
     }
 }
Пример #2
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();
         }
     }
 }
Пример #3
0
 public function handle($stanza, $parent = false)
 {
     $jid = explode('/', (string) $parent->attributes()->from);
     $to = current(explode('/', (string) $parent->attributes()->to));
     if ($parent->subject) {
         $m = new \modl\Message();
         $m->session = $to;
         $m->jidto = $to;
         $m->jidfrom = $jid[0];
         if (isset($jid[1])) {
             $m->resource = $jid[1];
         }
         $m->type = (string) $parent->attributes()->type;
         $m->body = (string) $parent->body;
         $m->subject = (string) $parent->subject;
         if ($parent->delay) {
             $m->published = gmdate('Y-m-d H:i:s', strtotime($parent->delay->attributes()->stamp));
         } else {
             $m->published = gmdate('Y-m-d H:i:s');
         }
         $m->delivered = date('Y-m-d H:i:s');
         $md = new \modl\MessageDAO();
         $md->set($m);
         $this->pack($m);
         $this->deliver();
     }
 }
Пример #4
0
 public function handle($stanza, $parent = false)
 {
     if ($stanza->forwarded->delay) {
         $m = new \modl\Message();
         $m->set($stanza->forwarded->message, $stanza->forwarded);
         if (!preg_match('#^\\?OTR#', $m->body)) {
             $md = new \modl\MessageDAO();
             $md->set($m);
             $this->pack($m);
             $this->deliver();
         }
     }
 }