Selaa lähdekoodia

LUSERS: Minor cleanups, we don't need to worry about changelog lines for now

tags/v0.6.0
Daniel Oaks 7 vuotta sitten
vanhempi
commit
298f4907ac
3 muutettua tiedostoa jossa 13 lisäystä ja 19 poistoa
  1. 1
    3
      CHANGELOG.md
  2. 4
    6
      irc/help.go
  3. 8
    10
      irc/server.go

+ 1
- 3
CHANGELOG.md Näytä tiedosto

@@ -13,9 +13,7 @@ New release of Oragono!
13 13
 * Added ARM build (for Raspberry PIs and similar).
14 14
 * Added automated connection throttling! See the new `connection-throttling` section in the config.
15 15
 * Added `KLINE` and `UNKLINE` commands. Complementing `DLINE`'s per-IP and per-network bans, this lets you ban masks from the server.
16
-
17
-
18
-* Added LUSERS command. It works for a single server for now (by @vegax87)
16
+* Added `LUSERS` command (thanks @vegax87!).
19 17
 
20 18
 ### Changed
21 19
 * Changed casemapping from "rfc7700" to "rfc7613", to match new draft spec.

+ 4
- 6
irc/help.go Näytä tiedosto

@@ -190,13 +190,11 @@ channels). <elistcond>s modify how the channels are selected.`,
190 190
 		//TODO(dan): Explain <elistcond>s in more specific detail
191 191
 	},
192 192
 	"lusers": {
193
-		text: `LUSERS [ <mask> [ <target> ] ]
193
+		text: `LUSERS [<mask> [<server>]]
194 194
 
195
-Returns statistics about the size of the network.
196
-If called with no arguments, the statistics will reflect the entire network. 
197
-If <mask> is given, it will return only statistics reflecting the masked subset of the network. 
198
-If <target> is given, the command will be forwarded to <server> for evaluation.`,
199
-		//TODO(vegax87): Include network statistics and parameters
195
+Shows statistics about the size of the network. If <mask> is given, only
196
+returns stats for servers matching the given mask.  If <server> is given, the
197
+command is processed by that server.`,
200 198
 	},
201 199
 	"mode": {
202 200
 		text: `MODE <target> [<modestring> [<mode arguments>...]]

+ 8
- 10
irc/server.go Näytä tiedosto

@@ -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))

Loading…
Peruuta
Tallenna