From b3ec45309ce117648896c3575e484a4ac43ec122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Sun, 18 Jun 2023 11:59:26 +0200 Subject: [PATCH] Insert exclam on compat clients if message uses old channel syntax --- scnserver/logic/application.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scnserver/logic/application.go b/scnserver/logic/application.go index 53c7a4a..cacab72 100644 --- a/scnserver/logic/application.go +++ b/scnserver/logic/application.go @@ -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[A-Za-z\\-0-9_ ]+)] (?P(.|\\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 }