received group messages aren't processed as "meta" group stuff, oops.

This commit is contained in:
Jake McGinty 2014-02-17 22:20:43 -08:00
parent fb75d90edc
commit abce678cb4
3 changed files with 9 additions and 2 deletions

View File

@ -25,6 +25,7 @@ import android.view.ViewGroup;
import android.widget.AbsListView; import android.widget.AbsListView;
import android.widget.CursorAdapter; import android.widget.CursorAdapter;
import org.thoughtcrime.securesms.util.GroupUtil;
import org.whispersystems.textsecure.crypto.MasterSecret; import org.whispersystems.textsecure.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.MmsSmsColumns; 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.SmsDatabase;
import org.thoughtcrime.securesms.database.model.MessageRecord; import org.thoughtcrime.securesms.database.model.MessageRecord;
import org.thoughtcrime.securesms.util.LRUCache; import org.thoughtcrime.securesms.util.LRUCache;
import org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext;
import java.lang.ref.SoftReference; import java.lang.ref.SoftReference;
import java.util.Collections; import java.util.Collections;
@ -121,7 +123,7 @@ public class ConversationAdapter extends CursorAdapter implements AbsListView.Re
long id = cursor.getLong(cursor.getColumnIndexOrThrow(MmsSmsColumns.ID)); long id = cursor.getLong(cursor.getColumnIndexOrThrow(MmsSmsColumns.ID));
String type = cursor.getString(cursor.getColumnIndexOrThrow(MmsSmsDatabase.TRANSPORT)); String type = cursor.getString(cursor.getColumnIndexOrThrow(MmsSmsDatabase.TRANSPORT));
MessageRecord messageRecord = getMessageRecord(id, cursor, type); 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; if (messageRecord.isOutgoing()) return MESSAGE_TYPE_OUTGOING;
else return MESSAGE_TYPE_INCOMING; else return MESSAGE_TYPE_INCOMING;
} }

View File

@ -148,7 +148,7 @@ public class ConversationItem extends LinearLayout {
setBodyText(messageRecord); setBodyText(messageRecord);
if (messageRecord.getGroupAction() < 1) { if (!GroupUtil.isMetaGroupAction(messageRecord.getGroupAction())) {
setStatusIcons(messageRecord); setStatusIcons(messageRecord);
setContactPhoto(messageRecord); setContactPhoto(messageRecord);
setGroupMessageStatus(messageRecord); setGroupMessageStatus(messageRecord);

View File

@ -33,6 +33,11 @@ public class GroupUtil {
return groupId.startsWith(ENCODED_GROUP_PREFIX); 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<String> members) { public static String serializeArguments(byte[] id, String name, List<String> members) {
return Base64.encodeBytes(GroupContext.newBuilder() return Base64.encodeBytes(GroupContext.newBuilder()
.setId(ByteString.copyFrom(id)) .setId(ByteString.copyFrom(id))