improved logging for node configuration change

This commit is contained in:
Daniel Gultsch 2018-05-03 22:44:28 +02:00
parent 2b492a1fba
commit 7b3d871f28
3 changed files with 11 additions and 5 deletions

View File

@ -597,7 +597,7 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
} }
if (packet.getType() == IqPacket.TYPE.ERROR) { if (packet.getType() == IqPacket.TYPE.ERROR) {
if (preConditionNotMet) { if (preConditionNotMet) {
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": pre condition still not met on second attempt"); Log.d(Config.LOGTAG,account.getJid().asBareJid()+": device list pre condition still not met on second attempt");
} else if (error != null) { } else if (error != null) {
pepBroken = true; pepBroken = true;
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing own device id" + packet.findChild("error")); Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing own device id" + packet.findChild("error"));
@ -791,8 +791,9 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
mXmppConnectionService.sendIqPacket(account, publish, new OnIqPacketReceived() { mXmppConnectionService.sendIqPacket(account, publish, new OnIqPacketReceived() {
@Override @Override
public void onIqPacketReceived(final Account account, IqPacket packet) { public void onIqPacketReceived(final Account account, IqPacket packet) {
Element error = packet.getType() == IqPacket.TYPE.ERROR ? packet.findChild("error") : null; final Element error = packet.getType() == IqPacket.TYPE.ERROR ? packet.findChild("error") : null;
if (firstAttempt && error != null && error.hasChild("precondition-not-met", Namespace.PUBSUB_ERROR)) { final boolean preconditionNotMet = error != null && error.hasChild("precondition-not-met", Namespace.PUBSUB_ERROR);
if (firstAttempt && preconditionNotMet) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": precondition wasn't met for bundle. pushing node configuration"); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": precondition wasn't met for bundle. pushing node configuration");
final String node = AxolotlService.PEP_BUNDLES + ":" + getOwnDeviceId(); final String node = AxolotlService.PEP_BUNDLES + ":" + getOwnDeviceId();
mXmppConnectionService.pushNodeConfiguration(account, node, publishOptions, new XmppConnectionService.OnConfigurationPushed() { mXmppConnectionService.pushNodeConfiguration(account, node, publishOptions, new XmppConnectionService.OnConfigurationPushed() {
@ -815,8 +816,12 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
publishOwnDeviceIdIfNeeded(); publishOwnDeviceIdIfNeeded();
} }
} else if (packet.getType() == IqPacket.TYPE.ERROR) { } else if (packet.getType() == IqPacket.TYPE.ERROR) {
if (preconditionNotMet) {
Log.d(Config.LOGTAG,getLogprefix(account) + "bundle precondition still not met after second attempt");
} else {
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing bundle: " + error);
}
pepBroken = true; pepBroken = true;
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while publishing bundle: " + packet.findChild("error"));
} }
} }
}); });

View File

@ -39,7 +39,7 @@ public class MessageGenerator extends AbstractGenerator {
if (this.mXmppConnectionService.indicateReceived() && !isWithSelf) { if (this.mXmppConnectionService.indicateReceived() && !isWithSelf) {
packet.addChild("request", "urn:xmpp:receipts"); packet.addChild("request", "urn:xmpp:receipts");
} }
} else if (message.getType() == Message.TYPE_PRIVATE) { } else if (message.getType() == Message.TYPE_PRIVATE) { //TODO files and images might be private as well
packet.setTo(message.getCounterpart()); packet.setTo(message.getCounterpart());
packet.setType(MessagePacket.TYPE_CHAT); packet.setType(MessagePacket.TYPE_CHAT);
packet.addChild("x","http://jabber.org/protocol/muc#user"); packet.addChild("x","http://jabber.org/protocol/muc#user");

View File

@ -2483,6 +2483,7 @@ public class XmppConnectionService extends Service {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.getType() == IqPacket.TYPE.RESULT && callback != null) { if (packet.getType() == IqPacket.TYPE.RESULT && callback != null) {
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": successfully changed node configuration for node "+node);
callback.onPushSucceeded(); callback.onPushSucceeded();
} else if (packet.getType() == IqPacket.TYPE.ERROR && callback != null) { } else if (packet.getType() == IqPacket.TYPE.ERROR && callback != null) {
callback.onPushFailed(); callback.onPushFailed();