Пример #1
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);
         }
     }
 }
Пример #2
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);
     }
 }
Пример #3
0
 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);
 }
Пример #4
0
 public function handle($stanza, $parent = false)
 {
     $jid = current(explode('/', (string) $parent->attributes()->from));
     $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();
         }
     }
 }
Пример #5
0
Файл: Get.php Проект: movim/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);
     }
 }
Пример #6
0
 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);
             }
         }
     }
 }
Пример #7
0
Файл: Get.php Проект: movim/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();
     }
 }
Пример #8
0
 function ajaxVcardSubmit($vcard)
 {
     # Format it ISO 8601:
     if ($vcard->year->value != -1 && $vcard->month->value != -1 && $vcard->day->value != -1) {
         $vcard->date->value = $vcard->year->value . '-' . $vcard->month->value . '-' . $vcard->day->value;
     }
     unset($vcard->year->value);
     unset($vcard->month->value);
     unset($vcard->day->value);
     $cd = new \Modl\ContactDAO();
     $c = $cd->get($this->user->getLogin());
     if ($c == null) {
         $c = new \Modl\Contact();
     }
     $c->jid = $this->user->getLogin();
     if (isset($vcard->date->value)) {
         $c->date = $vcard->date->value;
     }
     if (Validator::string()->length(0, 40)->validate($vcard->name->value)) {
         $c->name = $vcard->name->value;
     }
     if (Validator::string()->length(0, 40)->validate($vcard->fn->value)) {
         $c->fn = $vcard->fn->value;
     }
     if (Validator::url()->validate($vcard->url->value)) {
         $c->url = $vcard->url->value;
     }
     if (Validator::in(array_keys(getGender()))->validate($vcard->gender->value)) {
         $c->gender = $vcard->gender->value;
     }
     if (Validator::in(array_keys(getMarital()))->validate($vcard->marital->value)) {
         $c->marital = $vcard->marital->value;
     }
     $c->adrlocality = $vcard->locality->value;
     $c->adrcountry = $vcard->country->value;
     if (Validator::email()->validate($vcard->email->value)) {
         $c->email = $vcard->email->value;
     }
     $c->twitter = $vcard->twitter->value;
     $c->skype = $vcard->skype->value;
     $c->yahoo = $vcard->yahoo->value;
     if (Validator::string()->validate($vcard->desc->value)) {
         $c->description = trim($vcard->desc->value);
     }
     $cd = new \Modl\ContactDAO();
     $cd->set($c);
     $r = new Set();
     $r->setData($c)->request();
     $r = new Moxl\Xec\Action\Vcard\Set();
     $r->setData($vcard)->request();
 }