Removed unneeded addIqHandler

made roster_iq_handler reply to type='set' queries


git-svn-id: svn://netflint.net/xmpphp@66 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
gar 2008-11-21 09:21:05 +00:00
parent e9d36af595
commit f2bfbe252c

View File

@ -147,20 +147,6 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
$this->auto_subscribe = $autoSubscribe; $this->auto_subscribe = $autoSubscribe;
} }
/**
* Specialized addHandler for iq packets
*
* @param string $tagname
* @param string $ns
* @param string $pointer
* @param string $obj
*/
public function addIqHandler($tagname, $ns, $pointer, $obj = null) {
#TODO make this use addXPathHandler once that's written
# {jabber:client}iq/{$ns}$tagname
//$this->addHandler('iq', $ns, $pointer, $obj, 2);
}
/** /**
* Send XMPP Message * Send XMPP Message
* *
@ -337,8 +323,6 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
* @param string $xml * @param string $xml
*/ */
protected function roster_iq_handler($xml) { protected function roster_iq_handler($xml) {
// TODO: make this work
// TODO: reply if it's a type='set'
$status = "result"; $status = "result";
$xmlroster = $xml->sub('query'); $xmlroster = $xml->sub('query');
foreach($xmlroster->subs as $item) { foreach($xmlroster->subs as $item) {
@ -362,10 +346,8 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
$this->roster->addContact($contact[0], $contact[1], $contact[2], $contact[3]); $this->roster->addContact($contact[0], $contact[1], $contact[2], $contact[3]);
} }
} }
if ($xml->attrs['type'] == 'set' and $status == 'result') { if ($xml->attrs['type'] == 'set') {
#TODO send back result $this->send("<iq type=\"reply\" id=\"{$xml->attrs['id']}\" to=\"{$xml->attrs['from']}\" />");
} elseif ($xml->attrs['type'] == 'set') {
#TODO send back error
} }
} }