diff options
Diffstat (limited to 'server.go')
-rw-r--r-- | server.go | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -171,7 +171,10 @@ func handleTxnEvent(e *mxlib.Event) error { } else if room := dbIsPublicRoom(e.RoomId); room != nil { // If this is a regular room acct := FindJoinedAccount(e.Sender, room.Protocol, room.RoomID) - if acct != nil { + if acct == nil { + mx.RoomKick(e.RoomId, e.Sender, fmt.Sprintf("Not present in %s on %s, please talk with Easybridge to rejoin", room.RoomID, room.Protocol)) + return fmt.Errorf("not joined %s on %s", room.RoomID, room.Protocol) + } else { ev.Author = acct.Conn.User() ev.Room = room.RoomID @@ -186,9 +189,6 @@ func handleTxnEvent(e *mxlib.Event) error { dbKvPutLocked(cache_key, "yes") } return err - } else { - mx.RoomKick(e.RoomId, e.Sender, fmt.Sprintf("Not present in %s on %s, please talk with Easybridge to rejoin", room.RoomID, room.Protocol)) - return fmt.Errorf("not joined %s on %s", room.RoomID, room.Protocol) } } else { return fmt.Errorf("Room not bridged") @@ -203,7 +203,10 @@ func handleTxnEvent(e *mxlib.Event) error { if pm_room := dbIsPmRoom(e.RoomId); pm_room != nil { // If user leaves a PM room, we must drop it dbDeletePmRoom(pm_room) - them_mx := userMxId(pm_room.Protocol, pm_room.UserID) + them_mx, err := dbGetMxUser(pm_room.Protocol, pm_room.UserID) + if err != nil { + return err + } mx.RoomLeaveAs(e.RoomId, them_mx) return nil } else if room := dbIsPublicRoom(e.RoomId); room != nil { |