]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/manager/Manager.java
Switch to hypfvieh dbus-java
[signal-cli] / src / main / java / org / asamk / signal / manager / Manager.java
index 11c49d844723a60fb95731bee401446edf0e38fa..ad770617910243e0c11924e03a52e7cb2bab3fd7 100644 (file)
@@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 
 import org.asamk.Signal;
 import org.asamk.signal.AttachmentInvalidException;
+import org.asamk.signal.DbusConfig;
 import org.asamk.signal.GroupNotFoundException;
 import org.asamk.signal.NotAGroupMemberException;
 import org.asamk.signal.StickerPackInvalidException;
@@ -732,7 +733,15 @@ public class Manager implements Signal {
         SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder()
                 .asEndSessionMessage();
 
-        sendMessageLegacy(messageBuilder, getSignalServiceAddresses(recipients));
+        final Collection<SignalServiceAddress> signalServiceAddresses = getSignalServiceAddresses(recipients);
+        try {
+            sendMessageLegacy(messageBuilder, signalServiceAddresses);
+        } catch (Exception e) {
+            for (SignalServiceAddress address : signalServiceAddresses) {
+                handleEndSession(address);
+            }
+            throw e;
+        }
     }
 
     @Override
@@ -1560,7 +1569,7 @@ public class Manager implements Signal {
                 if (content.isNeedsReceipt()) {
                     try {
                         sendReceipt(sender, message.getTimestamp());
-                    } catch (IOException | UntrustedIdentityException e) {
+                    } catch (IOException | UntrustedIdentityException | IllegalArgumentException e) {
                         e.printStackTrace();
                     }
                 }
@@ -1579,21 +1588,21 @@ public class Manager implements Signal {
                     if (rm.isContactsRequest()) {
                         try {
                             sendContacts();
-                        } catch (UntrustedIdentityException | IOException e) {
+                        } catch (UntrustedIdentityException | IOException | IllegalArgumentException e) {
                             e.printStackTrace();
                         }
                     }
                     if (rm.isGroupsRequest()) {
                         try {
                             sendGroups();
-                        } catch (UntrustedIdentityException | IOException e) {
+                        } catch (UntrustedIdentityException | IOException | IllegalArgumentException e) {
                             e.printStackTrace();
                         }
                     }
                     if (rm.isBlockedListRequest()) {
                         try {
                             sendBlockedList();
-                        } catch (UntrustedIdentityException | IOException e) {
+                        } catch (UntrustedIdentityException | IOException | IllegalArgumentException e) {
                             e.printStackTrace();
                         }
                     }
@@ -1817,6 +1826,11 @@ public class Manager implements Signal {
         return false;
     }
 
+    @Override
+    public String getObjectPath() {
+        return null;
+    }
+
     private void sendGroups() throws IOException, UntrustedIdentityException {
         File groupsFile = IOUtils.createTempFile();