diff options
Diffstat (limited to 'src/main')
5 files changed, 19 insertions, 1 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java index 70eec7a2..546ad7ee 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java +++ b/src/main/java/de/thedevstack/conversationsplus/ConversationsPlusPreferences.java @@ -14,6 +14,10 @@ public class ConversationsPlusPreferences extends Settings { private static ConversationsPlusPreferences instance; private final SharedPreferences sharedPreferences; + public static boolean logStanzas() { + return getBoolean("log_stanzas", true); + } + public static boolean omemoEnabled() { return getBoolean("omemo_enabled", false); } diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/XmppConnection.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/XmppConnection.java index b886bf65..dfea06c8 100644 --- a/src/main/java/de/thedevstack/conversationsplus/xmpp/XmppConnection.java +++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/XmppConnection.java @@ -595,6 +595,9 @@ public class XmppConnection implements Runnable { } ++stanzasReceived; lastPacketReceived = SystemClock.elapsedRealtime(); + if (ConversationsPlusPreferences.logStanzas()) { + Logging.d("ProcessPacket", "Incoming stanza: " + element.toString()); + } return element; } @@ -1208,7 +1211,9 @@ public class XmppConnection implements Runnable { disconnect(true); return; } - Logging.d("SendIqPacket", "Outgoing stanza: " + packet.toString()); + if (ConversationsPlusPreferences.logStanzas()) { + Logging.d("SendIqPacket", "Outgoing stanza: " + packet.toString()); + } tagWriter.writeStanzaAsync(packet); if (packet instanceof AbstractAcknowledgeableStanza) { AbstractAcknowledgeableStanza stanza = (AbstractAcknowledgeableStanza) packet; diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 4cfbd67a..826bbbb7 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -635,4 +635,6 @@ <string name="select_image_and_crop">Bild auswählen und zuschneiden</string> <string name="this_account_is_disabled">Du hast diesen Account deaktiviert</string> <string name="cplus_are_you_sure">Bist du dir sicher?</string> + <string name="pref_log_stanzas_summary">Stanzas protokollieren, um das Debugging zu erleichtern</string> + <string name="pref_log_stanzas">Stanzas protokollieren</string> </resources> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index eb1fefb8..b76be95d 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -686,4 +686,6 @@ <string name="cplus_remote_file_delete_failed">Failed to delete remote file.</string> <string name="remote_filestatus_not_found">Remote file not found.</string> <string name="checking_remote_filesize">Checking file size on remote host.</string> + <string name="pref_log_stanzas_summary">Log stanzas messages to logcat to improve debugging</string> + <string name="pref_log_stanzas">Log stanzas</string> </resources> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 44b66ab7..96be892e 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -252,6 +252,11 @@ android:summary="@string/pref_use_indicate_received_summary" android:title="@string/pref_use_indicate_received"/> <CheckBoxPreference + android:defaultValue="true" + android:key="log_stanzas" + android:summary="@string/pref_log_stanzas_summary" + android:title="@string/pref_log_stanzas"/> + <CheckBoxPreference android:defaultValue="false" android:key="keep_foreground_service" android:summary="@string/pref_keep_foreground_service_summary" |