当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::runEvent方法代码示例

本文整理汇总了PHP中Event::runEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::runEvent方法的具体用法?PHP Event::runEvent怎么用?PHP Event::runEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event::runEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle

 public function handle($stanza, $parent = false)
 {
     $message = $stanza->forwarded->message;
     $jid = explode('/', (string) $message->attributes()->from);
     $to = current(explode('/', (string) $message->attributes()->to));
     $evt = new \Event();
     if ($message->composing) {
         $evt->runEvent('composing', array($jid[0], $to));
     }
     if ($message->paused) {
         $evt->runEvent('paused', array($jid[0], $to));
     }
     if ($message->gone) {
         $evt->runEvent('gone', array($jid[0], $to));
     }
     if ($message->body || $message->subject) {
         $m = new \modl\Message();
         $m->set($message, $stanza->forwarded);
         if (!preg_match('#^\\?OTR#', $m->body)) {
             $md = new \modl\MessageDAO();
             $md->set($m);
             $this->pack($m);
             $this->deliver();
         }
     }
 }
开发者ID:Hywan,项目名称:moxl,代码行数:26,代码来源:Carbons.php

示例2: handle

 public function handle($stanza, $parent = false)
 {
     $from = (string) $parent->attributes()->from;
     $to = (string) $parent->attributes()->to;
     $id = (string) $parent->attributes()->id;
     $action = (string) $stanza->attributes()->action;
     $evt = new \Event();
     $evt->runEvent('ack', array($from, $id));
     /*$ack = new Send;
       $ack->setTo($to)
           ->setId($id)
           ->request();*/
     switch ($action) {
         case 'session-initiate':
             $evt->runEvent('jinglesessioninitiate', $stanza);
             break;
         case 'transport-info':
             $evt->runEvent('jingletransportinfo', $stanza);
             break;
         case 'session-terminate':
             $evt->runEvent('jinglesessionterminate', $stanza);
             break;
         case 'session-accept':
             $evt->runEvent('jinglesessionaccept', $stanza);
             break;
     }
 }
开发者ID:Hywan,项目名称:moxl,代码行数:27,代码来源:Jingle.php

示例3: handle

 public function handle($stanza, $parent = false)
 {
     $jid = explode('/', (string) $stanza->attributes()->from);
     $to = current(explode('/', (string) $stanza->attributes()->to));
     $evt = new \Event();
     if ($stanza->composing) {
         $evt->runEvent('composing', array($jid[0], $to));
     }
     if ($stanza->paused) {
         $evt->runEvent('paused', array($jid[0], $to));
     }
     if ($stanza->gone) {
         $evt->runEvent('gone', array($jid[0], $to));
     }
     if ($stanza->body || $stanza->subject) {
         $m = new \modl\Message();
         $m->set($stanza, $parent);
         if ($stanza->request) {
             $from = (string) $stanza->attributes()->from;
             $id = (string) $stanza->attributes()->id;
             \Moxl\Stanza\Message::receipt($from, $id);
         }
         if (!preg_match('#^\\?OTR#', $m->body)) {
             $md = new \modl\MessageDAO();
             $md->set($m);
             $this->pack($m);
             $this->deliver();
         }
         // Can we remove this ?
         /*if($m->type == 'groupchat' && $m->subject != '') {
               $evt->runEvent('subject', $m);
           }*/
     }
 }
开发者ID:Hywan,项目名称:moxl,代码行数:34,代码来源:Message.php

示例4: handle

 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $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);
     $evt->runEvent('locationpublished', $c);
 }
开发者ID:Hywan,项目名称:moxl,代码行数:26,代码来源:Publish.php

示例5: errorItemNotFound

 public function errorItemNotFound($error)
 {
     $evt = new \Event();
     if ($this->_me) {
         $evt->runEvent('myvcardinvalid');
     }
 }
开发者ID:Hywan,项目名称:moxl,代码行数:7,代码来源:Get.php

示例6: handle

 public function handle($stanza, $parent = false)
 {
     if ($stanza["type"] == "result") {
         $evt = new \Event();
         $evt->runEvent('groupremoved', $this->_node);
     }
 }
开发者ID:Hywan,项目名称:moxl,代码行数:7,代码来源:ListRemove.php

示例7: handle

 public function handle($stanza, $parent = false)
 {
     $p = new \modl\Presence();
     $p->setPresence($stanza);
     $pd = new \modl\PresenceDAO();
     $pd->set($p);
     $evt = new \Event();
     $evt->runEvent('mypresence', $stanza);
 }
