extended receive endpoint + AUTO_RECEIVE_SCHEDULE functionality

* added timeout, ignore_attachments and ignore_stories query parameter
  to receive endpoint.

* added AUTO_RECEIVE_SCHEDULE_RECEIVE_TIMEOUT,
  AUTO_RECEIVE_SCHEDULE_IGNORE_ATTACHMENTS and
  AUTO_RECEIVE_SCHEDULE_IGNORE_STORIES environment variables to the
  AUTO_RECEIVE_SCHEDULE functionality.

see #365
This commit is contained in:
Bernhard B
2023-05-14 21:21:38 +02:00
parent 99da94d048
commit 0dd742cb23
6 changed files with 233 additions and 68 deletions

View File

@@ -595,12 +595,20 @@ func (s *SignalClient) SendV2(number string, message string, recps []string, bas
return &timestamps, nil
}
func (s *SignalClient) Receive(number string, timeout int64) (string, error) {
func (s *SignalClient) Receive(number string, timeout int64, ignoreAttachments bool, ignoreStories bool) (string, error) {
if s.signalCliMode == JsonRpc {
return "", errors.New("Not implemented")
} else {
command := []string{"--config", s.signalCliConfig, "--output", "json", "-a", number, "receive", "-t", strconv.FormatInt(timeout, 10)}
if ignoreAttachments {
command = append(command, "--ignore-attachments")
}
if ignoreStories {
command = append(command, "--ignore-stories")
}
out, err := s.cliClient.Execute(true, command, "")
if err != nil {
return "", err