diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-07-15 14:32:19 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-07-15 14:32:19 +0200 |
commit | 2ebd92b7a7b97c7ecca43eb1e3c7d408508aadb2 (patch) | |
tree | 1da6fc297af9d9fa655a0dbce407fa5ec1f878d4 /src/eu/siacs/conversations/services/XmppConnectionService.java | |
parent | 6031af86062757f86701e08962aa86121877fbf4 (diff) |
pushing bookmarks back to server
Diffstat (limited to 'src/eu/siacs/conversations/services/XmppConnectionService.java')
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index aa62b8a1a..c43a34b78 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -702,6 +702,16 @@ public class XmppConnectionService extends Service { sendIqPacket(account, iqPacket, callback); } + + public void pushBookmarks(Account account) { + IqPacket iqPacket = new IqPacket(IqPacket.TYPE_SET); + Element query = iqPacket.query("jabber:iq:private"); + Element storage = query.addChild("storage", "storage:bookmarks"); + for(Bookmark bookmark : account.getBookmarks()) { + storage.addChild(bookmark.toElement()); + } + sendIqPacket(account, iqPacket,null); + } private void mergePhoneContactsWithRoster() { PhoneHelper.loadPhoneContacts(getApplicationContext(), @@ -840,6 +850,11 @@ public class XmppConnectionService extends Service { public void archiveConversation(Conversation conversation) { if (conversation.getMode() == Conversation.MODE_MULTI) { + Bookmark bookmark = conversation.getBookmark(); + if (bookmark!=null && bookmark.autojoin()) { + bookmark.setAutojoin(false); + pushBookmarks(bookmark.getAccount()); + } leaveMuc(conversation); } else { conversation.endOtrIfNeeded(); @@ -1005,10 +1020,10 @@ public class XmppConnectionService extends Service { + "/" + conversation.getMucOptions().getNick()); packet.setAttribute("from", conversation.getAccount().getFullJid()); packet.setAttribute("type", "unavailable"); - Log.d(LOGTAG, "send leaving muc " + packet); sendPresencePacket(conversation.getAccount(),packet); conversation.getMucOptions().setOffline(); conversation.deregisterWithBookmark(); + Log.d(LOGTAG,conversation.getAccount().getJid()+" leaving muc "+conversation.getContactJid()); } public void disconnect(Account account, boolean force) { |