- System.out.println(timestamp);
- return 0;
- } catch (IOException e) {
- handleIOException(e);
- return 3;
- } catch (EncapsulatedExceptions e) {
- handleEncapsulatedExceptions(e);
- return 3;
+ }
+
+ if (isNoteToSelf) {
+ try {
+ var timestamp = signal.sendNoteToSelfMessage(messageText, attachments);
+ writer.println("{}", timestamp);
+ return;
+ } catch (AssertionError e) {
+ handleAssertionError(e);
+ throw e;
+ } 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());
+ }
+ }
+
+ try {
+ var timestamp = signal.sendMessage(messageText, attachments, recipients);
+ writer.println("{}", timestamp);