public function handle($stanza, $parent = false) { $evt = new \Event(); $to = current(explode('/', (string) $stanza->attributes()->to)); $from = $this->_to; $node = $this->_node; if ($stanza->pubsub->items->item) { $post = false; foreach ($stanza->pubsub->items->item as $item) { if (isset($item->entry) && (string) $item->entry->attributes()->xmlns == 'http://www.w3.org/2005/Atom') { $p = new \modl\Postn(); $p->set($item, $from, false, $node); $pd = new \modl\PostnDAO(); $pd->set($p); $post = true; $this->pack($p); $evt->runEvent('post', $this->packet); } elseif (isset($item->realtime)) { $this->method('ticker'); $this->pack(array('server' => $from, 'node' => $node, 'ticker' => $item->realtime)); $this->deliver(); } } //if($post) { $this->pack(array('server' => $this->_to, 'node' => $this->_node)); $this->deliver(); //} } else { $evt->runEvent('nostream', array('from' => $from, 'node' => $node)); } }
public function handle($stanza, $parent = false) { $pd = new \modl\PostnDAO(); foreach ($stanza->pubsub->items->item as $item) { if (isset($item->entry) && (string) $item->entry->attributes()->xmlns == 'http://www.w3.org/2005/Atom') { if ($this->_since == null || strtotime($this->_since) < strtotime($item->entry->published)) { $p = new \modl\Postn(); $p->set($item, $this->_to, false, $this->_node); $pd->set($p); } } } $this->pack(array('server' => $this->_to, 'node' => $this->_node)); $this->deliver(); }
public function handle($stanza, $parent = false) { $evt = new \Event(); $node = (string) $stanza->pubsub->items->attributes()->node; list($xmlns, $parent) = explode("/", $node); if ($stanza->pubsub->items->item) { foreach ($stanza->pubsub->items->item as $item) { $p = new \modl\Postn(); $p->set($item, $this->_to, false, $node); $pd = new \modl\PostnDAO(); $pd->set($p); } } $this->pack(array('server' => $this->_to, 'node' => $this->_node, 'id' => $this->_id)); $this->deliver(); }
public function handle($stanza, $parent = false) { $from = (string) $parent->attributes()->from; if ($stanza->items->item && isset($stanza->items->item->entry) && (string) $stanza->items->item->entry->attributes()->xmlns == 'http://www.w3.org/2005/Atom') { if ($parent->delay) { $delay = gmdate('Y-m-d H:i:s', strtotime((string) $parent->delay->attributes()->stamp)); } else { $delay = false; } $p = new \modl\Postn(); $p->set($stanza->items, $from, $delay); // We limit the very old posts (2 months old) if (strtotime($p->published) > mktime(0, 0, 0, gmdate("m") - 2, gmdate("d"), gmdate("Y")) && $p->nodeid != $this->testid) { $pd = new \modl\PostnDAO(); $pd->set($p, $from); $this->pack($p); $this->deliver(); } } elseif ($stanza->items->retract) { $pd = new \modl\PostnDAO(); $pd->delete($stanza->items->retract->attributes()->id); $this->method('retract'); $this->pack(array('server' => $from, 'node' => $stanza->attributes()->node)); $this->deliver(); } elseif (isset($stanza->items->item->realtime)) { $this->method('ticker'); $this->pack(array('server' => $from, 'node' => $stanza->items->attributes()->node, 'ticker' => $stanza->items->item->realtime)); $this->deliver(); } elseif ($stanza->items->item && isset($stanza->items->item->attributes()->id) && !filter_var($from, FILTER_VALIDATE_EMAIL)) { // In this case we only get the header, so we request the full content $p = new \modl\PostnDAO(); $id = (string) $stanza->items->item->attributes()->id; $here = $p->exist($id); if (!$here && $id != $this->testid) { $d = new GetItem(); $d->setTo($from)->setNode((string) $stanza->items->attributes()->node)->setId($id)->request(); } } }
public function handle($stanza, $parent = false) { $p = new \modl\Postn(); $p->origin = $this->_to; $p->node = $this->_node; $p->nodeid = $this->_atom->id; $p->aname = $this->_atom->name; $p->aid = $this->_atom->jid; $p->contentraw = $this->_atom->content; $p->published = gmdate('Y-m-d H:i:s'); $p->updated = gmdate('Y-m-d H:i:s'); $pd = new \modl\PostnDAO(); $pd->set($p); $this->pack(['server' => $this->_to, 'node' => $this->_node, 'id' => $this->_parentid]); $this->deliver(); }