Sfoglia il codice sorgente

server: Support more RPL_ISUPPORT stuff

tags/v0.4.0
Daniel Oaks 7 anni fa
parent
commit
f62ffe006f
2 ha cambiato i file con 18 aggiunte e 7 eliminazioni
  1. 1
    0
      CHANGELOG.md
  2. 17
    7
      irc/server.go

+ 1
- 0
CHANGELOG.md Vedi File

@@ -13,6 +13,7 @@ New release of Oragono!
13 13
 * Added operator classes, allowing for more finely-grained permissions for operators.
14 14
 * Added automatic client connection limiting, similar to other IRCds.
15 15
 * Length of channel mode lists (ban / ban-except / invite-except) is now restricted to the limit in config.
16
+* Support `MAXLIST`, `MAXTARGETS`, `MODES`, `TARGMAX` in `RPL_ISUPPORT`.
16 17
 * Added support for IRCv3 capability [`chghost`](http://ircv3.net/specs/extensions/chghost-3.2.html).
17 18
 
18 19
 ### Changed

+ 17
- 7
irc/server.go Vedi File

@@ -269,13 +269,14 @@ func (server *Server) setISupport() {
269 269
 	server.isupport.Add("INVEX", "")
270 270
 	server.isupport.Add("KICKLEN", strconv.Itoa(server.limits.KickLen))
271 271
 	server.isupport.Add("MAXLIST", fmt.Sprintf("beI:%s", strconv.Itoa(server.limits.ChanListModes)))
272
-	// server.isupport.Add("MODES", "")   //TODO(dan): Support max modes?
272
+	server.isupport.Add("MAXTARGETS", "4")
273
+	server.isupport.Add("MODES", "")
273 274
 	server.isupport.Add("MONITOR", strconv.Itoa(server.limits.MonitorEntries))
274 275
 	server.isupport.Add("NETWORK", server.networkName)
275 276
 	server.isupport.Add("NICKLEN", strconv.Itoa(server.limits.NickLen))
276 277
 	server.isupport.Add("PREFIX", "(qaohv)~&@%+")
277 278
 	server.isupport.Add("STATUSMSG", "~&@%+")
278
-	// server.isupport.Add("TARGMAX", "")  //TODO(dan): Support this
279
+	server.isupport.Add("TARGMAX", "NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,MONITOR:")
279 280
 	server.isupport.Add("TOPICLEN", strconv.Itoa(server.limits.TopicLen))
280 281
 
281 282
 	// account registration
@@ -739,7 +740,7 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool
739 740
 	targets := strings.Split(msg.Params[0], ",")
740 741
 	message := msg.Params[1]
741 742
 
742
-	for _, targetString := range targets {
743
+	for _, targetString := range targets[:4] {
743 744
 		prefixes, targetString := SplitChannelMembershipPrefixes(targetString)
744 745
 		lowestPrefix := GetLowestChannelModePrefix(prefixes)
745 746
 
@@ -819,9 +820,8 @@ func whoisHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
819 820
 			}
820 821
 		}
821 822
 	} else {
822
-		// specifically treat this as a single lookup rather than splitting as we do above
823
-		// this is by design
824
-		casefoldedMask, err := Casefold(masksString)
823
+		// only get the first request
824
+		casefoldedMask, err := Casefold(strings.Split(masksString, ",")[0])
825 825
 		mclient := server.clients.Get(casefoldedMask)
826 826
 		if err != nil || mclient == nil {
827 827
 			client.Send(nil, client.server.name, ERR_NOSUCHNICK, masksString, "No such nick")
@@ -1220,7 +1220,7 @@ func noticeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1220 1220
 	targets := strings.Split(msg.Params[0], ",")
1221 1221
 	message := msg.Params[1]
1222 1222
 
1223
-	for _, targetString := range targets {
1223
+	for _, targetString := range targets[:4] {
1224 1224
 		prefixes, targetString := SplitChannelMembershipPrefixes(targetString)
1225 1225
 		lowestPrefix := GetLowestChannelModePrefix(prefixes)
1226 1226
 
@@ -1349,6 +1349,11 @@ func listHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1349 1349
 			client.RplList(channel)
1350 1350
 		}
1351 1351
 	} else {
1352
+		// limit regular users to only listing one channel
1353
+		if !client.flags[Operator] {
1354
+			channels = channels[:1]
1355
+		}
1356
+
1352 1357
 		for _, chname := range channels {
1353 1358
 			casefoldedChname, err := CasefoldChannel(chname)
1354 1359
 			channel := server.channels.Get(casefoldedChname)
@@ -1397,6 +1402,11 @@ func namesHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
1397 1402
 		return false
1398 1403
 	}
1399 1404
 
1405
+	// limit regular users to only listing one channel
1406
+	if !client.flags[Operator] {
1407
+		channels = channels[:1]
1408
+	}
1409
+
1400 1410
 	for _, chname := range channels {
1401 1411
 		casefoldedChname, err := CasefoldChannel(chname)
1402 1412
 		channel := server.channels.Get(casefoldedChname)

Loading…
Annulla
Salva