- ThreadInfo thread = account.getThreadStore().getThread(threadId);
- if (thread == null) {
- thread = new ThreadInfo();
- thread.id = threadId;
- }
- if (thread.messageExpirationTime != message.getExpiresInSeconds()) {
- thread.messageExpirationTime = message.getExpiresInSeconds();
- account.getThreadStore().updateThread(thread);
+ if (message.getGroupInfo().isPresent()) {
+ SignalServiceGroup groupInfo = message.getGroupInfo().get();
+ GroupInfo group = account.getGroupStore().getGroup(groupInfo.getGroupId());
+ if (group == null) {
+ group = new GroupInfo(groupInfo.getGroupId());
+ }
+ if (group.messageExpirationTime != message.getExpiresInSeconds()) {
+ group.messageExpirationTime = message.getExpiresInSeconds();
+ account.getGroupStore().updateGroup(group);
+ }
+ } else {
+ ContactInfo contact = account.getContactStore().getContact(isSync ? destination : source);
+ if (contact == null) {
+ contact = new ContactInfo(isSync ? destination : source);
+ }
+ if (contact.messageExpirationTime != message.getExpiresInSeconds()) {
+ contact.messageExpirationTime = message.getExpiresInSeconds();
+ account.getContactStore().updateContact(contact);
+ }