+ private static byte[] getGroupId(final Manager m, final SignalServiceDataMessage message) {
+ byte[] groupId;
+ if (message.getGroupContext().isPresent()) {
+ if (message.getGroupContext().get().getGroupV1().isPresent()) {
+ groupId = message.getGroupContext().get().getGroupV1().get().getGroupId();
+ } else if (message.getGroupContext().get().getGroupV2().isPresent()) {
+ groupId = m.getGroupId(message.getGroupContext().get().getGroupV2().get().getMasterKey());
+ } else {
+ groupId = null;
+ }
+ } else {
+ groupId = null;
+ }
+ return groupId;
+ }
+