Fixes
This commit is contained in:
parent
2444302510
commit
708bd14e99
2 changed files with 18 additions and 11 deletions
|
@ -159,7 +159,7 @@ func LoadDbAccounts(mxid string, key *[32]byte) {
|
||||||
|
|
||||||
err = SetAccount(mxid, acct.Name, acct.Protocol, config)
|
err = SetAccount(mxid, acct.Name, acct.Protocol, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ezbrSystemSendf("Could not setup account %s: %s", acct.Name, err.Error())
|
ezbrSystemSendf(mxid, "Could not setup account %s: %s", acct.Name, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
server.go
11
server.go
|
@ -4,6 +4,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
@ -23,22 +24,28 @@ func StartAppService(errch chan error) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dbKvGet("ezbr_initialized") != "yes" {
|
||||||
err = mx.RegisterUser(registration.SenderLocalpart)
|
err = mx.RegisterUser(registration.SenderLocalpart)
|
||||||
if mxe, ok := err.(*mxlib.MxError); !ok || mxe.ErrCode != "M_USER_IN_USE" {
|
if mxe, ok := err.(*mxlib.MxError); !ok || mxe.ErrCode != "M_USER_IN_USE" {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err == nil {
|
|
||||||
// If Easybridge account was created, update avatar and display name
|
_, st := os.Stat(config.AvatarFile)
|
||||||
|
if !os.IsNotExist(st) {
|
||||||
err = mx.ProfileAvatar(ezbrMxId(), &connector.FileMediaObject{
|
err = mx.ProfileAvatar(ezbrMxId(), &connector.FileMediaObject{
|
||||||
Path: config.AvatarFile,
|
Path: config.AvatarFile,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = mx.ProfileDisplayname(ezbrMxId(), fmt.Sprintf("Easybridge (%s)", EASYBRIDGE_SYSTEM_PROTOCOL))
|
err = mx.ProfileDisplayname(ezbrMxId(), fmt.Sprintf("Easybridge (%s)", EASYBRIDGE_SYSTEM_PROTOCOL))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dbKvPut("ezbr_initialized", "yes")
|
||||||
}
|
}
|
||||||
|
|
||||||
router := mux.NewRouter()
|
router := mux.NewRouter()
|
||||||
|
|
Loading…
Reference in a new issue