mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
parent
db42f61cbb
commit
03f193b34c
3 changed files with 19 additions and 2 deletions
|
@ -592,6 +592,13 @@ public interface Signal extends DBusInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NotAGroupMember extends DBusExecutionException {
|
||||||
|
|
||||||
|
public NotAGroupMember(final String message) {
|
||||||
|
super("Not a group member: " + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class InvalidGroupId extends DBusExecutionException {
|
class InvalidGroupId extends DBusExecutionException {
|
||||||
|
|
||||||
public InvalidGroupId(final String message) {
|
public InvalidGroupId(final String message) {
|
||||||
|
|
|
@ -219,7 +219,15 @@ public class DbusManagerImpl implements Manager {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
final var group = getRemoteObject(signal.getGroup(groupId.serialize()), Signal.Group.class);
|
final var group = getRemoteObject(signal.getGroup(groupId.serialize()), Signal.Group.class);
|
||||||
|
try {
|
||||||
group.quitGroup();
|
group.quitGroup();
|
||||||
|
} catch (Signal.Error.GroupNotFound e) {
|
||||||
|
throw new GroupNotFoundException(groupId);
|
||||||
|
} catch (Signal.Error.NotAGroupMember e) {
|
||||||
|
throw new NotAGroupMemberException(groupId, group.Get("org.asamk.Signal.Group", "Name"));
|
||||||
|
} catch (Signal.Error.LastGroupAdmin e) {
|
||||||
|
throw new LastGroupAdminException(groupId, group.Get("org.asamk.Signal.Group", "Name"));
|
||||||
|
}
|
||||||
return new SendGroupMessageResults(0, List.of());
|
return new SendGroupMessageResults(0, List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1193,8 +1193,10 @@ public class DbusSignalImpl implements Signal {
|
||||||
public void quitGroup() throws Error.Failure {
|
public void quitGroup() throws Error.Failure {
|
||||||
try {
|
try {
|
||||||
m.quitGroup(groupId, Set.of());
|
m.quitGroup(groupId, Set.of());
|
||||||
} catch (GroupNotFoundException | NotAGroupMemberException e) {
|
} catch (GroupNotFoundException e) {
|
||||||
throw new Error.GroupNotFound(e.getMessage());
|
throw new Error.GroupNotFound(e.getMessage());
|
||||||
|
} catch (NotAGroupMemberException e) {
|
||||||
|
throw new Error.NotAGroupMember(e.getMessage());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new Error.Failure(e.getMessage());
|
throw new Error.Failure(e.getMessage());
|
||||||
} catch (LastGroupAdminException e) {
|
} catch (LastGroupAdminException e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue