Skip to content

Commit

Permalink
Fix splitting of lines for ACTIONs (#499)
Browse files Browse the repository at this point in the history
An action with less than the length of prefix gets split on multiple
lines and causes "unknown CTCP ACTION".
  • Loading branch information
hloeung authored Nov 8, 2022
1 parent 9919550 commit ecdb3bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm-go-irckit/userbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ func (u *User) handleMessageThreadContext(channelID, messageID, parentID, event,
case u.v.GetBool(u.br.Protocol()+".prefixcontext") && strings.HasPrefix(text, "\x01"):
prefix = u.prefixContext(channelID, messageID, parentID, event) + " "
newText = strings.Replace(text, "\x01ACTION ", "\x01ACTION "+prefix, 1)
maxlen = len(text)
maxlen = len(newText)
case u.v.GetBool(u.br.Protocol()+".prefixcontext") && u.v.GetBool(u.br.Protocol()+".showcontextmulti"):
prefix = u.prefixContext(channelID, messageID, parentID, event) + " "
newText = text
Expand All @@ -1209,6 +1209,7 @@ func (u *User) handleMessageThreadContext(channelID, messageID, parentID, event,
case u.v.GetBool(u.br.Protocol()+".suffixcontext") && strings.HasSuffix(text, "\x01"):
suffix = " " + u.prefixContext(channelID, messageID, parentID, event)
newText = strings.Replace(text, " \x01", suffix+" \x01", 1)
maxlen = len(newText)
case u.v.GetBool(u.br.Protocol()+".suffixcontext") && u.v.GetBool(u.br.Protocol()+".showcontextmulti"):
suffix = " " + u.prefixContext(channelID, messageID, parentID, event)
newText = text
Expand Down

0 comments on commit ecdb3bd

Please sign in to comment.