aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/utils
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-28 00:22:56 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-02-28 00:22:56 +0100
commit37d1a5380634471b11c828cf265d4a39e818a1c1 (patch)
treebbd6d58171beb79369c9c452098286591e6a6eae /src/de/gultsch/chat/utils
parentbfee69b00b2762a910f7f3f1714d18fddc99a9ad (diff)
basic pgp support.
Diffstat (limited to '')
-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;
+ }
}