common: strip format codes for Message ignores
authorShane Synan <digitalcircuit36939@gmail.com>
Thu, 27 May 2021 21:45:04 +0000 (17:45 -0400)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 22 Jun 2021 20:03:02 +0000 (22:03 +0200)
commit3144d9c1f06a6b0dcb0f19d0375ec2c082dab82a
tree6842daf0be329fdf2530695aeb50a15fa3ee8ab0
parent9833654a203520941eb4053b6c0874453bcc7a74
common: strip format codes for Message ignores

Strip IRC formatting codes from the message for ignore rules that
match on Message contents.

Pros:
* Easier to set ignore rules for rainbow-messages or other format spam
* Consistent with highlight rules/highlight ignore rules
Cons:
* Not possible to ignore messages matching a specific format pattern
* Breaks existing ignores written to handle mid-message format codes

Alternative: make it a setting!  Requires protocol changes, new
strings - would need to be after 0.14.

NOTE: This impacts both the client and the core.  Mismatching
client/core versions will result in different behavior for ignoring
messages with formatting codes inside the ignore rule itself.

Example:
The following message contains color codes...

I love ^3IRC! ^It is the ^7best protocol ever!
(Borrowed from https://modern.ircdocs.horse/formatting.html#examples )

If someone previously created a regular expression ignore rule for...

"I love ...IRC"
("." is the regular expression replacement character)

...the ignore rule will need updated to remove the "..." as the
formatting codes are no longer part of the match.

Instead, the Message portion of the ignore rule would become...

"I love IRC"
src/common/ignorelistmanager.cpp