Refactor group messaging protocol.

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2014-02-21 17:51:25 -08:00
parent b855f8a163
commit a6e1d56cde
18 changed files with 314 additions and 254 deletions

View File

@@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.sms;
import com.google.protobuf.ByteString;
import org.thoughtcrime.securesms.util.GroupUtil;
import org.whispersystems.textsecure.push.PushMessageProtos;
import java.io.IOException;
@@ -28,20 +27,14 @@ public class IncomingGroupMessage extends IncomingTextMessage {
return true;
}
public boolean isAdd() {
return
groupContext.getType().getNumber() == GroupContext.Type.ADD_VALUE ||
groupContext.getType().getNumber() == GroupContext.Type.CREATE_VALUE;
public boolean isUpdate() {
return groupContext.getType().getNumber() == GroupContext.Type.UPDATE_VALUE;
}
public boolean isQuit() {
return groupContext.getType().getNumber() == GroupContext.Type.QUIT_VALUE;
}
public boolean isModify() {
return groupContext.getType().getNumber() == GroupContext.Type.MODIFY_VALUE;
}
public static IncomingGroupMessage createForQuit(String groupId, String user) throws IOException {
IncomingTextMessage base = new IncomingTextMessage(user, groupId);
GroupContext context = GroupContext.newBuilder()