* 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
This commit is contained in:
parent
27b3729c8e
commit
7309d4fa68
@ -187,7 +187,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
|
|||||||
* @param string $show
|
* @param string $show
|
||||||
* @param string $to
|
* @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 = '';
|
if($type == 'available') $type = '';
|
||||||
$to = htmlspecialchars($to);
|
$to = htmlspecialchars($to);
|
||||||
$status = htmlspecialchars($status);
|
$status = htmlspecialchars($status);
|
||||||
@ -202,6 +202,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
|
|||||||
$out .= ">";
|
$out .= ">";
|
||||||
if($show != 'available') $out .= "<show>$show</show>";
|
if($show != 'available') $out .= "<show>$show</show>";
|
||||||
if($status) $out .= "<status>$status</status>";
|
if($status) $out .= "<status>$status</status>";
|
||||||
|
if($priority) $out .= "<priority>$priority</priority>";
|
||||||
$out .= "</presence>";
|
$out .= "</presence>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,6 +222,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
|
|||||||
}
|
}
|
||||||
$payload['from'] = $xml->attrs['from'];
|
$payload['from'] = $xml->attrs['from'];
|
||||||
$payload['body'] = $xml->sub('body')->data;
|
$payload['body'] = $xml->sub('body')->data;
|
||||||
|
$payload['xml'] = $xml;
|
||||||
$this->log->log("Message: {$xml->sub('body')->data}", XMPPHP_Log::LEVEL_DEBUG);
|
$this->log->log("Message: {$xml->sub('body')->data}", XMPPHP_Log::LEVEL_DEBUG);
|
||||||
$this->event('message', $payload);
|
$this->event('message', $payload);
|
||||||
}
|
}
|
||||||
@ -236,6 +238,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
|
|||||||
$payload['from'] = $xml->attrs['from'];
|
$payload['from'] = $xml->attrs['from'];
|
||||||
$payload['status'] = (isset($xml->sub('status')->data)) ? $xml->sub('status')->data : '';
|
$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['priority'] = (isset($xml->sub('priority')->data)) ? intval($xml->sub('priority')->data) : 0;
|
||||||
|
$payload['xml'] = $xml;
|
||||||
if($this->track_presence) {
|
if($this->track_presence) {
|
||||||
$this->roster->setPresence($payload['from'], $payload['priority'], $payload['show'], $payload['status']);
|
$this->roster->setPresence($payload['from'], $payload['priority'], $payload['show'], $payload['status']);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user