From 64ba09f9a3bfa4ac4fcba9581d1c581f919c7744 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 26 Jun 2008 03:59:20 -0400 Subject: handle host ! darcs-hash:20080626075920-34904-0aad06d788f8dbf3a03d17752ba49d866322594e.gz --- xmppdaemon.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'xmppdaemon.php') diff --git a/xmppdaemon.php b/xmppdaemon.php index 94358f7ee..4e4511259 100644 --- a/xmppdaemon.php +++ b/xmppdaemon.php @@ -31,23 +31,27 @@ require_once(INSTALLDIR . '/lib/jabber.php'); class XMPPDaemon { - function XMPPDaemon() { + function XMPPDaemon($resource=NULL) { static $attrs = array('server', 'port', 'user', 'password', - 'resource'); + 'resource', 'host'); foreach ($attrs as $attr) { $this->$attr = common_config('xmpp', $attr); } + + if ($resource) { + $this->resource = $resource; + } } function connect() { - $this->conn = new XMPP($this->server, $this->port, $this->user, - $this->password, $this->resource); + $this->conn = jabber_connect($this->resource, + "Send me a message to post a notice"); + ); if (!$this->conn) { return false; } - $this->conn->connect(); return !$this->conn->disconnected; } @@ -181,10 +185,6 @@ class XMPPDaemon { } } - function handle_session(&$pl) { - $this->conn->presence($status="Send me a message to post a notice"); - } - function log($level, $msg) { common_log($level, 'XMPPDaemon('.$this->resource.'): '.$msg); } @@ -209,7 +209,6 @@ class XMPPDaemon { } $this->conn->send($out); } - } $daemon = new XMPPDaemon(); -- cgit v1.2.3-54-g00ecf