aboutsummaryrefslogtreecommitdiff
path: root/appservice/account.go
diff options
context:
space:
mode:
Diffstat (limited to 'appservice/account.go')
-rw-r--r--appservice/account.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/appservice/account.go b/appservice/account.go
index d8bf8cf..013a420 100644
--- a/appservice/account.go
+++ b/appservice/account.go
@@ -55,12 +55,18 @@ func RemoveAccount(mxUser string, name string) {
}
}
+func (a *Account) ezbrMessagef(format string, args ...interface{}) {
+ msg := fmt.Sprintf(format, args...)
+ msg = fmt.Sprintf("%s: %s", a.Protocol, msg)
+ ezbrSystemSend(a.MatrixUser, msg)
+}
+
// ---- Begin event handlers ----
func (a *Account) Joined(roomId RoomID) {
err := a.joinedInternal(roomId)
if err != nil {
- log.Warnf("Dropping Account.Joined %s: %s", roomId, err)
+ a.ezbrMessagef("Dropping Account.Joined %s: %s", roomId, err)
}
}
@@ -86,7 +92,7 @@ func (a *Account) joinedInternal(roomId RoomID) error {
func (a *Account) Left(roomId RoomID) {
err := a.leftInternal(roomId)
if err != nil {
- log.Warnf("Dropping Account.Left %s: %s", roomId, err)
+ a.ezbrMessagef("Dropping Account.Left %s: %s", roomId, err)
}
}
@@ -108,7 +114,7 @@ func (a *Account) leftInternal(roomId RoomID) error {
func (a *Account) UserInfoUpdated(user UserID, info *UserInfo) {
err := a.userInfoUpdatedInternal(user, info)
if err != nil {
- log.Warnf("Dropping Account.UserInfoUpdated %s: %s", user, err)
+ a.ezbrMessagef("Dropping Account.UserInfoUpdated %s: %s", user, err)
}
}
@@ -137,7 +143,7 @@ func (a *Account) userInfoUpdatedInternal(user UserID, info *UserInfo) error {
func (a *Account) RoomInfoUpdated(roomId RoomID, author UserID, info *RoomInfo) {
err := a.roomInfoUpdatedInternal(roomId, author, info)
if err != nil {
- log.Warnf("Dropping Account.RoomInfoUpdated %s: %s", roomId, err)
+ a.ezbrMessagef("Dropping Account.RoomInfoUpdated %s: %s", roomId, err)
}
}
@@ -163,7 +169,8 @@ func (a *Account) roomInfoUpdatedInternal(roomId RoomID, author UserID, info *Ro
}
if info.Name != "" {
- err2 := mxRoomNameAs(mx_room_id, info.Name, as_mxid)
+ name := fmt.Sprintf("%s (%s)", info.Name, a.Protocol)
+ err2 := mxRoomNameAs(mx_room_id, name, as_mxid)
if err2 != nil {
err = err2
}
@@ -182,7 +189,7 @@ func (a *Account) roomInfoUpdatedInternal(roomId RoomID, author UserID, info *Ro
func (a *Account) Event(event *Event) {
err := a.eventInternal(event)
if err != nil {
- log.Warnf("Dropping Account.Event %s %s %s: %s", event.Author, event.Recipient, event.Room, err)
+ a.ezbrMessagef("Dropping Account.Event %s %s %s: %s", event.Author, event.Recipient, event.Room, err)
}
}