mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
minimal who command
This commit is contained in:
parent
d8951e1b48
commit
d370abcd4c
4 changed files with 72 additions and 1 deletions
|
|
@ -310,3 +310,32 @@ func (msg *ChannelModeCommand) HandleServer(server *Server) {
|
|||
|
||||
client.replies <- RplChannelModeIs(server, channel)
|
||||
}
|
||||
|
||||
func whoChannel(client *Client, server *Server, channel *Channel) {
|
||||
for member := range channel.members {
|
||||
client.replies <- RplWhoReply(server, channel, member)
|
||||
}
|
||||
}
|
||||
|
||||
func (msg *WhoCommand) HandleServer(server *Server) {
|
||||
client := msg.Client()
|
||||
// TODO implement wildcard matching
|
||||
|
||||
if msg.mask == "" {
|
||||
for _, channel := range server.channels {
|
||||
whoChannel(client, server, channel)
|
||||
}
|
||||
} else if IsChannel(msg.mask) {
|
||||
channel := server.channels[msg.mask]
|
||||
if channel != nil {
|
||||
whoChannel(client, server, channel)
|
||||
}
|
||||
} else {
|
||||
mclient := server.clients[msg.mask]
|
||||
if mclient != nil {
|
||||
client.replies <- RplWhoReply(server, mclient.channels.First(), mclient)
|
||||
}
|
||||
}
|
||||
|
||||
client.replies <- RplEndOfWho(server, msg.mask)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue