registerEvent('bob', 'onRequest'); } function onRequest($packet) { $content = $packet->content; $to = $content[0]; $id = $content[1]; $cid = $content[2]; list($c, $ext) = explode('@', $cid); list($sh, $key) = explode('+', $c); $base64 = base64_encode(file_get_contents(dirname(__FILE__).'/stickers/'.$key.'.png')); $a = new Answer; $a->setTo($to) ->setId($id) ->setCid($cid) ->setType('image/png') ->setBase64($base64) ->request(); } function ajaxSend($to, $file) { if(!$this->validateJid($to)) return; list($key, $ext) = explode('.', $file); $filepath = dirname(__FILE__).'/stickers/'.$key.'.png'; if(!file_exists($filepath)) return; // We get the base64 $base64 = base64_encode(file_get_contents($filepath)); // Caching the picture $p = new Picture; $p->fromBase($base64); $p->set($key, 'png'); // Creating a message $m = new \Modl\Message(); $m->session = $this->user->getLogin(); $m->jidto = echapJid($to); $m->jidfrom = $this->user->getLogin(); $m->sticker = $key; $m->body = 'A Stickers has been sent using Movim'; $m->published = gmdate('Y-m-d H:i:s'); $m->delivered = gmdate('Y-m-d H:i:s'); $session = \Sessionx::start(); $m->id = Uuid::uuid4(); $m->type = 'chat'; $m->resource = $session->resource; // Sending the sticker $html = "