|
@@ -1678,30 +1678,28 @@ func whowasHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
1678
|
1678
|
return false
|
1679
|
1679
|
}
|
1680
|
1680
|
|
1681
|
|
-// LUSERS [ <mask> [ <target> ] ]
|
|
1681
|
+// LUSERS [<mask> [<server>]]
|
1682
|
1682
|
func lusersHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
1683
|
1683
|
//TODO(vegax87) Fix network statistics and additional parameters
|
1684
|
1684
|
var totalcount int
|
1685
|
1685
|
var invisiblecount int
|
1686
|
1686
|
var opercount int
|
1687
|
1687
|
var chancount int
|
1688
|
|
-
|
|
1688
|
+
|
1689
|
1689
|
server.clients.ByNickMutex.RLock()
|
1690
|
1690
|
defer server.clients.ByNickMutex.RUnlock()
|
1691
|
|
-
|
|
1691
|
+
|
1692
|
1692
|
for _, onlineusers := range server.clients.ByNick {
|
1693
|
|
- totalcount += 1
|
|
1693
|
+ totalcount++
|
1694
|
1694
|
if onlineusers.flags[Invisible] {
|
1695
|
|
- invisiblecount += 1
|
|
1695
|
+ invisiblecount++
|
1696
|
1696
|
}
|
1697
|
1697
|
if onlineusers.flags[Operator] {
|
1698
|
|
- opercount += 1
|
|
1698
|
+ opercount++
|
1699
|
1699
|
}
|
1700
|
1700
|
}
|
1701
|
|
- for chans := range server.channels {
|
1702
|
|
- //Little hack just to avoid "variable declared but not used" error
|
1703
|
|
- _ = chans
|
1704
|
|
- chancount += 1
|
|
1701
|
+ for range server.channels {
|
|
1702
|
+ chancount++
|
1705
|
1703
|
}
|
1706
|
1704
|
client.Send(nil, server.name, RPL_LUSERCLIENT, client.nick, fmt.Sprintf("There are %d users and %d invisible on %d server(s)", totalcount, invisiblecount, 1))
|
1707
|
1705
|
client.Send(nil, server.name, RPL_LUSEROP, client.nick, fmt.Sprintf("%d operators online", opercount))
|