public function handle($stanza, $parent = false) { if ((string) $parent->attributes()->type == 'set') { $rd = new \modl\RosterLinkDAO(); $jid = current(explode('/', (string) $parent->query->item->attributes()->jid)); if ((string) $parent->query->item->attributes()->subscription == 'remove') { $rd->delete($jid); } else { $from = current(explode('/', (string) $parent->attributes()->from)); $name = (string) $parent->query->item->attributes()->name; $subscription = (string) $parent->query->item->attributes()->subscription; $group = (string) $parent->query->item->group; // If not found, we create it $r = new \modl\RosterLink(); $r->key = $from; $r->jid = $jid; $r->groupname = $group; $r->rostername = $name; $r->rostersubscription = $subscription; $rd->delete($jid); $rd->set($r); } $this->deliver(); } }
public function handle($stanza, $parent = false) { $rd = new \modl\RosterLinkDAO(); $rd->delete($this->_to); $this->pack($this->_to); $this->deliver(); }