/** * {@inheritdoc} */ public function __construct($host, $port, $username, $password, $resource = 'superfeedr', $server = null) { parent::__construct($host, $port, $username, $password, $resource, $server); // TODO: Fix this in XMPPHP implementation, not this subclass $this->until = array(); // Catch when a session is started $this->addEventHandler('session_start', 'sessionStarted', $this); }
public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null) { parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel); if (!$server) { $server = $host; } $this->stream_start = '<stream:stream to="' . $server . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">'; $this->fulljid = "{$user}@{$server}/{$resource}"; }
/** * Constructor * * @param string $host * @param integer $port * @param string $user * @param string $password * @param string $resource * @param string $server * @param boolean $printlog * @param string $loglevel */ public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null) { parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel); // We use $host to connect, but $server to build JIDs if specified. // This seems to fix an upstream bug where $host was used to build // $this->basejid, never seen since it isn't actually used in the base // classes. if (!$server) { $server = $this->host; } $this->basejid = $this->user . '@' . $server; // Normally the fulljid is filled out by the server at resource binding // time, but we need to do it since we're not talking to a real server. $this->fulljid = "{$this->basejid}/{$this->resource}"; }
public function __construct($jid, $password, $server = null) { $jidarr = split('@', $jid, 2); $server = $jidarr[1]; $user = $jidarr[0]; $host = 'xmpp.superfeedr.com'; $this->addXPathHandler('{jabber:client}message/{http://jabber.org/protocol/pubsub#event}event/{http://superfeedr.com/xmpp-pubsub-ext}status', 'handle_superfeedr_msg'); XMPPHP_XMPP::__construct($host, 5222, $user, $password, 'superfeedr', $server, false, XMPPHP_Log::LEVEL_INFO); print $jid; print $server; $this->connect(); $payloads = $this->processUntil(array('session_start', 'end_stream')); foreach ($payloads as $event) { $pl = $event[1]; switch ($event[0]) { case 'session_start': break; case 'end_stream': break; } } }
/** * Constructor * * Creates connection to the XMPP server, and loads all command classes. * * @return void */ public function __construct() { // Load config $conf = parse_ini_file(dirname(__FILE__) . '/../../Config/JabberBot.ini', true); $this->_config = new JabberBot_Config($conf); $server = $this->_config->getValue('server'); $this->rooms = array(); $this->db = new JabberBot_Db('bot'); $this->acl = new JabberBot_Acl(); $botConf = $this->_config->getValue('bot'); $this->defaultRoom = isset($botConf['defaultroom']) ? $botConf['defaultroom'] : null; $this->pingInverval = $botConf['pinginterval']; // Call parent constructor, and set variables parent::__construct($server['host'], $server['port'], $server['user'], $server['password'], $server['resource'], null, true, $botConf['loglevel']); $this->addEventHandler('reconnect', 'handleReconnect', $this); $this->useEncryption($server['ssl'] == 'true'); // Set up Commands $commandBase = dirname(__FILE__) . '/Command/'; foreach (scandir($commandBase) as $filename) { if (preg_match('/^(.*).class.php/', $filename)) { $this->log->log('Including ' . $commandBase . $filename, XMPPHP_Log::LEVEL_INFO); require_once $commandBase . $filename; } } $this->arrCommands = array(); foreach (get_declared_classes() as $className) { if (get_parent_class($className) == 'JabberBot_Command') { $this->arrCommands[] = new $className($this); $this->log->log('Loaded Command: ' . $className, XMPPHP_Log::LEVEL_INFO); } } // Connect to the server try { $this->connect(); $this->processUntil('session_start'); } catch (Exception $e) { die('Failed to connect: ' . $e->getMessage()); } // Connect to the default conference room, if set. if ($this->defaultRoom) { $this->enterRoom($this->defaultRoom); } // Announce our presence for private chats $this->presence(); $this->resetPing(); }
public function __construct($host, $port, $user, $password, $resource, $server = null, $printlog = false, $loglevel = null) { parent::__construct($host, $port, $user, $password, $resource, $server, $printlog, $loglevel); }