示例#1
0
文件: Set.php 项目: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $sd = new \modl\SubscriptionDAO();
     $cd = new \modl\ConferenceDAO();
     // We clear the old Bookmarks
     $sd->delete();
     $cd->delete();
     // We save the bookmarks as Subscriptions in the database
     foreach ($this->_arr as $c) {
         if ($c['type'] == 'subscription') {
             $su = new \modl\Subscription();
             $su->jid = $this->_to;
             $su->server = (string) $c['server'];
             $su->node = (string) $c['node'];
             $su->subscription = 'subscribed';
             $su->subid = (string) $c['subid'];
             $sd->set($su);
         } elseif ($c['type'] == 'conference') {
             $co = new \modl\Conference();
             $co->jid = $this->_to;
             $co->conference = (string) $c['jid'];
             $co->name = (string) $c['name'];
             $co->nick = (string) $c['nick'];
             $co->autojoin = (int) $c['autojoin'];
             $co->status = 0;
             $cd->set($co);
         }
     }
     $this->deliver();
 }
示例#2
0
文件: Get.php 项目: Hywan/moxl
 private function saveItem($c)
 {
     $sd = new \modl\SubscriptionDAO();
     $cd = new \modl\ConferenceDAO();
     if ($c->getName() == 'subscription') {
         $su = new \modl\Subscription();
         $su->jid = $this->_to;
         $su->server = (string) $c->attributes()->server;
         $su->node = (string) $c->attributes()->node;
         $su->subscription = 'subscribed';
         $su->subid = (string) $c->attributes()->subid;
         $sd->set($su);
     } elseif ($c->getName() == 'conference') {
         $co = new \modl\Conference();
         $co->jid = $this->_to;
         $co->conference = (string) $c->attributes()->jid;
         $co->name = (string) $c->attributes()->name;
         $co->nick = (string) $c->nick;
         $co->autojoin = (int) $c->attributes()->autojoin;
         $co->status = 0;
         $cd->set($co);
     }
 }