Browse Source

server: Support more RPL_ISUPPORT stuff

tags/v0.4.0
Daniel Oaks 7 years ago
parent
commit
f62ffe006f
2 changed files with 18 additions and 7 deletions
  1. 1
    0
      CHANGELOG.md
  2. 17
    7
      irc/server.go

+ 1
- 0
CHANGELOG.md View File

13
 * Added operator classes, allowing for more finely-grained permissions for operators.
13
 * Added operator classes, allowing for more finely-grained permissions for operators.
14
 * Added automatic client connection limiting, similar to other IRCds.
14
 * Added automatic client connection limiting, similar to other IRCds.
15
 * Length of channel mode lists (ban / ban-except / invite-except) is now restricted to the limit in config.
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
 * Added support for IRCv3 capability [`chghost`](http://ircv3.net/specs/extensions/chghost-3.2.html).
17
 * Added support for IRCv3 capability [`chghost`](http://ircv3.net/specs/extensions/chghost-3.2.html).
17
 
18
 
18
 ### Changed
19
 ### Changed

+ 17
- 7
irc/server.go View File

269
 	server.isupport.Add("INVEX", "")
269
 	server.isupport.Add("INVEX", "")
270
 	server.isupport.Add("KICKLEN", strconv.Itoa(server.limits.KickLen))
270
 	server.isupport.Add("KICKLEN", strconv.Itoa(server.limits.KickLen))
271
 	server.isupport.Add("MAXLIST", fmt.Sprintf("beI:%s", strconv.Itoa(server.limits.ChanListModes)))
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
 	server.isupport.Add("MONITOR", strconv.Itoa(server.limits.MonitorEntries))
274
 	server.isupport.Add("MONITOR", strconv.Itoa(server.limits.MonitorEntries))
274
 	server.isupport.Add("NETWORK", server.networkName)
275
 	server.isupport.Add("NETWORK", server.networkName)
275
 	server.isupport.Add("NICKLEN", strconv.Itoa(server.limits.NickLen))
276
 	server.isupport.Add("NICKLEN", strconv.Itoa(server.limits.NickLen))
276
 	server.isupport.Add("PREFIX", "(qaohv)~&@%+")
277
 	server.isupport.Add("PREFIX", "(qaohv)~&@%+")
277
 	server.isupport.Add("STATUSMSG", "~&@%+")
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
 	server.isupport.Add("TOPICLEN", strconv.Itoa(server.limits.TopicLen))
280
 	server.isupport.Add("TOPICLEN", strconv.Itoa(server.limits.TopicLen))
280
 
281
 
281
 	// account registration
282
 	// account registration
739
 	targets := strings.Split(msg.Params[0], ",")
740
 	targets := strings.Split(msg.Params[0], ",")
740
 	message := msg.Params[1]
741
 	message := msg.Params[1]
741
 
742
 
742
-	for _, targetString := range targets {
743
+	for _, targetString := range targets[:4] {
743
 		prefixes, targetString := SplitChannelMembershipPrefixes(targetString)
744
 		prefixes, targetString := SplitChannelMembershipPrefixes(targetString)
744
 		lowestPrefix := GetLowestChannelModePrefix(prefixes)
745
 		lowestPrefix := GetLowestChannelModePrefix(prefixes)
745
 
746
 
819
 			}
820
 			}
820
 		}
821
 		}
821
 	} else {
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
 		mclient := server.clients.Get(casefoldedMask)
825
 		mclient := server.clients.Get(casefoldedMask)
826
 		if err != nil || mclient == nil {
826
 		if err != nil || mclient == nil {
827
 			client.Send(nil, client.server.name, ERR_NOSUCHNICK, masksString, "No such nick")
827
 			client.Send(nil, client.server.name, ERR_NOSUCHNICK, masksString, "No such nick")
1220
 	targets := strings.Split(msg.Params[0], ",")
1220
 	targets := strings.Split(msg.Params[0], ",")
1221
 	message := msg.Params[1]
1221
 	message := msg.Params[1]
1222
 
1222
 
1223
-	for _, targetString := range targets {
1223
+	for _, targetString := range targets[:4] {
1224
 		prefixes, targetString := SplitChannelMembershipPrefixes(targetString)
1224
 		prefixes, targetString := SplitChannelMembershipPrefixes(targetString)
1225
 		lowestPrefix := GetLowestChannelModePrefix(prefixes)
1225
 		lowestPrefix := GetLowestChannelModePrefix(prefixes)
1226
 
1226
 
1349
 			client.RplList(channel)
1349
 			client.RplList(channel)
1350
 		}
1350
 		}
1351
 	} else {
1351
 	} else {
1352
+		// limit regular users to only listing one channel
1353
+		if !client.flags[Operator] {
1354
+			channels = channels[:1]
1355
+		}
1356
+
1352
 		for _, chname := range channels {
1357
 		for _, chname := range channels {
1353
 			casefoldedChname, err := CasefoldChannel(chname)
1358
 			casefoldedChname, err := CasefoldChannel(chname)
1354
 			channel := server.channels.Get(casefoldedChname)
1359
 			channel := server.channels.Get(casefoldedChname)
1397
 		return false
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
 	for _, chname := range channels {
1410
 	for _, chname := range channels {
1401
 		casefoldedChname, err := CasefoldChannel(chname)
1411
 		casefoldedChname, err := CasefoldChannel(chname)
1402
 		channel := server.channels.Get(casefoldedChname)
1412
 		channel := server.channels.Get(casefoldedChname)

Loading…
Cancel
Save