aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/gultsch/chat/utils')
-rw-r--r--src/de/gultsch/chat/utils/MessageParser.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/de/gultsch/chat/utils/MessageParser.java b/src/de/gultsch/chat/utils/MessageParser.java
index 1dca7343..a12ef58c 100644
--- a/src/de/gultsch/chat/utils/MessageParser.java
+++ b/src/de/gultsch/chat/utils/MessageParser.java
@@ -23,6 +23,12 @@ public class MessageParser {
return new Message(conversation, packet.getFrom(), body, Message.ENCRYPTION_NONE, Message.STATUS_RECIEVED);
}
+ public static Message parsePgpChat(String pgpBody, MessagePacket packet, Account account, XmppConnectionService service) {
+ String[] fromParts = packet.getFrom().split("/");
+ Conversation conversation = service.findOrCreateConversation(account, fromParts[0],false);
+ return new Message(conversation, packet.getFrom(), pgpBody, Message.ENCRYPTION_PGP, Message.STATUS_RECIEVED);
+ }
+
public static Message parseOtrChat(MessagePacket packet, Account account, XmppConnectionService service) {
String[] fromParts = packet.getFrom().split("/");
Conversation conversation = service.findOrCreateConversation(account, fromParts[0],false);
@@ -131,4 +137,13 @@ public class MessageParser {
}
return new Message(conversation, packet.getFrom(), displayError, Message.ENCRYPTION_NONE, Message.STATUS_ERROR);
}
+
+ public static String getPgpBody(MessagePacket packet) {
+ for(Element child : packet.getChildren()) {
+ if (child.getName().equals("x")&&child.getAttribute("xmlns").equals("jabber:x:encrypted")) {
+ return child.getContent();
+ }
+ }
+ return null;
+ }
}