diff options
| author | raven <citrons@mondecitronne.com> | 2025-10-22 19:38:13 -0500 |
|---|---|---|
| committer | raven <citrons@mondecitronne.com> | 2026-02-09 13:14:04 -0600 |
| commit | 14fe0a31fb1fb1e9ab04dec1c18695a48ad57572 (patch) | |
| tree | 68a226a6c690cae542a6cd3963ee2004800d42fc /client/channel_list.go | |
| parent | 71722ee7c2f833f6244410f6ddad688a2b5c20c3 (diff) | |
check channel list for /join and /leave
Diffstat (limited to 'client/channel_list.go')
| -rw-r--r-- | client/channel_list.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/channel_list.go b/client/channel_list.go index 25d093f..bc89dba 100644 --- a/client/channel_list.go +++ b/client/channel_list.go @@ -2,6 +2,7 @@ package main import ( "citrons.xyz/talk/proto" + "citrons.xyz/talk/proto/validate" "citrons.xyz/talk/tui" "sort" ) @@ -38,6 +39,24 @@ func (cl *channelList) setChannels(cs []proto.Object) { sort.Sort(cl) } +func (cl *channelList) contains(location channelLocation) bool { + for i := 0; i < len(*cl); i++ { + if (*cl)[i].location == location { + return true + } + } + return false +} + +func (cl *channelList) findName(name string) channelLocation { + for i := 0; i < len(*cl); i++ { + if validate.Fold((*cl)[i].name) == validate.Fold(name) { + return (*cl)[i].location + } + } + return channelLocation {} +} + func (cl *channelList) remove(location channelLocation) { for i := len(*cl) - 1; i >= 0; i-- { if (*cl)[i].location != location { |
