From 14fe0a31fb1fb1e9ab04dec1c18695a48ad57572 Mon Sep 17 00:00:00 2001 From: raven Date: Wed, 22 Oct 2025 19:38:13 -0500 Subject: check channel list for /join and /leave --- client/command.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'client/command.go') diff --git a/client/command.go b/client/command.go index cb6ad10..59b3a8a 100644 --- a/client/command.go +++ b/client/command.go @@ -105,6 +105,11 @@ func (a *application) doCommand(command string, args []string, text string) { a.setNick(text) return case "join": + cl := a.channelList.findName(text) + if cl.id != "" { + a.goTo(cl) + break + } if a.authenticated { a.join(text) } @@ -121,13 +126,12 @@ func (a *application) doCommand(command string, args []string, text string) { leave(a.currentWindow) a.currentWindow = cmdWindowLocation {} } else { - a.lookup(text, "channel", func(ch *proto.Object, err *proto.Fail) { - if err != nil { - a.cmdWindow.fail(proto.Object(*err)) - } else if ch.Id != "" { - leave(channelLocation {id: ch.Id}) - } - }) + cl := a.channelList.findName(text) + if cl.id == "" { + a.cmdWindow.err("you are not in that channel") + } else { + leave(cl) + } } return case "rename": -- cgit v1.2.3