mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
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
This commit is contained in:
parent
ab0c12b74c
commit
078a10900f
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user