예제 #1
0
  private Pair<Long, Recipients> handleCreatePushGroup(
      String groupName, byte[] avatar, Set<Recipient> members)
      throws InvalidNumberException, MmsException {
    GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(this);
    byte[] groupId = groupDatabase.allocateGroupId();
    Set<String> memberE164Numbers = getE164Numbers(members);

    memberE164Numbers.add(TextSecurePreferences.getLocalNumber(this));

    groupDatabase.create(groupId, groupName, new LinkedList<String>(memberE164Numbers), null, null);
    groupDatabase.updateAvatar(groupId, avatar);

    return handlePushOperation(groupId, groupName, avatar, memberE164Numbers);
  }
예제 #2
0
  private Pair<Long, Recipients> handleUpdatePushGroup(
      byte[] groupId, String groupName, byte[] avatar, Set<Recipient> members)
      throws InvalidNumberException, MmsException {
    GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(this);
    Set<String> memberE164Numbers = getE164Numbers(members);
    memberE164Numbers.add(TextSecurePreferences.getLocalNumber(this));

    for (String number : memberE164Numbers) Log.w(TAG, "Updating: " + number);

    groupDatabase.updateMembers(groupId, new LinkedList<String>(memberE164Numbers));
    groupDatabase.updateTitle(groupId, groupName);
    groupDatabase.updateAvatar(groupId, avatar);

    return handlePushOperation(groupId, groupName, avatar, memberE164Numbers);
  }