Java Code Examples for org.whispersystems.signalservice.api.messages.SignalServiceDataMessage#isExpirationUpdate()
The following examples show how to use
org.whispersystems.signalservice.api.messages.SignalServiceDataMessage#isExpirationUpdate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PushProcessMessageJob.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
private boolean shouldIgnore(@Nullable SignalServiceContent content) throws BadGroupIdException { if (content == null) { Log.w(TAG, "Got a message with null content."); return true; } Recipient sender = Recipient.externalPush(context, content.getSender()); if (content.getDataMessage().isPresent()) { SignalServiceDataMessage message = content.getDataMessage().get(); Recipient conversation = getMessageDestination(content, message); if (conversation.isGroup() && conversation.isBlocked()) { return true; } else if (conversation.isGroup()) { GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context); Optional<GroupId> groupId = GroupUtil.idFromGroupContext(message.getGroupContext()); if (groupId.isPresent() && groupDatabase.isUnknownGroup(groupId.get())) { return false; } boolean isTextMessage = message.getBody().isPresent(); boolean isMediaMessage = message.getAttachments().isPresent() || message.getQuote().isPresent() || message.getSharedContacts().isPresent(); boolean isExpireMessage = message.isExpirationUpdate(); boolean isGv2Message = message.isGroupV2Message(); boolean isGv2Update = message.isGroupV2Update(); boolean isContentMessage = !message.isGroupV1Update() && !isGv2Update && !isExpireMessage && (isTextMessage || isMediaMessage); boolean isGroupActive = groupId.isPresent() && groupDatabase.isActive(groupId.get()); boolean isLeaveMessage = message.getGroupContext().isPresent() && message.getGroupContext().get().getGroupV1Type() == SignalServiceGroup.Type.QUIT; if (isGv2Message && !FeatureFlags.groupsV2()) { Log.i(TAG, "Ignoring GV2 message by feature flag."); return true; } return (isContentMessage && !isGroupActive) || (sender.isBlocked() && !isLeaveMessage && !isGv2Update); } else { return sender.isBlocked(); } } else if (content.getCallMessage().isPresent() || content.getTypingMessage().isPresent()) { return sender.isBlocked(); } return false; }