开发者ID:Hywan,项目名称:moxl,代码行数:9,代码来源:Chat.php

示例8: handle

 public function handle($stanza, $parent = false)
 {
     $evt = new \Event();
     $tab = array();
     $nd = new \modl\ItemDAO();
     $n = new \modl\Item();
     $n->setMetadata($stanza->query->x, $this->_to, $this->_node);
     $nd->set($n);
     $evt->runEvent('pubsubmetadata', array($this->_to, $this->_node));
 }
开发者ID:Hywan,项目名称:moxl,代码行数:10,代码来源:GetMetadata.php

示例9: handle

 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();
     }
     $p = new \Picture();
     $p->fromBase((string) $stanza->items->item->data);
     $p->set($jid);
     $evt->runEvent('vcard', $c);
 }
开发者ID:Hywan,项目名称:moxl,代码行数:14,代码来源:Avatar.php

示例10: handle

 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);
     }
 }
开发者ID:Hywan,项目名称:moxl,代码行数:15,代码来源:Tune.php

示例11: handle

 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);
 }
开发者ID:Hywan,项目名称:moxl,代码行数:16,代码来源:Vcard4.php

示例12: deliver

 /**
  * Deliver the packet
  *
  * @return void
  */
 public final function deliver()
 {
     $action_ns = 'Moxl\\Xec\\Action';
     if (get_parent_class($this) == $action_ns || get_parent_class(get_parent_class($this)) == $action_ns) {
         $class = str_replace(array($action_ns, '\\'), array('', '_'), get_class($this));
         $key = strtolower(substr($class, 1));
     } else {
         $class = strtolower(get_class($this));
         $pos = strrpos($class, '\\');
         $key = substr($class, $pos + 1);
     }
     if ($this->method) {
         $key = $key . '_' . $this->method;
     }
     Utils::log('Package : Event "' . $key . '" from "' . $this->packet->from . '" fired');
     $evt = new \Event();
     $evt->runEvent($key, $this->packet);
 }
开发者ID:Hywan,项目名称:moxl,代码行数:23,代码来源:Payload.php

示例13: handle

 public function handle($stanza, $parent = false)
 {
     // Subscribe request
     if ((string) $stanza->attributes()->type == 'subscribe') {
         $session = \Session::start();
         $notifs = $session->get('activenotifs');
         $notifs[(string) $stanza->attributes()->from] = 'sub';
         $session->set('activenotifs', $notifs);
         $evt = new \Event();
         $evt->runEvent('subscribe', (string) $stanza->attributes()->from);
     } else {
         $p = new \modl\Presence();
         $p->setPresence($stanza);
         $pd = new \modl\PresenceDAO();
         $pd->set($p);
         /*if($p->photo) {
               $r = new Get;
               $r->setTo(echapJid((string)$stanza->attributes()->from))->request();
           }*/
         if ($p->muc && isset($stanza->x) && isset($stanza->x->status)) {
             $code = (string) $stanza->x->status->attributes()->code;
             if (isset($code) && $code == '110') {
                 if ($p->value != 5 && $p->value != 6) {
                     $this->method('muc_handle');
                     $this->pack($p);
                 } elseif ($p->value == 5) {
                     $pd->clearMuc($p->jid);
                     $this->method('unavailable_handle');
                     $this->pack($p);
                     $this->deliver();
                 }
             }
         } else {
             $cd = new \Modl\ContactDAO();
             $c = $cd->getRosterItem($p->jid, true);
             $this->pack($c);
             if ($p->value == 5 || $p->value == 6) {
                 $pd->delete($p);
             }
         }
         $this->deliver();
     }
 }
开发者ID:Hywan,项目名称:moxl,代码行数:43,代码来源:Presence.php

示例14: error

 public function error($error)
 {
     $evt = new \Event();
     $evt->runEvent('nostream', array('from' => $this->_to, 'node' => $this->_node));
 }
开发者ID:Hywan,项目名称:moxl,代码行数:5,代码来源:GetItem.php

示例15: errorNotAllowed

 public function errorNotAllowed($stanza)
 {
     $evt = new \Event();
     $evt->runEvent('myvcardinvalid', 'vcardfeaturenotimpl');
 }
开发者ID:Hywan,项目名称:moxl,代码行数:5,代码来源:Set.php


注:本文中的Event::runEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。