]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
make XMPP take a priority for presence
authorEvan Prodromou <evan@prodromou.name>
Sat, 30 Aug 2008 09:14:30 +0000 (05:14 -0400)
committerEvan Prodromou <evan@prodromou.name>
Sat, 30 Aug 2008 09:14:30 +0000 (05:14 -0400)
darcs-hash:20080830091430-84dde-cb0bc7d8957fd295c823298b137c4cf4b285f689.gz

extlib/XMPPHP/XMPP.php

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