Insert exclam on compat clients if message uses old channel syntax

This commit is contained in:
Mike Schwörer 2023-06-18 11:59:26 +02:00
parent 2fbc892898
commit b3ec45309c
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
1 changed files with 5 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import (
var rexWhitespaceStart = rext.W(regexp.MustCompile("^\\s+"))
var rexWhitespaceEnd = rext.W(regexp.MustCompile("\\s+$"))
var rexNormalizeUsername = rext.W(regexp.MustCompile("[^[:alnum:]\\-_ ]"))
var rexCompatTitleChannel = rext.W(regexp.MustCompile("^\\[(?P<channel>[A-Za-z\\-0-9_ ]+)] (?P<title>(.|\\r|\\n)+)$"))
type Application struct {
Config scn.Config
@ -380,6 +381,10 @@ func (app *Application) InsertRequestLog(data models.RequestLog) {
func (app *Application) CompatizeMessageTitle(ctx TxContext, msg models.Message) string {
if msg.ChannelInternalName == "main" {
if rexCompatTitleChannel.IsMatch(msg.Title) {
return "!" + msg.Title // channel in title ?!
}
return msg.Title
}