support for purge and delete
This commit is contained in:
parent
95bf66ca7d
commit
f26e0720c6
|
@ -258,13 +258,22 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
|
|
||||||
private void parseDeleteEvent(final Element event, final Jid from, final Account account) {
|
private void parseDeleteEvent(final Element event, final Jid from, final Account account) {
|
||||||
final Element delete = event.findChild("delete");
|
final Element delete = event.findChild("delete");
|
||||||
if (delete == null) {
|
final String node = delete == null ? null : delete.getAttribute("node");
|
||||||
return;
|
|
||||||
}
|
|
||||||
String node = delete.getAttribute("node");
|
|
||||||
if (Namespace.NICK.equals(node)) {
|
if (Namespace.NICK.equals(node)) {
|
||||||
Log.d(Config.LOGTAG, "parsing nick delete event from " + from);
|
Log.d(Config.LOGTAG, "parsing nick delete event from " + from);
|
||||||
setNick(account, from, null);
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,6 +868,8 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
parseEvent(event, original.getFrom(), account);
|
parseEvent(event, original.getFrom(), account);
|
||||||
} else if (event.hasChild("delete")) {
|
} else if (event.hasChild("delete")) {
|
||||||
parseDeleteEvent(event, original.getFrom(), account);
|
parseDeleteEvent(event, original.getFrom(), account);
|
||||||
|
} else if (event.hasChild("purge")) {
|
||||||
|
parsePurgeEvent(event, original.getFrom(), account);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1880,7 +1880,7 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean bookmarks2() {
|
public boolean bookmarks2() {
|
||||||
return true; //hasDiscoFeature(account.getJid().asBareJid(), Namespace.BOOKMARK);
|
return hasDiscoFeature(account.getJid().asBareJid(), Namespace.BOOKMARK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue