Version: (using KDE Devel) Installed from: Compiled sources Compiler: GCC 3.2.2 OS: Linux I've got a '|' in my nickname and messages are highlighted if either the part of my nick left to the '|' _or_ the part right to the '|' are mentioned by someone, although a message should only be highlighted if my complete nickname is in the message. Might this be because a | means "or" in regular expressions?
Correction: A message is only highlighted if the part left to the '|' is in it. The part on the right side does not seem to have any effect.
This happens with for nicks with \ in them. \s \S \w \W result in interesting messages. I was looking at this this morning and should have it fixed soon in HEAD. is . legal in nicks?
When I try to do "/nick MyNick." the dot is cut, but I don't know whether teh server or KSirc does this so, so maybe this doesn't answer your question. While looking through the IRC RFC I was not able to find any information regarding this issue. :-(
Subject: kdenetwork/ksirc CVS commit by asj: Cleans up nick regex so we escape regex characters that can be used in nicks. Like say \ | etc. CCMAIL: 57715-done@bugs.kde.org M +11 -0 baserules.cpp 1.21 --- kdenetwork/ksirc/baserules.cpp #1.20:1.21 @@ -81,4 +81,15 @@ filterRuleList *KSMBaseRules::defaultRul nick.truncate( 83 ); } + /* + * Since the nick is used in the regex we must + * escape all regex words + */ + nick.replace("\\", "\\\\"); + nick.replace("|", "\\|"); + nick.replace("^", "\\^"); + nick.replace("{", "\\{"); + nick.replace("}", "\\}"); + nick.replace("[", "\\["); + nick.replace("]", "\\]"); sprintf(match_us, "(?i)<\\S+>.*\\s%s(,.*|\02:.*|:.*|\\s.*|$)", nick.latin1());
Subject: kdenetwork/ksirc CVS commit by asj: frerich suggested a much better approach CCMAIL: 57715@bugs.kde.org M +4 -7 baserules.cpp 1.22 --- kdenetwork/ksirc/baserules.cpp #1.21:1.22 @@ -4,4 +4,6 @@ #include "ksircprocess.h" +#include <qregexp.h> + #include <stdio.h> @@ -85,11 +87,6 @@ filterRuleList *KSMBaseRules::defaultRul * escape all regex words */ - nick.replace("\\", "\\\\"); - nick.replace("|", "\\|"); - nick.replace("^", "\\^"); - nick.replace("{", "\\{"); - nick.replace("}", "\\}"); - nick.replace("[", "\\["); - nick.replace("]", "\\]"); + nick = QRegExp::escape(nick); + sprintf(match_us, "(?i)<\\S+>.*\\s%s(,.*|\02:.*|:.*|\\s.*|$)", nick.latin1());