Java Code Examples for org.whispersystems.signalservice.api.messages.SignalServiceEnvelope#isUnidentifiedSender()
The following examples show how to use
org.whispersystems.signalservice.api.messages.SignalServiceEnvelope#isUnidentifiedSender() .
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: IncomingMessageProcessor.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
/** * @return The id of the {@link PushDecryptMessageJob} that was scheduled to process the message, if * one was created. Otherwise null. */ public @Nullable String processEnvelope(@NonNull SignalServiceEnvelope envelope) { if (envelope.hasSource()) { Recipient.externalPush(context, envelope.getSourceAddress()); } if (envelope.isReceipt()) { processReceipt(envelope); return null; } else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage() || envelope.isUnidentifiedSender()) { return processMessage(envelope); } else { Log.w(TAG, "Received envelope of unknown type: " + envelope.getType()); return null; } }
Example 2
Source File: Manager.java From signal-cli with GNU General Public License v3.0 | 6 votes |
private boolean isMessageBlocked(SignalServiceEnvelope envelope, SignalServiceContent content) { SignalServiceAddress source; if (!envelope.isUnidentifiedSender() && envelope.hasSource()) { source = envelope.getSourceAddress(); } else if (content != null) { source = content.getSender(); } else { return false; } ContactInfo sourceContact = account.getContactStore().getContact(source); if (sourceContact != null && sourceContact.blocked) { return true; } if (content != null && content.getDataMessage().isPresent()) { SignalServiceDataMessage message = content.getDataMessage().get(); if (message.getGroupContext().isPresent() && message.getGroupContext().get().getGroupV1().isPresent()) { SignalServiceGroup groupInfo = message.getGroupContext().get().getGroupV1().get(); GroupInfo group = getGroup(groupInfo.getGroupId()); if (groupInfo.getType() == SignalServiceGroup.Type.DELIVER && group != null && group.blocked) { return true; } } } return false; }
Example 3
Source File: JsonMessageEnvelope.java From signal-cli with GNU General Public License v3.0 | 5 votes |
public JsonMessageEnvelope(SignalServiceEnvelope envelope, SignalServiceContent content) { if (!envelope.isUnidentifiedSender() && envelope.hasSource()) { SignalServiceAddress source = envelope.getSourceAddress(); this.source = source.getNumber().get(); this.relay = source.getRelay().isPresent() ? source.getRelay().get() : null; } this.sourceDevice = envelope.getSourceDevice(); this.timestamp = envelope.getTimestamp(); this.isReceipt = envelope.isReceipt(); if (content != null) { if (envelope.isUnidentifiedSender()) { this.source = content.getSender().getNumber().get(); this.sourceDevice = content.getSenderDevice(); } if (content.getDataMessage().isPresent()) { this.dataMessage = new JsonDataMessage(content.getDataMessage().get()); } if (content.getSyncMessage().isPresent()) { this.syncMessage = new JsonSyncMessage(content.getSyncMessage().get()); } if (content.getCallMessage().isPresent()) { this.callMessage = new JsonCallMessage(content.getCallMessage().get()); } if (content.getReceiptMessage().isPresent()) { this.receiptMessage = new JsonReceiptMessage(content.getReceiptMessage().get()); } } }
Example 4
Source File: JsonMessageEnvelope.java From signald with GNU General Public License v3.0 | 4 votes |
public JsonMessageEnvelope(SignalServiceEnvelope envelope, SignalServiceContent c, String username) throws IOException, NoSuchAccountException { SignalServiceAddress sourceAddress = envelope.getSourceAddress(); this.username = username; if (envelope.hasUuid()) { uuid = envelope.getUuid(); } if (envelope.hasSource()) { source = sourceAddress.getNumber(); } else if(c != null) { source = c.getSender(); } if (envelope.hasSourceDevice()) { sourceDevice = envelope.getSourceDevice(); } type = envelope.getType(); if (sourceAddress.getRelay().isPresent()) { relay = sourceAddress.getRelay().get(); } timestamp = envelope.getTimestamp(); timestampISO = formatTimestampISO(envelope.getTimestamp()); serverTimestamp = envelope.getServerTimestamp(); hasLegacyMessage = envelope.hasLegacyMessage(); hasContent = envelope.hasContent(); isReceipt = envelope.isReceipt(); if (c != null) { if (c.getDataMessage().isPresent()) { this.dataMessage = new JsonDataMessage(c.getDataMessage().get(), username); } if (c.getSyncMessage().isPresent()) { this.syncMessage = new JsonSyncMessage(c.getSyncMessage().get(), username); } if (c.getCallMessage().isPresent()) { this.callMessage = new JsonCallMessage(c.getCallMessage().get()); } if (c.getReceiptMessage().isPresent()) { this.receipt = new JsonReceiptMessage(c.getReceiptMessage().get()); } if (c.getTypingMessage().isPresent()) { this.typing = new JsonTypingMessage(c.getTypingMessage().get()); } } isUnidentifiedSender = envelope.isUnidentifiedSender(); }