本文整理汇总了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();
}
}
}
示例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;
}
}
示例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);
}*/
}
}
示例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);
}
示例5: errorItemNotFound
public function errorItemNotFound($error)
{
$evt = new \Event();
if ($this->_me) {
$evt->runEvent('myvcardinvalid');
}
}
示例6: handle
public function handle($stanza, $parent = false)
{
if ($stanza["type"] == "result") {
$evt = new \Event();
$evt->runEvent('groupremoved', $this->_node);
}
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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();
}
}
示例14: error
public function error($error)
{
$evt = new \Event();
$evt->runEvent('nostream', array('from' => $this->_to, 'node' => $this->_node));
}
示例15: errorNotAllowed
public function errorNotAllowed($stanza)
{
$evt = new \Event();
$evt->runEvent('myvcardinvalid', 'vcardfeaturenotimpl');
}