mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 15:44:28 +01:00
json-rpc mode: fixed bug in group deletion
* deleting a group in json-rpc mode didn't work. see #387
This commit is contained in:
@@ -993,8 +993,25 @@ func (s *SignalClient) GetGroup(number string, groupId string) (*GroupEntry, err
|
||||
}
|
||||
|
||||
func (s *SignalClient) DeleteGroup(number string, groupId string) error {
|
||||
_, err := s.cliClient.Execute(true, []string{"--config", s.signalCliConfig, "-a", number, "quitGroup", "-g", string(groupId)}, "")
|
||||
if s.signalCliMode == JsonRpc {
|
||||
type Request struct {
|
||||
GroupId string `json:"groupId"`
|
||||
}
|
||||
request := Request{GroupId: groupId}
|
||||
|
||||
jsonRpc2Client, err := s.getJsonRpc2Client(number)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = jsonRpc2Client.getRaw("quitGroup", request)
|
||||
return err
|
||||
} else {
|
||||
ret, err := s.cliClient.Execute(true, []string{"--config", s.signalCliConfig, "-a", number, "quitGroup", "-g", string(groupId)}, "")
|
||||
if strings.Contains(ret, "User is not a group member") {
|
||||
return errors.New("Can't delete group: User is not a group member")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SignalClient) GetQrCodeLink(deviceName string, qrCodeVersion int) ([]byte, error) {
|
||||
|
||||
Reference in New Issue
Block a user