summaryrefslogtreecommitdiff
path: root/xmppdaemon.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlezvous.ca>2008-06-23 20:15:23 -0400
committerEvan Prodromou <evan@controlezvous.ca>2008-06-23 20:15:23 -0400
commit63dcbe1e6e4dc49de9ce9be82421c043cc751007 (patch)
treeb289596fb22b1e2fef21e27160ef20de2eed9e6a /xmppdaemon.php
parentae40dfe842c034263a49e2dbbde5c19ac9515c19 (diff)
add jabber library and use it
darcs-hash:20080624001523-34904-8d0c052f12301d86aeb9107149b34f22c94da1c4.gz
Diffstat (limited to 'xmppdaemon.php')
-rw-r--r--xmppdaemon.php12
1 files changed, 2 insertions, 10 deletions
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);