aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/parser/MessageParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs/conversations/parser/MessageParser.java')
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index 5c04b09c..0a812669 100644
--- a/src/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/eu/siacs/conversations/parser/MessageParser.java
@@ -1,6 +1,7 @@
package eu.siacs.conversations.parser;
import android.os.SystemClock;
+import android.util.Log;
import net.java.otr4j.session.Session;
import net.java.otr4j.session.SessionStatus;
import eu.siacs.conversations.entities.Account;
@@ -213,6 +214,10 @@ public class MessageParser extends AbstractParser implements
}
private void parseNormal(Element packet, Account account) {
+ if (packet.hasChild("event","http://jabber.org/protocol/pubsub#event")) {
+ Element event = packet.findChild("event","http://jabber.org/protocol/pubsub#event");
+ parseEvent(event,packet.getAttribute("from"),account);
+ }
if (packet.hasChild("displayed", "urn:xmpp:chat-markers:0")) {
String id = packet
.findChild("displayed", "urn:xmpp:chat-markers:0")
@@ -254,6 +259,16 @@ public class MessageParser extends AbstractParser implements
}
}
+ private void parseEvent(Element event, String from, Account account) {
+ Element items = event.findChild("items");
+ String node = items.getAttribute("node");
+ if (node!=null) {
+ Log.d("xmppService",account.getJid()+": "+node+" from "+from);
+ } else {
+ Log.d("xmppService",event.toString());
+ }
+ }
+
private String getPgpBody(Element message) {
Element child = message.findChild("x", "jabber:x:encrypted");
if (child == null) {
@@ -324,6 +339,9 @@ public class MessageParser extends AbstractParser implements
} else if (packet.getType() == MessagePacket.TYPE_NORMAL) {
this.parseNormal(packet, account);
return;
+ } else if (packet.getType() == MessagePacket.TYPE_HEADLINE) {
+ this.parseHeadline(packet, account);
+ return;
}
if ((message == null) || (message.getBody() == null)) {
return;
@@ -346,4 +364,11 @@ public class MessageParser extends AbstractParser implements
}
mXmppConnectionService.notifyUi(conversation, notify);
}
+
+ private void parseHeadline(MessagePacket packet, Account account) {
+ if (packet.hasChild("event","http://jabber.org/protocol/pubsub#event")) {
+ Element event = packet.findChild("event","http://jabber.org/protocol/pubsub#event");
+ parseEvent(event,packet.getFrom(),account);
+ }
+ }
}