aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/messages/parser/parser.go2
-rw-r--r--ui/view-main.go12
2 files changed, 11 insertions, 3 deletions
diff --git a/ui/messages/parser/parser.go b/ui/messages/parser/parser.go
index eef91a2..090732d 100644
--- a/ui/messages/parser/parser.go
+++ b/ui/messages/parser/parser.go
@@ -137,5 +137,5 @@ func ParseMembershipEvent(room *rooms.Room, evt *gomatrix.Event) messages.UIMess
}
ts := unixToTime(evt.Timestamp)
- return messages.NewExpandedTextMessage(evt.ID, evt.Sender, displayname, "m.room.membership", text, ts)
+ return messages.NewExpandedTextMessage(evt.ID, evt.Sender, displayname, "m.room.member", text, ts)
}
diff --git a/ui/view-main.go b/ui/view-main.go
index c5f1304..34bccc7 100644
--- a/ui/view-main.go
+++ b/ui/view-main.go
@@ -152,13 +152,21 @@ func (view *MainView) HandleCommand(roomView *RoomView, command string, args []s
case "/panic":
panic("This is a test panic.")
case "/part", "/leave":
- debug.Print("Leave room result:", view.matrix.LeaveRoom(roomView.Room.ID))
+ err := view.matrix.LeaveRoom(roomView.Room.ID)
+ debug.Print("Leave room error:", err)
+ if err == nil {
+ view.RemoveRoom(roomView.Room.ID)
+ }
case "/join":
if len(args) == 0 {
roomView.AddServiceMessage("Usage: /join <room>")
break
}
- debug.Print("Join room result:", view.matrix.JoinRoom(args[0]))
+ room, err := view.matrix.JoinRoom(args[0])
+ debug.Print("Join room error:", err)
+ if err == nil {
+ view.AddRoom(room.ID)
+ }
default:
roomView.AddServiceMessage("Unknown command.")
}