mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 15:44:28 +01:00
fixed bug in search endpoint
* when multiple accounts are registered, signal-cli expects the account
specified with '-a'. In order to stay backwards compatible, the search
endpoint was extended with an optional number parameter. i.e:
'/search/{number}'. In case only one account is registered, the number
parameter can be omitted.
see #369
This commit is contained in:
@@ -1348,7 +1348,7 @@ func (s *SignalClient) SendStopTyping(number string, recipient string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SignalClient) SearchForNumbers(numbers []string) ([]SearchResultEntry, error) {
|
||||
func (s *SignalClient) SearchForNumbers(number string, numbers []string) ([]SearchResultEntry, error) {
|
||||
searchResultEntries := []SearchResultEntry{}
|
||||
|
||||
var err error
|
||||
@@ -1374,7 +1374,11 @@ func (s *SignalClient) SearchForNumbers(numbers []string) ([]SearchResultEntry,
|
||||
return searchResultEntries, err
|
||||
}
|
||||
} else {
|
||||
cmd := []string{"--config", s.signalCliConfig, "--output", "json", "getUserStatus"}
|
||||
cmd := []string{"--config", s.signalCliConfig, "--output", "json"}
|
||||
if number != "" {
|
||||
cmd = append(cmd, []string{"-a", number}...)
|
||||
}
|
||||
cmd = append(cmd, "getUserStatus")
|
||||
cmd = append(cmd, numbers...)
|
||||
rawData, err = s.cliClient.Execute(true, cmd, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user