Exemplo n.º 1
0
 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();
     }
 }
Exemplo n.º 2
0
 public function handle($stanza, $parent = false)
 {
     $rd = new \Modl\RosterLinkDAO();
     $rd->delete($this->_to);
     $this->pack($this->_to);
     $this->deliver();
 }