Skip to content

Commit

Permalink
json-rpc mode: fixed bug in group deletion
Browse files Browse the repository at this point in the history
* deleting a group in json-rpc mode didn't work.

see #387
  • Loading branch information
Bernhard B committed Oct 4, 2023
1 parent b39980e commit 661fe56
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)}, "")
return err
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) {
Expand Down

0 comments on commit 661fe56

Please sign in to comment.