Add methods to generate error and result replies for IQ stanzas

This commit is contained in:
Florian Zeitz 2011-05-12 23:04:49 +02:00
parent 39d57946d9
commit 7d3796c62f
4 changed files with 77 additions and 21 deletions

View file

@ -574,23 +574,8 @@
if (!handled && ![[iq type] isEqual: @"error"]
&& ![[iq type] isEqual: @"result"]) {
XMPPJID *from = [iq from];
XMPPJID *to = [iq to];
OFXMLElement *error;
[iq setType: @"error"];
[iq setTo: from];
[iq setFrom: to];
error = [OFXMLElement elementWithName: @"error"];
[error addAttributeWithName: @"type"
stringValue: @"cancel"];
[error addChild:
[OFXMLElement elementWithName: @"service-unavailable"
namespace: XMPP_NS_STANZAS]];
[iq addChild: error];
[self sendStanza: iq];
[self sendStanza: [iq errorIQWithType: @"cancel"
condition: @"service-unavailable"]];
}
}