diff --git a/XMPPHP/XMPP.php b/XMPPHP/XMPP.php index 76a26ba..88c414a 100644 --- a/XMPPHP/XMPP.php +++ b/XMPPHP/XMPP.php @@ -218,6 +218,41 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { #$this->send(""); } + /** + * Add user to Roster + * + * @param string $jid + * @param string $name + */ + public function RosterAddUser($jid, $name=null, $group=null) { + $payload = "\n". + ($group?''.htmlspecialchars($group, ENT_QUOTES, 'UTF-8').'':''); + $this->SendIq(NULL, 'set', "jabber:iq:roster", $payload); + } + + /** + * Send ID action + * + * @param string $to + * @param string $type + * @param string $xmlns + * @param string $payload + * @param string $from + */ + private function sendIq($to = NULL, $type = 'get', $xmlns = NULL, $payload = NULL, $from = NULL) + { + $id = $this->getID(); + $xml = " + + $payload + + "; + return $this->send($xml); + } + /** * Message handler *