From 7309d4fa68dfa8559b28682cb5ee80a7cfff99de Mon Sep 17 00:00:00 2001 From: fritzy Date: Fri, 28 Nov 2008 20:37:52 +0000 Subject: [PATCH] * presence and message events now include xml object in payload * you can now set the priority in your presence git-svn-id: svn://netflint.net/xmpphp@73 ef36c318-a008-4979-b6e8-6b496270793b --- XMPPHP/XMPP.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/XMPPHP/XMPP.php b/XMPPHP/XMPP.php index ed7f55b..73fbd26 100644 --- a/XMPPHP/XMPP.php +++ b/XMPPHP/XMPP.php @@ -187,7 +187,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { * @param string $show * @param string $to */ - public function presence($status = null, $show = 'available', $to = null, $type='available') { + public function presence($status = null, $show = 'available', $to = null, $type='available', $priority=0) { if($type == 'available') $type = ''; $to = htmlspecialchars($to); $status = htmlspecialchars($status); @@ -202,6 +202,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { $out .= ">"; if($show != 'available') $out .= "$show"; if($status) $out .= "$status"; + if($priority) $out .= "$priority"; $out .= ""; } @@ -221,6 +222,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { } $payload['from'] = $xml->attrs['from']; $payload['body'] = $xml->sub('body')->data; + $payload['xml'] = $xml; $this->log->log("Message: {$xml->sub('body')->data}", XMPPHP_Log::LEVEL_DEBUG); $this->event('message', $payload); } @@ -236,6 +238,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { $payload['from'] = $xml->attrs['from']; $payload['status'] = (isset($xml->sub('status')->data)) ? $xml->sub('status')->data : ''; $payload['priority'] = (isset($xml->sub('priority')->data)) ? intval($xml->sub('priority')->data) : 0; + $payload['xml'] = $xml; if($this->track_presence) { $this->roster->setPresence($payload['from'], $payload['priority'], $payload['show'], $payload['status']); }