mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
minimal whois implementation
This commit is contained in:
parent
06648393a1
commit
c4f457705a
5 changed files with 81 additions and 23 deletions
|
|
@ -165,6 +165,7 @@ func (m *NickCommand) HandleServer(s *Server) {
|
|||
}
|
||||
|
||||
reply := RplNick(c, m.nickname)
|
||||
c.replies <- reply
|
||||
for iclient := range c.InterestedClients() {
|
||||
iclient.replies <- reply
|
||||
}
|
||||
|
|
@ -201,7 +202,6 @@ func (m *QuitCommand) HandleServer(s *Server) {
|
|||
reply := RplQuit(c, m.message)
|
||||
for client := range c.InterestedClients() {
|
||||
client.replies <- reply
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -280,3 +280,22 @@ func (m *ModeCommand) HandleServer(s *Server) {
|
|||
|
||||
client.replies <- ErrUsersDontMatch(client)
|
||||
}
|
||||
|
||||
func (m *WhoisCommand) HandleServer(server *Server) {
|
||||
client := m.Client()
|
||||
|
||||
// TODO implement target query
|
||||
if m.target != "" {
|
||||
client.replies <- ErrNoSuchServer(server, m.target)
|
||||
return
|
||||
}
|
||||
|
||||
for _, mask := range m.masks {
|
||||
// TODO implement wildcard matching
|
||||
mclient := server.clients[mask]
|
||||
if mclient != nil {
|
||||
client.replies <- RplWhoisUser(server, mclient)
|
||||
}
|
||||
}
|
||||
client.replies <- RplEndOfWhois(server)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue