diff options
| author | citrons <citrons@mondecitronne.com> | 2025-06-07 17:44:10 -0500 |
|---|---|---|
| committer | citrons <citrons@mondecitronne.com> | 2025-06-07 17:52:14 -0500 |
| commit | d56477d1668c675708f7f79018c2e8f171637615 (patch) | |
| tree | 34b5926b90bc872762ee641a22bccc2e00f73925 /client | |
| parent | 24b15604403341044fcb5f7ece18ffc9c569a2cf (diff) | |
channel list context menu
Diffstat (limited to 'client')
| -rw-r--r-- | client/channel_list.go | 20 | ||||
| -rw-r--r-- | client/channel_window.go | 9 |
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) } |
