log incoming iq requests

This commit is contained in:
Daniel Gultsch 2016-05-15 09:55:06 +02:00
parent 540f6f3d7a
commit a25912c32c
2 changed files with 6 additions and 0 deletions

View File

@ -77,6 +77,7 @@ public final class Config {
public static final boolean DISABLE_HTTP_UPLOAD = false; 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 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 EXTENDED_SM_LOGGING = false; // log stanza counts
public static final boolean EXTENDED_IQ_LOGGING = true; // log iq requests
public static final boolean RESET_ATTEMPT_COUNT_ON_NETWORK_CHANGE = true; //setting to true might increase power consumption 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; public static final boolean ENCRYPT_ON_HTTP_UPLOADED = false;

View File

@ -268,6 +268,11 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
@Override @Override
public void onIqPacketReceived(final Account account, final IqPacket packet) { public void onIqPacketReceived(final Account account, final IqPacket packet) {
if (Config.EXTENDED_IQ_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) { if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) {
return; return;
} else if (packet.hasChild("query", Xmlns.ROSTER) && packet.fromServer(account)) { } else if (packet.hasChild("query", Xmlns.ROSTER) && packet.fromServer(account)) {