23 lines
545 B
Go
23 lines
545 B
Go
package appservice
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
. "git.deuxfleurs.fr/Deuxfleurs/easybridge/connector"
|
|
)
|
|
|
|
func roomAlias(protocol string, id RoomID) string {
|
|
return fmt.Sprintf("_ezbr__%s__%s", safeStringForId(string(id)), protocol)
|
|
}
|
|
|
|
func userMxId(protocol string, id UserID) string {
|
|
return fmt.Sprintf("_ezbr__%s__%s", safeStringForId(string(id)), protocol)
|
|
}
|
|
|
|
func safeStringForId(in string) string {
|
|
id2 := strings.ReplaceAll(in, "#", "")
|
|
id2 = strings.ReplaceAll(id2, "@", "__")
|
|
id2 = strings.ReplaceAll(id2, ":", "_")
|
|
return id2
|
|
}
|