@@ -1880,7 +1880,7 @@ -(void) processInput:(MLXMLNode*) parsedStanza withDelayedReplay:(BOOL) delayedR
18801880 [self requestSMAck: NO ]; // request ack again (will only happen if queue is not empty)
18811881 }
18821882 }
1883- else if ([parsedStanza check: @" /{jabber:client}presence" ])
1883+ else if ([parsedStanza check: @" /{jabber:client}presence" ] && self. accountState >= kStateInitStarted )
18841884 {
18851885 XMPPPresence* presenceNode = (XMPPPresence*)parsedStanza;
18861886
@@ -2108,7 +2108,7 @@ -(void) processInput:(MLXMLNode*) parsedStanza withDelayedReplay:(BOOL) delayedR
21082108 // only mark stanza as handled *after* processing it
21092109 [self incrementLastHandledStanzaWithDelayedReplay: delayedReplay];
21102110 }
2111- else if ([parsedStanza check: @" /{jabber:client}message" ])
2111+ else if ([parsedStanza check: @" /{jabber:client}message" ] && self. accountState >= kStateInitStarted )
21122112 {
21132113 // outerMessageNode and messageNode are the same for messages not carrying a carbon copy or mam result
21142114 XMPPMessage* originalParsedStanza = (XMPPMessage*)[parsedStanza copy ];
@@ -2300,6 +2300,9 @@ -(void) processInput:(MLXMLNode*) parsedStanza withDelayedReplay:(BOOL) delayedR
23002300 // only mark stanza as handled *after* processing it
23012301 [self incrementLastHandledStanzaWithDelayedReplay: delayedReplay];
23022302 }
2303+ // nearly all iqs accepted must be a response to something requested
2304+ // --> no kStateInitStarted, kStateBound or kStateBinding gatekeeping needed
2305+ // see processUnboundIq:forAccount: in MLIQProcessor.m for more information
23032306 else if ([parsedStanza check: @" /{jabber:client}iq" ])
23042307 {
23052308 XMPPIQ* iqNode = (XMPPIQ*)parsedStanza;
@@ -2364,7 +2367,7 @@ -(void) processInput:(MLXMLNode*) parsedStanza withDelayedReplay:(BOOL) delayedR
23642367 // only mark stanza as handled *after* processing it
23652368 [self incrementLastHandledStanzaWithDelayedReplay: delayedReplay];
23662369 }
2367- else if ([parsedStanza check: @" /{urn:xmpp:sm:3}enabled" ])
2370+ else if ([parsedStanza check: @" /{urn:xmpp:sm:3}enabled" ] && self. accountState == kStateBound )
23682371 {
23692372 NSMutableArray * stanzas;
23702373 @synchronized (_stateLockObject) {
@@ -2494,7 +2497,7 @@ -(void) processInput:(MLXMLNode*) parsedStanza withDelayedReplay:(BOOL) delayedR
24942497 [self bindResource: self .connectionProperties.identity.resource];
24952498 }
24962499 }
2497- else if ([parsedStanza check: @" /{urn:xmpp:sm:3}failed" ] && self.connectionProperties .supportsSM3 && self.accountState > = kStateBound && !self.resuming )
2500+ else if ([parsedStanza check: @" /{urn:xmpp:sm:3}failed" ] && self.connectionProperties .supportsSM3 && self.accountState = = kStateBound && !self.resuming )
24982501 {
24992502 // we landed here because smacks enable failed
25002503
@@ -2885,6 +2888,7 @@ -(void) processInput:(MLXMLNode*) parsedStanza withDelayedReplay:(BOOL) delayedR
28852888 }
28862889 else
28872890 {
2891+ // this includes spurious message/presence errors generated on bind by prosody's *broken smacks module* on and reflected by MUCs
28882892 DDLogWarn (@" Ignoring unhandled top-level xml element <%@ >: %@ " , parsedStanza.element , parsedStanza);
28892893 }
28902894 }
0 commit comments