[core] Also provide incoming Nonzas to SmackDebugger

This commit is contained in:
Florian Schmaus 2021-03-25 14:51:25 +01:00
parent 5844bee1c3
commit b58511d624
1 changed files with 10 additions and 4 deletions

View File

@ -1406,6 +1406,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
return successNonza;
}
private void maybeNotifyDebuggerAboutIncoming(TopLevelStreamElement incomingTopLevelStreamElement) {
final SmackDebugger debugger = this.debugger;
if (debugger != null) {
debugger.onIncomingStreamElement(incomingTopLevelStreamElement);
}
}
protected final void parseAndProcessNonza(XmlPullParser parser) throws IOException, XmlPullParserException, SmackParsingException {
ParserUtils.assertAtStartTag(parser);
@ -1434,6 +1441,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
Nonza nonza = nonzaProvider.parse(parser, incomingStreamXmlEnvironment);
maybeNotifyDebuggerAboutIncoming(nonza);
for (NonzaCallback nonzaCallback : nonzaCallbacks) {
nonzaCallback.onNonzaReceived(nonza);
}
@ -1473,10 +1482,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
protected void processStanza(final Stanza stanza) throws InterruptedException {
assert stanza != null;
final SmackDebugger debugger = this.debugger;
if (debugger != null) {
debugger.onIncomingStreamElement(stanza);
}
maybeNotifyDebuggerAboutIncoming(stanza);
lastStanzaReceived = System.currentTimeMillis();
// Deliver the incoming packet to listeners.