- if (groupIdString != null) {
- byte[] groupId;
- try {
- groupId = Util.decodeGroupId(groupIdString).serialize();
- } catch (GroupIdFormatException e) {
- throw new UserErrorException("Invalid group id: " + e.getMessage());
- }
-
- try {
- var timestamp = signal.sendGroupMessage(messageText, attachments, groupId);
- outputResult(outputWriter, timestamp);
- return;
- } catch (DBusExecutionException e) {
- throw new UnexpectedErrorException("Failed to send group message: " + e.getMessage());
- }
- }
-
- if (isNoteToSelf) {
- try {
- var timestamp = signal.sendNoteToSelfMessage(messageText, attachments);
- outputResult(outputWriter, timestamp);
- return;
- } catch (Signal.Error.UntrustedIdentity e) {
- throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage());
- } catch (DBusExecutionException e) {
- throw new UnexpectedErrorException("Failed to send note to self message: " + e.getMessage());
- }
- }
-