Display group actions and correctly handle group delivery.

This commit is contained in:
Moxie Marlinspike
2014-02-14 15:59:57 -08:00
parent 7c46f3cbf8
commit 067799be06
26 changed files with 304 additions and 160 deletions

View File

@@ -4,6 +4,8 @@ import org.whispersystems.textsecure.util.Hex;
import java.io.IOException;
import static org.whispersystems.textsecure.push.PushMessageProtos.PushMessageContent.GroupContext;
public class GroupUtil {
private static final String ENCODED_GROUP_PREFIX = "__textsecure_group__!";
@@ -24,4 +26,15 @@ public class GroupUtil {
return groupId.startsWith(ENCODED_GROUP_PREFIX);
}
public static String getActionArgument(GroupContext group) {
if (group.getType().equals(GroupContext.Type.CREATE) ||
group.getType().equals(GroupContext.Type.ADD))
{
return org.whispersystems.textsecure.util.Util.join(group.getMembersList(), ",");
} else if (group.getType().equals(GroupContext.Type.MODIFY)) {
return group.getName();
}
return null;
}
}