-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Creates a Signal group when the bridge is configured, with following settings: - name & description as configured - predefined avatar (file stored in the signal-cli container) - invite link enabled - add member permissions: every member - edit details permissions: only admin - send messages: only admin * Sends messages (with attachments) to the Signal group * Tries to leave the Signal group when bridge is reset. This doesnt work though if the Signal account is the only admin (which is almost always the case). * Tries to delete message when it's deleted in ticker.
- Loading branch information
1 parent
fe8f2bc
commit 21d11f1
Showing
14 changed files
with
460 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package bridge | ||
|
||
import ( | ||
"github.com/systemli/ticker/internal/config" | ||
"github.com/systemli/ticker/internal/signal" | ||
"github.com/systemli/ticker/internal/storage" | ||
) | ||
|
||
type SignalGroupBridge struct { | ||
config config.Config | ||
storage storage.Storage | ||
} | ||
|
||
func (sb *SignalGroupBridge) Send(ticker storage.Ticker, message *storage.Message) error { | ||
if !sb.config.SignalGroup.Enabled() || !ticker.SignalGroup.Connected() || !ticker.SignalGroup.Active { | ||
return nil | ||
} | ||
|
||
err := signal.SendGroupMessage(sb.config, sb.storage, ticker.SignalGroup.GroupID, message) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func (sb *SignalGroupBridge) Delete(ticker storage.Ticker, message *storage.Message) error { | ||
if !sb.config.SignalGroup.Enabled() || !ticker.SignalGroup.Connected() || !ticker.SignalGroup.Active || message.SignalGroup.Timestamp == nil { | ||
return nil | ||
} | ||
|
||
err := signal.DeleteMessage(sb.config, ticker.SignalGroup.GroupID, message) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.