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
This commit is contained in:
McLoo 2014-04-11 14:33:55 +02:00 committed by Moxie Marlinspike
parent ce7b8ab75a
commit 023d776e96
2 changed files with 6 additions and 3 deletions

View File

@ -445,6 +445,7 @@ public class ConversationActivity extends PassphraseRequiredSherlockFragmentActi
OutgoingGroupMediaMessage outgoingMessage = new OutgoingGroupMediaMessage(self, getRecipients(), OutgoingGroupMediaMessage outgoingMessage = new OutgoingGroupMediaMessage(self, getRecipients(),
context, null); context, null);
MessageSender.send(self, masterSecret, outgoingMessage, threadId); MessageSender.send(self, masterSecret, outgoingMessage, threadId);
DatabaseFactory.getGroupDatabase(self).remove(groupId, TextSecurePreferences.getLocalNumber(self));
initializeEnabledCheck(); initializeEnabledCheck();
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG, e); Log.w(TAG, e);

View File

@ -26,6 +26,7 @@ import static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageCo
public class GroupReceiver { public class GroupReceiver {
private static final String TAG = GroupReceiver.class.getSimpleName();;
private final Context context; private final Context context;
public GroupReceiver(Context context) { public GroupReceiver(Context context) {
@ -38,12 +39,12 @@ public class GroupReceiver {
boolean secure) boolean secure)
{ {
if (!messageContent.getGroup().hasId()) { 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; return;
} }
if (!secure) { if (!secure) {
Log.w("GroupReceiver", "Received insecure group push action! Ignoring..."); Log.w(TAG, "Received insecure group push action! Ignoring...");
return; return;
} }
@ -60,7 +61,7 @@ public class GroupReceiver {
} else if (record != null && type == GroupContext.Type.QUIT_VALUE) { } else if (record != null && type == GroupContext.Type.QUIT_VALUE) {
handleGroupLeave(masterSecret, message, group, record); handleGroupLeave(masterSecret, message, group, record);
} else if (type == GroupContext.Type.UNKNOWN_VALUE) { } 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(); group = group.toBuilder().clearName().build();
} }
if (!groupRecord.isActive()) database.setActive(id, true);
storeMessage(masterSecret, message, group); storeMessage(masterSecret, message, group);
} }