mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-13 03:28:09 -07:00
minimal whois implementation
This commit is contained in:
+20
-1
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user