summaryrefslogtreecommitdiffstats
path: root/bridge/config
diff options
context:
space:
mode:
authorQais Patankar <qaisjp@gmail.com>2020-12-31 18:01:57 +0000
committerGitHub <noreply@github.com>2020-12-31 18:01:57 +0000
commita9d8ac8bc0c745d43440aa56f1b602edf8e4aef7 (patch)
treee6ce1698337ae6882470028fe659f690f384efe9 /bridge/config
parent1a4717b366a2371dacc0ce205b0a42c5b31f52dc (diff)
downloadmatterbridge-msglm-a9d8ac8bc0c745d43440aa56f1b602edf8e4aef7.tar.gz
matterbridge-msglm-a9d8ac8bc0c745d43440aa56f1b602edf8e4aef7.tar.bz2
matterbridge-msglm-a9d8ac8bc0c745d43440aa56f1b602edf8e4aef7.zip
Refactor "msg-parent-not-found" to config.ParentIDNotFound (#1347)
Diffstat (limited to 'bridge/config')
-rw-r--r--bridge/config/config.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/bridge/config/config.go b/bridge/config/config.go
index 7dbbc80b..98935208 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -29,6 +29,8 @@ const (
EventNoticeIRC = "notice_irc"
)
+const ParentIDNotFound = "msg-parent-not-found"
+
type Message struct {
Text string `json:"text"`
Channel string `json:"channel"`
@@ -45,6 +47,14 @@ type Message struct {
Extra map[string][]interface{}
}
+func (m Message) ParentNotFound() bool {
+ return m.ParentID == ParentIDNotFound
+}
+
+func (m Message) ParentValid() bool {
+ return m.ParentID != "" && !m.ParentNotFound()
+}
+
type FileInfo struct {
Name string
Data *[]byte