summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWouter Coekaerts <coekie@irssi.org>2005-03-07 14:17:07 +0000
committercoekie <coekie@dbcabf3a-b0e7-0310-adc4-f8d773084564>2005-03-07 14:17:07 +0000
commitbfb951d3bed0c7f6ee20fb1be61184aeaf4bea6c (patch)
tree3d79d60999ecedb5552dcb4193887f5fd8094203
parent8ec7c164d6bdd5700f01f286aef9b9f48473aa48 (diff)
downloadirssi-bfb951d3bed0c7f6ee20fb1be61184aeaf4bea6c.zip
Don't apply emphasis on _foo_^ if it's a nick (Bug 52)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3720 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-common/core/fe-messages.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c
index 41199d66..aa1ead32 100644
--- a/src/fe-common/core/fe-messages.c
+++ b/src/fe-common/core/fe-messages.c
@@ -39,6 +39,10 @@
#include "printtext.h"
#define ishighalnum(c) ((unsigned char) (c) >= 128 || i_isalnum(c))
+#define isnickchar(a) \
+ (i_isalnum(a) || (a) == '`' || (a) == '-' || (a) == '_' || \
+ (a) == '[' || (a) == ']' || (a) == '{' || (a) == '}' || \
+ (a) == '|' || (a) == '\\' || (a) == '^')
GHashTable *printnicks;
@@ -81,12 +85,25 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text)
use emphasis on them. */
int found;
char c;
+ char *end2;
+ /* check if _foo_ is a nick */
c = end[1];
end[1] = '\0';
found = nicklist_find(CHANNEL(item), bgn) != NULL;
end[1] = c;
if (found) continue;
+
+ /* check if the whole 'word' (e.g. "_foo_^") is a nick
+ in "_foo_^ ", end will be the second _, end2 the ^ */
+ end2 = end;
+ while (isnickchar(end2[1]))
+ end2++;
+ c = end2[1];
+ end2[1] = '\0';
+ found = nicklist_find(CHANNEL(item), bgn) != NULL;
+ end2[1] = c;
+ if (found) continue;
}
/* allow only *word* emphasis, not *multiple words* */