From 36ae840d76566341283008854f678661840c6497 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 5 Jun 2016 02:04:31 +0200 Subject: [PATCH] log all background stanzas when background logging is enabled --- src/main/java/eu/siacs/conversations/Config.java | 2 +- src/main/java/eu/siacs/conversations/parser/IqParser.java | 5 ----- .../java/eu/siacs/conversations/parser/MessageParser.java | 3 --- .../java/eu/siacs/conversations/xmpp/XmppConnection.java | 3 +++ 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index ee2f3f195..9e53e72b7 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -83,7 +83,7 @@ public final class Config { public static final boolean DISABLE_HTTP_UPLOAD = false; public static final boolean DISABLE_STRING_PREP = false; // setting to true might increase startup performance public static final boolean EXTENDED_SM_LOGGING = false; // log stanza counts - public static final boolean BACKGROUND_STANZA_LOGGING = false; + public static final boolean BACKGROUND_STANZA_LOGGING = false; //log all stanzas that were received while the app is in background public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = true; //setting to true might increase power consumption public static final boolean ENCRYPT_ON_HTTP_UPLOADED = false; diff --git a/src/main/java/eu/siacs/conversations/parser/IqParser.java b/src/main/java/eu/siacs/conversations/parser/IqParser.java index 189df4a7b..06d4e37e0 100644 --- a/src/main/java/eu/siacs/conversations/parser/IqParser.java +++ b/src/main/java/eu/siacs/conversations/parser/IqParser.java @@ -277,11 +277,6 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived { @Override public void onIqPacketReceived(final Account account, final IqPacket packet) { - if (Config.BACKGROUND_STANZA_LOGGING && (packet.getType() == IqPacket.TYPE.GET || packet.getType() == IqPacket.TYPE.SET)) { - Element first = packet.getChildren().size() > 0 ? packet.getChildren().get(0) : null; - Log.d(Config.LOGTAG,account.getJid().toBareJid()+": IQ request from "+packet.getFrom()+(first == null ? "" : " "+first)); - } - if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) { return; } else if (packet.hasChild("query", Xmlns.ROSTER) && packet.fromServer(account)) { diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index 2bdb747d5..354128f0b 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -537,9 +537,6 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece } } } else if (!packet.hasChild("body")){ //no body - if (Config.BACKGROUND_STANZA_LOGGING && mXmppConnectionService.checkListeners()) { - Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": " + packet+ " (carbon="+Boolean.toString(isCarbon)+")"); - } Conversation conversation = mXmppConnectionService.find(account, from.toBareJid()); if (isTypeGroupChat) { if (packet.hasChild("subject")) { diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 1128907e6..928d4fa03 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -637,6 +637,9 @@ public class XmppConnection implements Runnable { } ++stanzasReceived; lastPacketReceived = SystemClock.elapsedRealtime(); + if (Config.BACKGROUND_STANZA_LOGGING && mXmppConnectionService.checkListeners()) { + Log.d(Config.LOGTAG,"[background stanza] "+element); + } return element; }