Implements FS#106: Add expert setting to log xml trace

This commit is contained in:
steckbrief 2017-08-01 14:56:32 +02:00
commit a949114027
5 changed files with 19 additions and 1 deletions

View file

@ -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);
}

View file

@ -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;

View file

@ -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>

View file

@ -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>

View file

@ -251,6 +251,11 @@
android:key="indicate_received"
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"