aboutsummaryrefslogtreecommitdiff
path: root/appservice/names.go
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-16 22:07:41 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-16 22:07:41 +0100
commitd2ccd6763a8a8a88e5cdbf95fd665e679f8e187e (patch)
tree8d17148b9424019c38d0d19f1b0e2ccef96b87e0 /appservice/names.go
parent046ec6380b7bb363e537ade7fd254b5505dde32d (diff)
downloadeasybridge-d2ccd6763a8a8a88e5cdbf95fd665e679f8e187e.tar.gz
easybridge-d2ccd6763a8a8a88e5cdbf95fd665e679f8e187e.zip
Begin some bridging
Diffstat (limited to 'appservice/names.go')
-rw-r--r--appservice/names.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/appservice/names.go b/appservice/names.go
new file mode 100644
index 0000000..4a5d186
--- /dev/null
+++ b/appservice/names.go
@@ -0,0 +1,21 @@
+package appservice
+
+import (
+ "fmt"
+ "strings"
+
+ . "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
+)
+
+func roomAlias(protocol string, id RoomID) string {
+ id2 := strings.ReplaceAll(string(id), "#", "")
+ id2 = strings.ReplaceAll(id2, "@", "__")
+
+ return fmt.Sprintf("_ezbr__%s__%s", id2, protocol)
+}
+
+func userMxId(protocol string, id UserID) string {
+ id2 := strings.ReplaceAll(string(id), "@", "__")
+
+ return fmt.Sprintf("_ezbr__%s__%s", id2, protocol)
+}