aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-10-26 18:10:56 +0200
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-10-26 18:10:56 +0200
commit9f45e2509e8e71a4b31bdb14f3cb60fb7e2d0b75 (patch)
treed2ef9c3d0cbd5435a90ee016130c6e3f4ce578dc /src/main/java/de/pixart/messenger
parent35df965b58a9505f27be34c3a68309211c2e6d88 (diff)
support for purge and delete
Diffstat (limited to 'src/main/java/de/pixart/messenger')
-rw-r--r--src/main/java/de/pixart/messenger/parser/MessageParser.java19
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java2
2 files changed, 16 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/parser/MessageParser.java b/src/main/java/de/pixart/messenger/parser/MessageParser.java
index 8e96d9b6f..b3e6bc396 100644
--- a/src/main/java/de/pixart/messenger/parser/MessageParser.java
+++ b/src/main/java/de/pixart/messenger/parser/MessageParser.java
@@ -350,13 +350,22 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
private void parseDeleteEvent(final Element event, final Jid from, final Account account) {
final Element delete = event.findChild("delete");
- if (delete == null) {
- return;
- }
- String node = delete.getAttribute("node");
+ final String node = delete == null ? null : delete.getAttribute("node");
if (Namespace.NICK.equals(node)) {
Log.d(Config.LOGTAG, "parsing nick delete event from " + from);
setNick(account, from, null);
+ } else if (Namespace.BOOKMARK.equals(node) && account.getJid().asBareJid().equals(from)) {
+ account.setBookmarks(Collections.emptyMap());
+ Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": deleted bookmarks node");
+ }
+ }
+
+ private void parsePurgeEvent(final Element event, final Jid from, final Account account) {
+ final Element purge = event.findChild("purge");
+ final String node = purge == null ? null : purge.getAttribute("node");
+ if (Namespace.BOOKMARK.equals(node) && account.getJid().asBareJid().equals(from)) {
+ account.setBookmarks(Collections.emptyMap());
+ Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": purged bookmarks");
}
}
@@ -974,6 +983,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
parseEvent(event, original.getFrom(), account);
} else if (event.hasChild("delete")) {
parseDeleteEvent(event, original.getFrom(), account);
+ } else if (event.hasChild("purge")) {
+ parsePurgeEvent(event, original.getFrom(), account);
}
}
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 889819048..32a1fe377 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -2001,7 +2001,7 @@ public class XmppConnection implements Runnable {
}
public boolean bookmarks2() {
- return true; //hasDiscoFeature(account.getJid().asBareJid(), Namespace.BOOKMARK);
+ return hasDiscoFeature(account.getJid().asBareJid(), Namespace.BOOKMARK);
}
}
} \ No newline at end of file