aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-02-17 15:30:01 +0100
committerAlex Auvolat <alex@adnab.me>2020-02-17 15:30:01 +0100
commit51f3c45e05558153880f1b6898be86e84e76a5a1 (patch)
treeb3d96865f1be37dc416cf7e3ecf83ab8d92831ed
parent400c67f7352371f570e38531d7e033cfe6c87898 (diff)
downloadeasybridge-51f3c45e05558153880f1b6898be86e84e76a5a1.tar.gz
easybridge-51f3c45e05558153880f1b6898be86e84e76a5a1.zip
Set easybridge display name
-rw-r--r--appservice/server.go10
-rw-r--r--main.go2
2 files changed, 11 insertions, 1 deletions
diff --git a/appservice/server.go b/appservice/server.go
index 1dc7222..79a8f1a 100644
--- a/appservice/server.go
+++ b/appservice/server.go
@@ -34,6 +34,16 @@ func Start(r *mxlib.Registration, c *Config) (chan error, error) {
return nil, err
}
+ svc_mxid := fmt.Sprintf("@%s:%s", registration.SenderLocalpart, config.MatrixDomain)
+ err = mxRegisterUser(registration.SenderLocalpart)
+ if mxe, ok := err.(*mxlib.MxError); !ok || mxe.ErrCode != "M_USER_IN_USE" {
+ return nil, err
+ }
+ err = mxProfileDisplayname(svc_mxid, "Easybridge")
+ if err != nil {
+ return nil, err
+ }
+
router := mux.NewRouter()
router.HandleFunc("/_matrix/app/v1/transactions/{txnId}", handleTxn)
router.HandleFunc("/transactions/{txnId}", handleTxn)
diff --git a/main.go b/main.go
index 272bb16..105d798 100644
--- a/main.go
+++ b/main.go
@@ -100,7 +100,7 @@ func readRegistration(file string) mxlib.Registration {
Url: "http://localhost:8321",
AsToken: hex.EncodeToString(rnd[:32]),
HsToken: hex.EncodeToString(rnd[32:]),
- SenderLocalpart: "_ezbr",
+ SenderLocalpart: "_ezbr_",
Namespaces: mxlib.RegistrationNamespaceSet{
Users: []mxlib.RegistrationNamespace{
mxlib.RegistrationNamespace{