From abce678cb408656cf21a083a097666a6c87c4c9d Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Mon, 17 Feb 2014 22:20:43 -0800 Subject: [PATCH] received group messages aren't processed as "meta" group stuff, oops. --- src/org/thoughtcrime/securesms/ConversationAdapter.java | 4 +++- src/org/thoughtcrime/securesms/ConversationItem.java | 2 +- src/org/thoughtcrime/securesms/util/GroupUtil.java | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationAdapter.java b/src/org/thoughtcrime/securesms/ConversationAdapter.java index 8a37dfc8c3..4320adc495 100644 --- a/src/org/thoughtcrime/securesms/ConversationAdapter.java +++ b/src/org/thoughtcrime/securesms/ConversationAdapter.java @@ -25,6 +25,7 @@ import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.CursorAdapter; +import org.thoughtcrime.securesms.util.GroupUtil; import org.whispersystems.textsecure.crypto.MasterSecret; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.MmsSmsColumns; @@ -32,6 +33,7 @@ import org.thoughtcrime.securesms.database.MmsSmsDatabase; import org.thoughtcrime.securesms.database.SmsDatabase; import org.thoughtcrime.securesms.database.model.MessageRecord; import org.thoughtcrime.securesms.util.LRUCache; +import org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext; import java.lang.ref.SoftReference; import java.util.Collections; @@ -121,7 +123,7 @@ public class ConversationAdapter extends CursorAdapter implements AbsListView.Re long id = cursor.getLong(cursor.getColumnIndexOrThrow(MmsSmsColumns.ID)); String type = cursor.getString(cursor.getColumnIndexOrThrow(MmsSmsDatabase.TRANSPORT)); MessageRecord messageRecord = getMessageRecord(id, cursor, type); - if (messageRecord.getGroupAction() > 0) return MESSAGE_TYPE_GROUP_ACTION; + if (GroupUtil.isMetaGroupAction(messageRecord.getGroupAction())) return MESSAGE_TYPE_GROUP_ACTION; if (messageRecord.isOutgoing()) return MESSAGE_TYPE_OUTGOING; else return MESSAGE_TYPE_INCOMING; } diff --git a/src/org/thoughtcrime/securesms/ConversationItem.java b/src/org/thoughtcrime/securesms/ConversationItem.java index efbf85d3ed..7ed21c4e27 100644 --- a/src/org/thoughtcrime/securesms/ConversationItem.java +++ b/src/org/thoughtcrime/securesms/ConversationItem.java @@ -148,7 +148,7 @@ public class ConversationItem extends LinearLayout { setBodyText(messageRecord); - if (messageRecord.getGroupAction() < 1) { + if (!GroupUtil.isMetaGroupAction(messageRecord.getGroupAction())) { setStatusIcons(messageRecord); setContactPhoto(messageRecord); setGroupMessageStatus(messageRecord); diff --git a/src/org/thoughtcrime/securesms/util/GroupUtil.java b/src/org/thoughtcrime/securesms/util/GroupUtil.java index 372cdd9aa3..2258483b20 100644 --- a/src/org/thoughtcrime/securesms/util/GroupUtil.java +++ b/src/org/thoughtcrime/securesms/util/GroupUtil.java @@ -33,6 +33,11 @@ public class GroupUtil { return groupId.startsWith(ENCODED_GROUP_PREFIX); } + public static boolean isMetaGroupAction(int groupAction) { + return groupAction > 0 + && groupAction != GroupContext.Type.DELIVER_VALUE; + } + public static String serializeArguments(byte[] id, String name, List members) { return Base64.encodeBytes(GroupContext.newBuilder() .setId(ByteString.copyFrom(id))