aboutsummaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-26 21:36:35 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-26 21:36:35 +0100
commit775fc7b2172a632587e82cd44b9d7400ca4f4f74 (patch)
tree1e074736dbbfacecba71ad3d9f76fdfbd1c8a083 /util.go
parentf675ba57e400d378088d29c08bd5d0bd9126c74b (diff)
downloadeasybridge-775fc7b2172a632587e82cd44b9d7400ca4f4f74.tar.gz
easybridge-775fc7b2172a632587e82cd44b9d7400ca4f4f74.zip
Refactor
Diffstat (limited to 'util.go')
-rw-r--r--util.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/util.go b/util.go
index 323f99d..6193d4d 100644
--- a/util.go
+++ b/util.go
@@ -11,6 +11,9 @@ import (
"golang.org/x/crypto/nacl/secretbox"
. "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
+ "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector/irc"
+ "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector/mattermost"
+ "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector/xmpp"
)
const EASYBRIDGE_SYSTEM_PROTOCOL string = "✯◡✯"
@@ -98,3 +101,18 @@ func decryptAccountConfig(data string, key *[32]byte) (map[string]string, error)
err = json.Unmarshal(decoded, &config)
return config, err
}
+
+// ----
+
+func createConnector(protocol string) Connector {
+ switch protocol {
+ case "irc":
+ return &irc.IRC{}
+ case "xmpp":
+ return &xmpp.XMPP{}
+ case "mattermost":
+ return &mattermost.Mattermost{}
+ default:
+ return nil
+ }
+}