From 63dcbe1e6e4dc49de9ce9be82421c043cc751007 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 23 Jun 2008 20:15:23 -0400 Subject: add jabber library and use it darcs-hash:20080624001523-34904-8d0c052f12301d86aeb9107149b34f22c94da1c4.gz --- xmppdaemon.php | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'xmppdaemon.php') diff --git a/xmppdaemon.php b/xmppdaemon.php index aa402b1e2..b71c93dc8 100644 --- a/xmppdaemon.php +++ b/xmppdaemon.php @@ -51,14 +51,6 @@ class XMPPDaemon { return !$this->conn->disconnected; } - function normalize_jid($jid) { - preg_match("/(?:([^\@]+)\@)?([^\/]+)(?:\/(.*))?$/", $jid, $matches); - $node = $matches[1]; - $server = $matches[2]; - $resource = $matches[3]; - return strtolower($node.'@'.$server); - } - function handle() { while(!$this->conn->disconnected) { $payloads = $this->conn->processUntil(array('message', 'presence', @@ -87,7 +79,7 @@ class XMPPDaemon { if (strlen($pl['body']) == 0) { return; } - $from = $this->normalize_jid($pl['from']); + $from = jabber_normalize_jid($pl['from']); $user = User::staticGet('jabber', $from); if (!$user) { $this->log(LOG_WARNING, 'Message from unknown user ' . $from); @@ -162,7 +154,7 @@ class XMPPDaemon { } function handle_presence(&$pl) { - $from = $this->normalize_jid($pl['from']); + $from = jabber_normalize_jid($pl['from']); $user = User::staticGet('jabber', $from); if (!$user) { $this->log(LOG_WARNING, 'Message from unknown user ' . $from); -- cgit v1.2.3-54-g00ecf