public function handle($stanza, $parent = false) { $jid = current(explode('/', (string) $parent->attributes()->from)); $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); $this->event('vcard', $c); }
public function handle($stanza, $parent = false) { $cd = new \Modl\ContactDAO(); $c = $cd->get($this->_to); if ($c == null) { $c = new \Modl\Contact(); } $c->jid = $this->_to; if ($vcard = $stanza->pubsub->items->item) { $vcard = $stanza->pubsub->items->item->vcard; $c->setVcard4($vcard); $c->createThumbnails(); $cd->set($c); $this->pack($c); $this->deliver(); } else { $this->error(false); } }