Summary: | Problem with message highlighting and a '|' in nickname | ||
---|---|---|---|
Product: | ksirc | Reporter: | Steffen Weber <steffen.weber> |
Component: | general | Assignee: | Andrew Stanley-Jones <asj> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Steffen Weber
2003-04-25 20:19:39 UTC
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()); |