Browse Source

fix truncation check

* The message target was not being counted :-(
* The additional character added to the target by STATUSMSG was not counted
tags/v2.14.0-rc2
Shivaram Lingamneni 2 weeks ago
parent
commit
0b333c7e72
2 changed files with 6 additions and 5 deletions
  1. 5
    5
      irc/channel.go
  2. 1
    0
      irc/handlers.go

+ 5
- 5
irc/channel.go View File

@@ -1320,6 +1320,11 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
1320 1320
 	isBot := client.HasMode(modes.Bot)
1321 1321
 	chname := channel.Name()
1322 1322
 
1323
+	// STATUSMSG targets are prefixed with the supplied min-prefix, e.g., @#channel
1324
+	if minPrefixMode != modes.Mode(0) {
1325
+		chname = fmt.Sprintf("%s%s", modes.ChannelModePrefixes[minPrefixMode], chname)
1326
+	}
1327
+
1323 1328
 	if !client.server.Config().Server.Compatibility.allowTruncation {
1324 1329
 		if !validateSplitMessageLen(histType, details.nickMask, chname, message) {
1325 1330
 			rb.Add(nil, client.server.name, ERR_INPUTTOOLONG, details.nick, client.t("Line too long to be relayed without truncation"))
@@ -1327,11 +1332,6 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
1327 1332
 		}
1328 1333
 	}
1329 1334
 
1330
-	// STATUSMSG targets are prefixed with the supplied min-prefix, e.g., @#channel
1331
-	if minPrefixMode != modes.Mode(0) {
1332
-		chname = fmt.Sprintf("%s%s", modes.ChannelModePrefixes[minPrefixMode], chname)
1333
-	}
1334
-
1335 1335
 	if channel.flags.HasMode(modes.OpModerated) {
1336 1336
 		channel.stateMutex.RLock()
1337 1337
 		cuData, ok := channel.members[client]

+ 1
- 0
irc/handlers.go View File

@@ -2184,6 +2184,7 @@ func validateLineLen(msgType history.ItemType, source, target, payload string) (
2184 2184
 	default:
2185 2185
 		return true
2186 2186
 	}
2187
+	limit -= len(target)
2187 2188
 	limit -= len(payload)
2188 2189
 	return limit >= 0
2189 2190
 }

Loading…
Cancel
Save