diff options
author | Timo Sirainen <cras@irssi.org> | 2001-01-01 04:22:31 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-01-01 04:22:31 +0000 |
commit | 078a10900f31ec23a10a0e4a589760fb51ccf1cb (patch) | |
tree | 494f015f6e5f50e3ad6644d1b9d3713178db329c | |
parent | ab0c12b74c70caf3b5d49a36fd3e9c2c1b5bacd2 (diff) | |
download | irssi-078a10900f31ec23a10a0e4a589760fb51ccf1cb.zip |
don't do emphasis on nicks in channel (<nick1> _nick2_: hello won't underline)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1032 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/fe-common/core/fe-messages.c | 22 | ||||
-rw-r--r-- | src/fe-common/core/fe-messages.h | 2 | ||||
-rw-r--r-- | src/fe-common/irc/dcc/fe-dcc.c | 11 |
3 files changed, 26 insertions, 9 deletions
diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c index 86417c64..b994fe5c 100644 --- a/src/fe-common/core/fe-messages.c +++ b/src/fe-common/core/fe-messages.c @@ -39,7 +39,7 @@ /* convert _underlined_ and *bold* words (and phrases) to use real underlining or bolding */ -char *expand_emphasis(const char *text) +char *expand_emphasis(WI_ITEM_REC *item, const char *text) { GString *str; char *ret; @@ -71,6 +71,19 @@ char *expand_emphasis(const char *text) isalnum(end[1]) || end[1] == type) continue; + if (IS_CHANNEL(item)) { + /* check that this isn't a _nick_, we don't want to + use emphasis on them. */ + int found; + char c; + + c = end[1]; + end[1] = '\0'; + found = nicklist_find(CHANNEL(item), bgn) != NULL; + end[1] = c; + if (found) continue; + } + /* allow only *word* emphasis, not *multiple words* */ if (!settings_get_bool("emphasis_multiword")) { char *c; @@ -141,7 +154,7 @@ static void sig_message_public(SERVER_REC *server, const char *msg, MSGLEVEL_HILIGHT : MSGLEVEL_NOHILIGHT); if (settings_get_bool("emphasis")) - msg = freemsg = expand_emphasis(msg); + msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg); else freemsg = NULL; @@ -183,12 +196,13 @@ static void sig_message_private(SERVER_REC *server, const char *msg, QUERY_REC *query; char *freemsg; + query = query_find(server, nick); + if (settings_get_bool("emphasis")) - msg = freemsg = expand_emphasis(msg); + msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg); else freemsg = NULL; - query = query_find(server, nick); printformat(server, nick, MSGLEVEL_MSGS, query == NULL ? IRCTXT_MSG_PRIVATE : IRCTXT_MSG_PRIVATE_QUERY, nick, address, msg); diff --git a/src/fe-common/core/fe-messages.h b/src/fe-common/core/fe-messages.h index c277840f..16b0b73d 100644 --- a/src/fe-common/core/fe-messages.h +++ b/src/fe-common/core/fe-messages.h @@ -3,6 +3,6 @@ /* convert _underlined_ and *bold* words (and phrases) to use real underlining or bolding */ -char *expand_emphasis(const char *text); +char *expand_emphasis(WI_ITEM_REC *item, const char *text); #endif diff --git a/src/fe-common/irc/dcc/fe-dcc.c b/src/fe-common/irc/dcc/fe-dcc.c index 0bdfd909..6d3eef73 100644 --- a/src/fe-common/irc/dcc/fe-dcc.c +++ b/src/fe-common/irc/dcc/fe-dcc.c @@ -143,22 +143,25 @@ static void dcc_chat_ctcp(const char *msg, DCC_REC *dcc) static void dcc_chat_msg(DCC_REC *dcc, const char *msg) { + QUERY_REC *query; char *sender, *freemsg; g_return_if_fail(dcc != NULL); g_return_if_fail(msg != NULL); + sender = g_strconcat("=", dcc->nick, NULL); + query = query_find(NULL, sender); + if (settings_get_bool("emphasis")) - msg = freemsg = expand_emphasis(msg); + msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg); else freemsg = NULL; - sender = g_strconcat("=", dcc->nick, NULL); printformat(NULL, sender, MSGLEVEL_DCCMSGS, - query_find(NULL, sender) ? IRCTXT_DCC_MSG_QUERY : + query != NULL ? IRCTXT_DCC_MSG_QUERY : IRCTXT_DCC_MSG, dcc->nick, msg); - g_free(sender); g_free_not_null(freemsg); + g_free(sender); } static void dcc_request(DCC_REC *dcc) |