1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-21 22:02:06 +01:00

[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

View file

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