Example #1
0
 public function handle($stanza, $parent = false)
 {
     $from = current(explode('/', (string) $stanza->attributes()->from));
     $cd = new \modl\ContactDAO();
     $c = $cd->get($from);
     if ($c == null) {
         $c = new \modl\Contact();
         $c->jid = $from;
     }
     $c->loclatitude = $this->_geo['latitude'];
     $c->loclongitude = $this->_geo['longitude'];
     $c->localtitude = $this->_geo['altitude'];
     $c->loccountry = $this->_geo['country'];
     $c->loccountrycode = $this->_geo['countrycode'];
     $c->locregion = $this->_geo['region'];
     $c->locpostalcode = $this->_geo['postalcode'];
     $c->loclocality = $this->_geo['locality'];
     $c->locstreet = $this->_geo['street'];
     $c->locbuilding = $this->_geo['building'];
     $c->loctext = $this->_geo['text'];
     $c->locuri = $this->_geo['uri'];
     $c->loctimestamp = date('Y-m-d H:i:s', time());
     $cd->set($c);
     $this->event('locationpublished', $c);
 }
Example #2
0
 public function handle($stanza, $parent = false)
 {
     $to = current(explode('/', (string) $parent->attributes()->to));
     $from = current(explode('/', (string) $parent->attributes()->from));
     if (isset($stanza->items->item->geoloc) && $stanza->items->item->geoloc->count() > 0) {
         $cd = new \modl\ContactDAO();
         $c = $cd->get($from);
         if ($c != null) {
             $c->setLocation($stanza);
             $cd->set($c);
         }
     }
 }
Example #3
0
File: Get.php Project: Hywan/moxl
 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;
     $c->photobin = (string) $stanza->pubsub->items->item->data;
     $c->createThumbnails();
     $cd->set($c);
     $this->pack($c);
     $this->deliver();
 }
Example #4
0
File: Tune.php Project: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $to = current(explode('/', (string) $parent->attributes()->to));
     $from = current(explode('/', (string) $parent->attributes()->from));
     if (isset($stanza->items->item->tune) && $stanza->items->item->tune->count() > 0) {
         $cd = new \modl\ContactDAO();
         $c = $cd->get($from);
         if ($c != null) {
             $c->setTune($stanza);
             $cd->set($c);
         }
         $evt = new \Event();
         $evt->runEvent('tune', $from);
     }
 }
Example #5
0
 public function handle($stanza, $parent = false)
 {
     $to = current(explode('/', (string) $parent->attributes()->to));
     $from = current(explode('/', (string) $parent->attributes()->from));
     if ($stanza->items->item->nick) {
         $cd = new \modl\ContactDAO();
         $c = $cd->get($from);
         if ($c == null) {
             $c = new \modl\Contact();
             $c->jid = $from;
         }
         $c->nickname = (string) $stanza->items->item->nick;
         $cd->set($c);
     }
 }
Example #6
0
 public function handle($stanza, $parent = false)
 {
     $jid = current(explode('/', (string) $parent->attributes()->from));
     $evt = new \Event();
     $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);
     $evt->runEvent('vcard', $c);
 }
Example #7
0
 public function handle($stanza, $parent = false)
 {
     $jid = current(explode('/', (string) $parent->attributes()->from));
     $evt = new \Event();
     $cd = new \modl\ContactDAO();
     $c = $cd->get($jid);
     if (isset($stanza->items->item->metadata->info)) {
         $info = $stanza->items->item->metadata->info->attributes();
         if ($info->id != $c->avatarhash) {
             $c->avatarhash = $info->id;
             $cd->set($c);
             $g = new Get();
             $g->setTo($jid)->request();
         }
     }
 }
Example #8
0
File: Get.php Project: Hywan/moxl
 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);
     }
 }
Example #9
0
File: Mood.php Project: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     $from = current(explode('/', (string) $parent->attributes()->from));
     if (isset($stanza->items->item->mood) && $stanza->items->item->mood->count() > 0) {
         $arrmood = array();
         foreach ($stanza->items->item->mood->children() as $mood) {
             if ($mood->getName() != 'text') {
                 array_push($arrmood, $mood->getName());
             }
         }
         if (count($arrmood) > 0) {
             $cd = new \modl\ContactDAO();
             $c = $cd->get($from);
             if ($c != null) {
                 $c->mood = serialize($arrmood);
                 $cd->set($c);
             }
         }
     }
 }
Example #10
0
File: Get.php Project: Hywan/moxl
 public function handle($stanza, $parent = false)
 {
     if ($stanza->attributes()->from) {
         $jid = current(explode('/', (string) $stanza->attributes()->from));
     } else {
         $jid = $this->_to;
     }
     if ($jid) {
         $evt = new \Event();
         $cd = new \modl\ContactDAO();
         $c = $cd->get($this->_to);
         if ($c == null) {
             $c = new \modl\Contact();
         }
         $c->set($stanza, $this->_to);
         $cd->set($c);
         $c->createThumbnails();
         $this->pack($c);
         $this->deliver();
     }
 }