Implement LIST

This commit is contained in:
Trevor Slocum 2016-09-06 00:04:36 -07:00
parent a1ce23d011
commit 6d106f4e47
2 changed files with 14 additions and 7 deletions

View File

@ -1,13 +1,12 @@
AnonIRCd
--------
##### Try it out:
Connect to [z.1chan.us:6667](irc://z.1chan.us:6667) or [:6697 (SSL)](ircs://z.1chan.us:6697)
##### TODO:
- configuration system
- database (sqlite for portability?)
- ssl
- verify pings and prune lagging clients
- admin/mod login via server password
- admin/mod commands via /anonirc <args>
- admins/mods can say something official in a channel, it will also come with a notice to grab attention
@ -17,9 +16,5 @@ Connect to [z.1chan.us:6667](irc://z.1chan.us:6667) or [:6697 (SSL)](ircs://z.1c
- each channel password can be supplied during connection as server password (e.g. #lobby/swordfish:#lounge/8ball) or via a command
- private channels (+k implementation)
- implement read locks...? are they necessary?
- /list support
- move userlist updates to more efficient goroutine monitoring changes
- whois anonymous<#> easter egg, could be pre-programmed witty phrases/quotes
- op users (locally) when they are logged in to a founder/admin/mod password for client compatibility
- send supported user and channel modes when new user connects
- SSL-only channel mode

View File

@ -380,6 +380,18 @@ func (s *Server) handleRead(c *Client) {
}
s.joinChannel("#", c.identifier)
} else if (msg.Command == irc.LIST) {
c.writebuffer <- &irc.Message{&anonirc, irc.RPL_LISTSTART, []string{"Channel", "Users Name"}}
for channelname, channel := range s.channels {
var ccount int
if c.hasMode("c") || channel.hasMode("c") {
ccount = 2
} else {
ccount = len(channel.clients)
}
c.writebuffer <- &irc.Message{&anonirc, irc.RPL_LIST, []string{channelname, strconv.Itoa(ccount), "[" + channel.printModes(nil) + "] " + channel.topic}}
}
c.writebuffer <- &irc.Message{&anonirc, irc.RPL_LISTEND, []string{"End of /LIST"}}
} else if (msg.Command == irc.JOIN && len(msg.Params) > 0 && len(msg.Params[0]) > 0 && msg.Params[0][0] == '#') {
for _, channel := range strings.Split(msg.Params[0], ",") {
s.joinChannel(channel, c.identifier)