diff options
author | TingPing <tingping@tingping.se> | 2013-01-11 16:16:39 -0800 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2013-01-11 16:16:39 -0800 |
commit | bba00f2b66a84c49f7707ba15e4bb5bfd444a164 (patch) | |
tree | 4fd511f7445faca9587693b9d8909c6496dbdf61 /src/common | |
parent | 4a2ecc5d6c3a32b78856f2864a6dbc2ba19b1424 (diff) | |
parent | 07b69fd2f8236d05191b8ceff86db74a0509249c (diff) |
Merge pull request #373 from RichardHitt/issue372
closes Issue372 -- Fix nickname-mouseover recognition
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/url.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/common/url.c b/src/common/url.c index 0ee09988..f22da931 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -188,6 +188,16 @@ static int laststart = 0; static int lastend = 0; static int lasttype = 0; +static int +strchrs (char c, char *s) +{ + while (*s) + if (c == *s++) + return TRUE; + return FALSE; +} + +#define NICKPRE "~+!@%%&" int url_check_word (const char *word) { @@ -196,11 +206,15 @@ url_check_word (const char *word) { switch (lasttype) { + char *str; + case WORD_NICK: - if (!isalnum (word[laststart])) + if (strchrs (word[laststart], NICKPRE)) laststart++; - if (!userlist_find (current_sess, &word[laststart])) + str = g_strndup (&word[laststart], lastend - laststart); + if (!userlist_find (current_sess, str)) lasttype = 0; + g_free (str); return lasttype; case WORD_EMAIL: if (!isalnum (word[laststart])) @@ -448,7 +462,7 @@ re_email (void) } /* NICK description --- */ -#define NICKPRE "~+!@%%&" +/* For NICKPRE see before url_check_word() */ #define NICKHYP "-" #define NICKLET "a-z" #define NICKDIG "0-9" |