summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/channel_list.go20
-rw-r--r--client/channel_window.go9
2 files changed, 27 insertions, 2 deletions
diff --git a/client/channel_list.go b/client/channel_list.go
index f7413fd..2daf619 100644
--- a/client/channel_list.go
+++ b/client/channel_list.go
@@ -119,6 +119,26 @@ func (cl *channelList) show(scroll *tui.ScrollState) {
}
}
}
+
+ switch {
+ case tui.MenuOption("list"):
+ w := globalApp.windowCache.Open(entry.location)
+ switch w.(type) {
+ case *channelWindow:
+ w.(*channelWindow).userList(func(msg userListMsg) {
+ globalApp.cmdWindow.Buffer().Add(msg)
+ })
+ }
+ case tui.MenuOption("leave"):
+ w := globalApp.windowCache.Open(entry.location)
+ switch w.(type) {
+ case *channelWindow:
+ defer w.(*channelWindow).leaveChannel()
+ }
+ if entry.location == globalApp.currentWindow {
+ globalApp.goTo(cmdWindowLocation {})
+ }
+ }
ch := globalApp.cache.Get(entry.location.id)
if ch != nil {
diff --git a/client/channel_window.go b/client/channel_window.go
index 95f0dbf..ff9484a 100644
--- a/client/channel_window.go
+++ b/client/channel_window.go
@@ -209,7 +209,6 @@ func (u userListMsg) Show(odd bool) {
}
func (cw *channelWindow) userList(callback func(userListMsg)) {
- ch := cw.getChannel()
cb := func(response proto.Command) {
if response.Kind != "list" {
return
@@ -219,7 +218,13 @@ func (cw *channelWindow) userList(callback func(userListMsg)) {
names = append(names, u.Fields[""])
}
lastIndex++
- callback(userListMsg {lastIndex, ch.Fields[""], names})
+ globalApp.cache.Fetch(cw.location.id, func(ch *proto.Object) {
+ var name string
+ if ch != nil {
+ name = ch.Fields[""]
+ }
+ callback(userListMsg {lastIndex, name, names})
+ })
}
globalApp.Request(proto.NewCmd("list", cw.location.id), cb)
}