Set easybridge display name

This commit is contained in:
Alex 2020-02-17 15:30:01 +01:00
parent 400c67f735
commit 51f3c45e05
2 changed files with 11 additions and 1 deletions

View file

@ -34,6 +34,16 @@ func Start(r *mxlib.Registration, c *Config) (chan error, error) {
return nil, err 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 := mux.NewRouter()
router.HandleFunc("/_matrix/app/v1/transactions/{txnId}", handleTxn) router.HandleFunc("/_matrix/app/v1/transactions/{txnId}", handleTxn)
router.HandleFunc("/transactions/{txnId}", handleTxn) router.HandleFunc("/transactions/{txnId}", handleTxn)

View file

@ -100,7 +100,7 @@ func readRegistration(file string) mxlib.Registration {
Url: "http://localhost:8321", Url: "http://localhost:8321",
AsToken: hex.EncodeToString(rnd[:32]), AsToken: hex.EncodeToString(rnd[:32]),
HsToken: hex.EncodeToString(rnd[32:]), HsToken: hex.EncodeToString(rnd[32:]),
SenderLocalpart: "_ezbr", SenderLocalpart: "_ezbr_",
Namespaces: mxlib.RegistrationNamespaceSet{ Namespaces: mxlib.RegistrationNamespaceSet{
Users: []mxlib.RegistrationNamespace{ Users: []mxlib.RegistrationNamespace{
mxlib.RegistrationNamespace{ mxlib.RegistrationNamespace{