static function maker($to = false, $status = false, $show = false, $priority = 0, $type = false) { $session = \Sessionx::start(); $dom = new \DOMDocument('1.0', 'UTF-8'); $root = $dom->createElementNS('jabber:client', 'presence'); $dom->appendChild($root); $root->setAttribute('from', $session->user . '@' . $session->host . '/' . $session->resource); $root->setAttribute('id', $session->id); if ($to != false) { $root->setAttribute('to', $to); } if ($type != false) { $root->setAttribute('type', $type); } if ($status != false) { $status = $dom->createElement('status', $status); $root->appendChild($status); } if ($show != false) { $show = $dom->createElement('show', $show); $root->appendChild($show); } if ($priority != 0) { $priority = $dom->createElement('priority', $priority); $root->appendChild($priority); } $c = $dom->createElementNS('http://jabber.org/protocol/caps', 'c'); $c->setAttribute('hash', 'sha-1'); $c->setAttribute('node', 'http://moxl.movim.eu/'); $c->setAttribute('ext', 'pmuc-v1 share-v1 voice-v1 video-v1 camera-v1'); $c->setAttribute('ver', \Moxl\Utils::generateCaps()); $root->appendChild($c); return $dom->saveXML($dom->documentElement); }
static function answer($to, $id) { $dom = new \DOMDocument('1.0', 'UTF-8'); $query = $dom->createElementNS('http://jabber.org/protocol/disco#info', 'query'); $query->setAttribute('node', 'http://moxl.movim.eu/#' . Utils::generateCaps()); $identity = $dom->createElement('identity'); $identity->setAttribute('category', 'client'); $identity->setAttribute('type', 'web'); $identity->setAttribute('name', 'Movim'); $query->appendChild($identity); foreach (Utils::getSupportedServices() as $service) { $feature = $dom->createElement('feature'); $feature->setAttribute('var', $service); $query->appendChild($feature); } $xml = \Moxl\API::iqWrapper($query, $to, 'result', $id); \Moxl\API::request($xml); }