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(); } } }
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); }*/ } }
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(); } }
public function request() { $this->store(); // We clear all the old messages $md = new \modl\MessageDAO(); $md->deleteContact($this->_to); Presence::muc($this->_to, $this->_nickname); }
public function handle($stanza, $parent = false) { if ($this->_muc) { // We clear all the old messages $md = new \modl\MessageDAO(); $md->deleteContact($this->_to); $md = new \modl\PresenceDAO(); $md->clearMuc($this->_to); } $this->deliver(); }
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(); } } }
function display() { $cd = new \modl\ContactDAO(); $stats = $cd->getStatistics(); $pd = new \modl\PostnDAO(); $pstats = array_slice($pd->getStatistics(), 0, 7); $md = new \modl\MessageDAO(); $mstats = array_slice($md->getStatistics(), 0, 7); $this->view->assign('stats', $stats[0]); $this->view->assign('pstats', $pstats); $this->view->assign('mstats', $mstats); $this->view->assign('clearrosterlink', $this->call('ajaxClearRosterLink')); $this->view->assign('clearmessage', $this->call('ajaxClearMessage')); $this->view->assign('clearpost', $this->call('ajaxClearPost')); }
function prepareChat($jid, $status = null) { if (!$this->validateJid($jid)) { return; } $view = $this->tpl(); $cd = new \Modl\ContactDAO(); $md = new \modl\MessageDAO(); $cad = new \modl\CapsDAO(); $presencestxt = getPresencesTxt(); $cr = $cd->getRosterItem($jid); if (isset($cr)) { if ($cr->value != null) { $view->assign('presence', $presencestxt[$cr->value]); } $view->assign('contact', $cr); $view->assign('caps', $cad->get($cr->node . '#' . $cr->ver)); } else { $view->assign('contact', $cd->get($jid)); $view->assign('caps', null); } $view->assign('status', $status); $m = $md->getContact($jid, 0, 1); if (isset($m)) { $view->assign('message', $m[0]); } return $view->draw('_chats_item', true); }