]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/Main.java
Prevent sending to groups that the user has quit
[signal-cli] / src / main / java / org / asamk / signal / Main.java
index 25807a6b5e58840bdc16aed3e7ffd81a720e2aed..4b95d58eeafbe1ca5b514c23917818a9e63660bf 100644 (file)
@@ -310,6 +310,9 @@ public class Main {
                         } catch (GroupNotFoundException e) {
                             handleGroupNotFoundException(e);
                             return 1;
                         } catch (GroupNotFoundException e) {
                             handleGroupNotFoundException(e);
                             return 1;
+                        } catch (NotAGroupMemberException e) {
+                            handleNotAGroupMemberException(e);
+                            return 1;
                         } catch (AttachmentInvalidException e) {
                             System.err.println("Failed to add attachment: " + e.getMessage());
                             System.err.println("Aborting sending.");
                         } catch (AttachmentInvalidException e) {
                             System.err.println("Failed to add attachment: " + e.getMessage());
                             System.err.println("Aborting sending.");
@@ -401,6 +404,9 @@ public class Main {
                     } catch (GroupNotFoundException e) {
                         handleGroupNotFoundException(e);
                         return 1;
                     } catch (GroupNotFoundException e) {
                         handleGroupNotFoundException(e);
                         return 1;
+                    } catch (NotAGroupMemberException e) {
+                        handleNotAGroupMemberException(e);
+                        return 1;
                     }
 
                     break;
                     }
 
                     break;
@@ -433,6 +439,9 @@ public class Main {
                     } catch (GroupNotFoundException e) {
                         handleGroupNotFoundException(e);
                         return 1;
                     } catch (GroupNotFoundException e) {
                         handleGroupNotFoundException(e);
                         return 1;
+                    } catch (NotAGroupMemberException e) {
+                        handleNotAGroupMemberException(e);
+                        return 1;
                     } catch (EncapsulatedExceptions e) {
                         handleEncapsulatedExceptions(e);
                         return 3;
                     } catch (EncapsulatedExceptions e) {
                         handleEncapsulatedExceptions(e);
                         return 3;
@@ -553,6 +562,13 @@ public class Main {
         System.err.println("Aborting sending.");
     }
 
         System.err.println("Aborting sending.");
     }
 
+    private static void handleNotAGroupMemberException(NotAGroupMemberException e) {
+        System.err.println("Failed to send to group: " + e.getMessage());
+        System.err.println("Update the group on another device to readd the user to this group.");
+        System.err.println("Aborting sending.");
+    }
+
+
     private static void handleDBusExecutionException(DBusExecutionException e) {
         System.err.println("Cannot connect to dbus: " + e.getMessage());
         System.err.println("Aborting.");
     private static void handleDBusExecutionException(DBusExecutionException e) {
         System.err.println("Cannot connect to dbus: " + e.getMessage());
         System.err.println("Aborting.");