diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java b/src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java index 35b41d61..b3cfc813 100644 --- a/src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java +++ b/src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java @@ -28,19 +28,14 @@ import de.thedevstack.conversationsplus.crypto.axolotl.AxolotlService; import de.thedevstack.conversationsplus.entities.Account; import de.thedevstack.conversationsplus.entities.Contact; import de.thedevstack.conversationsplus.services.avatar.AvatarCache; -import de.thedevstack.conversationsplus.services.avatar.AvatarService; import de.thedevstack.conversationsplus.services.XmppConnectionService; +import de.thedevstack.conversationsplus.utils.UiUpdateHelper; import de.thedevstack.conversationsplus.utils.Xmlns; -import de.thedevstack.conversationsplus.utils.XmppSendUtil; import de.thedevstack.conversationsplus.xml.Element; import de.thedevstack.conversationsplus.xmpp.OnIqPacketReceived; import de.thedevstack.conversationsplus.xmpp.OnUpdateBlocklist; -import de.thedevstack.conversationsplus.xmpp.iqversion.IqVersionPacket; -import de.thedevstack.conversationsplus.xmpp.iqversion.IqVersionPacketGenerator; import de.thedevstack.conversationsplus.xmpp.jid.Jid; import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket; -import de.thedevstack.conversationsplus.xmpp.time.TimePacket; -import de.thedevstack.conversationsplus.xmpp.time.TimePacketGenerator; public class IqParser extends AbstractParser implements OnIqPacketReceived { @@ -263,9 +258,9 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived { @Override public void onIqPacketReceived(final Account account, final IqPacket packet) { - if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) { - return; - } else if (packet.hasChild("query", Xmlns.ROSTER) && packet.fromServer(account)) { + if (packet.getType() == IqPacket.TYPE.ERROR || packet.getType() == IqPacket.TYPE.TIMEOUT) { + return; + } else if (packet.hasChild("query", Xmlns.ROSTER) && packet.fromServer(account)) { final Element query = packet.findChild("query"); // If this is in response to a query for the whole roster: if (packet.getType() == IqPacket.TYPE.RESULT) { @@ -300,7 +295,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived { account.getBlocklist().addAll(jids); } // Update the UI - mXmppConnectionService.updateBlocklistUi(OnUpdateBlocklist.Status.BLOCKED); + UiUpdateHelper.updateBlocklistUi(OnUpdateBlocklist.Status.BLOCKED); } else if (packet.hasChild("unblock", Xmlns.BLOCKING) && packet.fromServer(account) && packet.getType() == IqPacket.TYPE.SET) { Logging.d(Config.LOGTAG, "Received unblock update from server"); @@ -320,21 +315,11 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived { } account.getBlocklist().removeAll(jids); } - mXmppConnectionService.updateBlocklistUi(OnUpdateBlocklist.Status.UNBLOCKED); + UiUpdateHelper.updateBlocklistUi(OnUpdateBlocklist.Status.UNBLOCKED); } else if (packet.hasChild("open", "http://jabber.org/protocol/ibb") || packet.hasChild("data", "http://jabber.org/protocol/ibb")) { mXmppConnectionService.getJingleConnectionManager() .deliverIbbPacket(account, packet); - } else if (packet.hasChild("query", "http://jabber.org/protocol/disco#info")) { - final IqPacket response = mXmppConnectionService.getIqGenerator().discoResponse(packet); - mXmppConnectionService.sendIqPacket(account, response, null); - } else if (packet.hasChild("query", IqVersionPacket.NAMESPACE)) { - XmppSendUtil.sendIqPacket(account, IqVersionPacketGenerator.generateResponse(packet), null); - } else if (packet.hasChild("ping", "urn:xmpp:ping")) { - final IqPacket response = packet.generateResponse(IqPacket.TYPE.RESULT); - mXmppConnectionService.sendIqPacket(account, response, null); - } else if (packet.hasChild("time", TimePacket.NAMESPACE)) { - XmppSendUtil.sendIqPacket(account, TimePacketGenerator.generateResponse(packet), null); } else { if (packet.getType() == IqPacket.TYPE.GET || packet.getType() == IqPacket.TYPE.SET) { final IqPacket response = packet.generateResponse(IqPacket.TYPE.ERROR); |