+ SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder()
+ .asEndSessionMessage();
+
+ sendMessageLegacy(messageBuilder, recipients);
+ }
+
+ @Override
+ public String getContactName(String number) {
+ ContactInfo contact = contactStore.getContact(number);
+ if (contact == null) {
+ return "";
+ } else {
+ return contact.name;
+ }
+ }
+
+ @Override
+ public void setContactName(String number, String name) {
+ ContactInfo contact = contactStore.getContact(number);
+ if (contact == null) {
+ contact = new ContactInfo();
+ contact.number = number;
+ System.err.println("Add contact " + number + " named " + name);
+ } else {
+ System.err.println("Updating contact " + number + " name " + contact.name + " -> " + name);
+ }
+ contact.name = name;
+ contactStore.updateContact(contact);
+ save();
+ }
+
+ @Override
+ public List<byte[]> getGroupIds() {
+ List<GroupInfo> groups = getGroups();
+ List<byte[]> ids = new ArrayList<byte[]>(groups.size());
+ for (GroupInfo group : groups) {
+ ids.add(group.groupId);
+ }
+ return ids;
+ }
+
+ @Override
+ public String getGroupName(byte[] groupId) {
+ GroupInfo group = getGroup(groupId);
+ if (group == null) {
+ return "";
+ } else {
+ return group.name;
+ }
+ }
+
+ @Override
+ public List<String> getGroupMembers(byte[] groupId) {
+ GroupInfo group = getGroup(groupId);
+ if (group == null) {
+ return new ArrayList<String>();
+ } else {
+ return new ArrayList<String>(group.members);
+ }
+ }