Split up XMPP_handleStanza.
Non-Stanzas are now handled in separate functions
This commit is contained in:
parent
91b2a0b119
commit
683fc1e3ae
2 changed files with 106 additions and 93 deletions
|
@ -163,6 +163,9 @@
|
|||
- (XMPPRoster*)roster;
|
||||
|
||||
- (void)XMPP_startStream;
|
||||
- (void)XMPP_handleStream: (OFXMLElement*)elem;
|
||||
- (void)XMPP_handleTLS: (OFXMLElement*)elem;
|
||||
- (void)XMPP_handleSASL: (OFXMLElement*)elem;
|
||||
- (void)XMPP_handleStanza: (OFXMLElement*)elem;
|
||||
- (void)XMPP_sendAuth: (OFString*)name;
|
||||
- (void)XMPP_handleIQ: (XMPPIQ*)iq;
|
||||
|
|
|
@ -297,8 +297,18 @@
|
|||
|
||||
of_log(@"In: %@", elem);
|
||||
|
||||
if ([[elem namespace] isEqual: XMPP_NS_CLIENT])
|
||||
[self XMPP_handleStanza: elem];
|
||||
|
||||
if ([[elem namespace] isEqual: XMPP_NS_STREAM])
|
||||
[self XMPP_handleStream: elem];
|
||||
|
||||
if ([[elem namespace] isEqual: XMPP_NS_STARTTLS])
|
||||
[self XMPP_handleTLS: elem];
|
||||
|
||||
if ([[elem namespace] isEqual: XMPP_NS_SASL])
|
||||
[self XMPP_handleSASL: elem];
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
|
@ -313,7 +323,6 @@
|
|||
|
||||
- (void)XMPP_handleStanza: (OFXMLElement*)elem
|
||||
{
|
||||
if ([[elem namespace] isEqual: XMPP_NS_CLIENT]) {
|
||||
if ([[elem name] isEqual: @"iq"]) {
|
||||
[self XMPP_handleIQ: [XMPPIQ stanzaWithElement: elem]];
|
||||
return;
|
||||
|
@ -332,18 +341,21 @@
|
|||
}
|
||||
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
if ([[elem namespace] isEqual: XMPP_NS_STREAM]) {
|
||||
|
||||
- (void)XMPP_handleStream: (OFXMLElement*)elem
|
||||
{
|
||||
if ([[elem name] isEqual: @"features"]) {
|
||||
[self XMPP_handleFeatures: elem];
|
||||
return;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
if ([[elem namespace] isEqual: XMPP_NS_STARTTLS]) {
|
||||
- (void)XMPP_handleTLS: (OFXMLElement*)elem
|
||||
{
|
||||
if ([[elem name] isEqual: @"proceed"]) {
|
||||
/* FIXME: Catch errors here */
|
||||
SSLSocket *newSock;
|
||||
|
@ -371,9 +383,10 @@
|
|||
@throw [OFException newWithClass: isa];
|
||||
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
if ([[elem namespace] isEqual: XMPP_NS_SASL]) {
|
||||
- (void)XMPP_handleSASL: (OFXMLElement*)elem
|
||||
{
|
||||
if ([[elem name] isEqual: @"challenge"]) {
|
||||
OFXMLElement *responseTag;
|
||||
OFDataArray *challenge =
|
||||
|
@ -417,9 +430,6 @@
|
|||
reason: [elem XMLString]];
|
||||
}
|
||||
|
||||
assert(0);
|
||||
}
|
||||
|
||||
assert(0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue