make XMPP take a priority for presence

darcs-hash:20080830091430-84dde-cb0bc7d8957fd295c823298b137c4cf4b285f689.gz
This commit is contained in:
Evan Prodromou 2008-08-30 05:14:30 -04:00
parent 2860313f4b
commit 377115cad3

View File

@ -164,7 +164,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=NULL) {
if($type == 'available') $type = ''; if($type == 'available') $type = '';
$to = htmlspecialchars($to); $to = htmlspecialchars($to);
$status = htmlspecialchars($status); $status = htmlspecialchars($status);
@ -173,12 +173,13 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
$out = "<presence"; $out = "<presence";
if($to) $out .= " to='$to'"; if($to) $out .= " to='$to'";
if($type) $out .= " type='$type'"; if($type) $out .= " type='$type'";
if($show == 'available' and !$status) { if($show == 'available' and !$status and is_null($priority)) {
$out .= "/>"; $out .= "/>";
} else { } else {
$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(!is_null($priority)) $out .= "<priority>$priority</priority>";
$out .= "</presence>"; $out .= "</presence>";
} }