From 2bd4621245dfcf1a64f68e1c3d1ae82e44cbe4b9 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Mon, 15 Dec 2014 17:14:27 +0100 Subject: [PATCH] fixed history deletion. fixed #780 --- .../conversations/services/XmppConnectionService.java | 10 ++++++++++ .../siacs/conversations/ui/ConversationActivity.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index b7ca699c2..ef93dcc79 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -2086,6 +2086,16 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa } } + public void clearConversationHistory(final Conversation conversation) { + conversation.clearMessages(); + new Thread(new Runnable() { + @Override + public void run() { + databaseBackend.deleteMessagesInConversation(conversation); + } + }).start(); + } + public interface OnConversationUpdate { public void onConversationUpdate(); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index a5efe12e0..6656de2b3 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -491,7 +491,7 @@ public class ConversationActivity extends XmppActivity implements @Override public void onClick(DialogInterface dialog, int which) { - conversation.clearMessages(); + ConversationActivity.this.xmppConnectionService.clearConversationHistory(conversation); if (endConversationCheckBox.isChecked()) { endConversation(conversation); } else {