From 023d776e961045b1822f10d475725b93b3e6066d Mon Sep 17 00:00:00 2001 From: McLoo Date: Fri, 11 Apr 2014 14:33:55 +0200 Subject: [PATCH] Reactivate a group if a contact gets readded Fixes #723 //FREEBIE Removes the own number from group on leaving, to receive a proper re-added message --- src/org/thoughtcrime/securesms/ConversationActivity.java | 1 + src/org/thoughtcrime/securesms/service/GroupReceiver.java | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index a154fc3c38..c67a62f6d5 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -445,6 +445,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi OutgoingGroupMediaMessage outgoingMessage = new OutgoingGroupMediaMessage(self, getRecipients(), context, null); MessageSender.send(self, masterSecret, outgoingMessage, threadId); + DatabaseFactory.getGroupDatabase(self).remove(groupId, TextSecurePreferences.getLocalNumber(self)); initializeEnabledCheck(); } catch (IOException e) { Log.w(TAG, e); diff --git a/src/org/thoughtcrime/securesms/service/GroupReceiver.java b/src/org/thoughtcrime/securesms/service/GroupReceiver.java index cf5b703162..12cd741861 100644 --- a/src/org/thoughtcrime/securesms/service/GroupReceiver.java +++ b/src/org/thoughtcrime/securesms/service/GroupReceiver.java @@ -26,6 +26,7 @@ import static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageCo public class GroupReceiver { + private static final String TAG = GroupReceiver.class.getSimpleName();; private final Context context; public GroupReceiver(Context context) { @@ -38,12 +39,12 @@ public class GroupReceiver { boolean secure) { if (!messageContent.getGroup().hasId()) { - Log.w("GroupReceiver", "Received group message with no id! Ignoring..."); + Log.w(TAG, "Received group message with no id! Ignoring..."); return; } if (!secure) { - Log.w("GroupReceiver", "Received insecure group push action! Ignoring..."); + Log.w(TAG, "Received insecure group push action! Ignoring..."); return; } @@ -60,7 +61,7 @@ public class GroupReceiver { } else if (record != null && type == GroupContext.Type.QUIT_VALUE) { handleGroupLeave(masterSecret, message, group, record); } else if (type == GroupContext.Type.UNKNOWN_VALUE) { - Log.w("GroupReceiver", "Received unknown type, ignoring..."); + Log.w(TAG, "Received unknown type, ignoring..."); } } @@ -117,6 +118,7 @@ public class GroupReceiver { group = group.toBuilder().clearName().build(); } + if (!groupRecord.isActive()) database.setActive(id, true); storeMessage(masterSecret, message, group); }