aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/parser')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/parser/IqParser.java21
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java8
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java5
3 files changed, 11 insertions, 23 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 {
@@ -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);
diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java b/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java
index 52d35f58..4cc6f8b2 100644
--- a/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java
+++ b/src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java
@@ -17,6 +17,8 @@ import de.thedevstack.conversationsplus.xmpp.avatar.AvatarPacketParser;
import de.thedevstack.conversationsplus.xmpp.carbons.Carbons;
import de.thedevstack.conversationsplus.xmpp.httpuploadim.HttpUploadHint;
import de.thedevstack.conversationsplus.xmpp.mam.Mam;
+import de.thedevstack.conversationsplus.xmpp.openpgp.OpenPgpXep;
+import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacketReceiver;
import de.tzur.conversations.Settings;
import net.java.otr4j.session.Session;
@@ -40,7 +42,7 @@ import de.thedevstack.conversationsplus.entities.Conversation;
import de.thedevstack.conversationsplus.entities.Message;
import de.thedevstack.conversationsplus.entities.MucOptions;
import de.thedevstack.conversationsplus.services.avatar.AvatarService;
-import de.thedevstack.conversationsplus.services.MessageArchiveService;
+import de.thedevstack.conversationsplus.services.mam.MessageArchiveService;
import de.thedevstack.conversationsplus.services.XmppConnectionService;
import de.thedevstack.conversationsplus.utils.CryptoHelper;
import de.thedevstack.conversationsplus.xml.Element;
@@ -231,7 +233,7 @@ public class MessageParser extends AbstractParser implements
} else if (ConversationsPlusPreferences.omemoEnabled() && AxolotlService.PEP_DEVICE_LIST.equals(node)) {
Log.d(Config.LOGTAG, AxolotlServiceImpl.getLogprefix(account)+"Received PEP device list update from "+ from + ", processing...");
Element item = items.findChild("item");
- Set<Integer> deviceIds = mXmppConnectionService.getIqParser().deviceIds(item);
+ Set<Integer> deviceIds = IqPacketReceiver.getInstance().getLegacyIqParser().deviceIds(item);
AxolotlService axolotlService = account.getAxolotlService();
axolotlService.registerDevices(from, deviceIds);
UiUpdateHelper.updateAccountUi();
@@ -313,7 +315,7 @@ public class MessageParser extends AbstractParser implements
}
final String body = packet.getBody();
final Element mucUserElement = packet.findChild("x", "http://jabber.org/protocol/muc#user");
- final String pgpEncrypted = packet.findChildContent("x", "jabber:x:encrypted");
+ final String pgpEncrypted = packet.findChildContent(OpenPgpXep.ENCRYPTED_ELEMENT, OpenPgpXep.ENCRYPTED_NAMESPACE);
final Element oob = packet.findChild("x", "jabber:x:oob");
final boolean isOob = oob!= null && body != null && body.equals(oob.findChildContent("url"));
final Element axolotlEncrypted = packet.findChild(XmppAxolotlMessage.CONTAINERTAG, AxolotlService.PEP_PREFIX);
diff --git a/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java b/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
index 5270eefe..ed366a2c 100644
--- a/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
+++ b/src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
@@ -28,6 +28,7 @@ import de.thedevstack.conversationsplus.xmpp.OnPresencePacketReceived;
import de.thedevstack.conversationsplus.xmpp.avatar.AvatarVcardParser;
import de.thedevstack.conversationsplus.xmpp.jid.Jid;
import de.thedevstack.conversationsplus.dto.Avatar;
+import de.thedevstack.conversationsplus.xmpp.openpgp.OpenPgpXep;
import de.thedevstack.conversationsplus.xmpp.stanzas.PresencePacket;
public class PresenceParser extends AbstractParser implements
@@ -91,7 +92,7 @@ public class PresenceParser extends AbstractParser implements
mucOptions.addUser(user);
}
if (mXmppConnectionService.getPgpEngine() != null) {
- Element signed = packet.findChild("x", "jabber:x:signed");
+ Element signed = packet.findChild(OpenPgpXep.SIGNED_ELEMENT, OpenPgpXep.SIGNED_NAMESPACE);
if (signed != null) {
Element status = packet.findChild("status");
String msg = status == null ? "" : status.getContent();
@@ -213,7 +214,7 @@ public class PresenceParser extends AbstractParser implements
}
PgpEngine pgp = mXmppConnectionService.getPgpEngine();
- Element x = packet.findChild("x", "jabber:x:signed");
+ Element x = packet.findChild(OpenPgpXep.SIGNED_ELEMENT, OpenPgpXep.SIGNED_NAMESPACE);
if (pgp != null && x != null) {
Element status = packet.findChild("status");
String msg = status != null ? status.getContent() : "";