Search in sources :

Example 1 with ExceptionMetadata

use of org.thoughtcrime.securesms.messages.MessageContentProcessor.ExceptionMetadata in project Signal-Android by WhisperSystems.

the class MessageDecryptionUtil method toExceptionMetadata.

private static ExceptionMetadata toExceptionMetadata(@NonNull UnsupportedDataMessageException e) throws NoSenderException {
    String sender = e.getSender();
    if (sender == null)
        throw new NoSenderException();
    GroupId groupId = null;
    if (e.getGroup().isPresent()) {
        try {
            groupId = GroupUtil.idFromGroupContext(e.getGroup().get());
        } catch (BadGroupIdException ex) {
            Log.w(TAG, "Bad group id found in unsupported data message", ex);
        }
    }
    return new ExceptionMetadata(sender, e.getSenderDevice(), groupId);
}
Also used : ExceptionMetadata(org.thoughtcrime.securesms.messages.MessageContentProcessor.ExceptionMetadata) BadGroupIdException(org.thoughtcrime.securesms.groups.BadGroupIdException) GroupId(org.thoughtcrime.securesms.groups.GroupId)

Example 2 with ExceptionMetadata

use of org.thoughtcrime.securesms.messages.MessageContentProcessor.ExceptionMetadata in project Signal-Android by signalapp.

the class MessageDecryptionUtil method toExceptionMetadata.

private static ExceptionMetadata toExceptionMetadata(@NonNull UnsupportedDataMessageException e) throws NoSenderException {
    String sender = e.getSender();
    if (sender == null)
        throw new NoSenderException();
    GroupId groupId = null;
    if (e.getGroup().isPresent()) {
        try {
            groupId = GroupUtil.idFromGroupContext(e.getGroup().get());
        } catch (BadGroupIdException ex) {
            Log.w(TAG, "Bad group id found in unsupported data message", ex);
        }
    }
    return new ExceptionMetadata(sender, e.getSenderDevice(), groupId);
}
Also used : ExceptionMetadata(org.thoughtcrime.securesms.messages.MessageContentProcessor.ExceptionMetadata) BadGroupIdException(org.thoughtcrime.securesms.groups.BadGroupIdException) GroupId(org.thoughtcrime.securesms.groups.GroupId)

Aggregations

BadGroupIdException (org.thoughtcrime.securesms.groups.BadGroupIdException)2 GroupId (org.thoughtcrime.securesms.groups.GroupId)2 ExceptionMetadata (org.thoughtcrime.securesms.messages.MessageContentProcessor.ExceptionMetadata)2