mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Fix HILIGHT -actcolor -mask (Bug 131)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3309 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c5982338c1
commit
fa80d4913b
@ -153,6 +153,7 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||||||
const char *nickmode, *printnick;
|
const char *nickmode, *printnick;
|
||||||
int for_me, print_channel, level;
|
int for_me, print_channel, level;
|
||||||
char *color, *freemsg = NULL;
|
char *color, *freemsg = NULL;
|
||||||
|
HILIGHT_REC *hilight;
|
||||||
|
|
||||||
/* NOTE: this may return NULL if some channel is just closed with
|
/* NOTE: this may return NULL if some channel is just closed with
|
||||||
/WINDOW CLOSE and server still sends the few last messages */
|
/WINDOW CLOSE and server still sends the few last messages */
|
||||||
@ -162,8 +163,9 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||||||
|
|
||||||
for_me = !settings_get_bool("hilight_nick_matches") ? FALSE :
|
for_me = !settings_get_bool("hilight_nick_matches") ? FALSE :
|
||||||
nick_match_msg(chanrec, msg, server->nick);
|
nick_match_msg(chanrec, msg, server->nick);
|
||||||
color = for_me ? NULL :
|
hilight = for_me ? NULL :
|
||||||
hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
|
hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
|
||||||
|
color = (hilight == NULL) ? NULL : hilight_get_color(hilight);
|
||||||
|
|
||||||
print_channel = chanrec == NULL ||
|
print_channel = chanrec == NULL ||
|
||||||
!window_item_is_active((WI_ITEM_REC *) chanrec);
|
!window_item_is_active((WI_ITEM_REC *) chanrec);
|
||||||
@ -172,7 +174,7 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||||||
print_channel = TRUE;
|
print_channel = TRUE;
|
||||||
|
|
||||||
level = MSGLEVEL_PUBLIC;
|
level = MSGLEVEL_PUBLIC;
|
||||||
if (for_me || color != NULL)
|
if (for_me)
|
||||||
level |= MSGLEVEL_HILIGHT;
|
level |= MSGLEVEL_HILIGHT;
|
||||||
|
|
||||||
if (settings_get_bool("emphasis"))
|
if (settings_get_bool("emphasis"))
|
||||||
@ -186,34 +188,31 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||||||
if (printnick == NULL)
|
if (printnick == NULL)
|
||||||
printnick = nick;
|
printnick = nick;
|
||||||
|
|
||||||
if (!print_channel) {
|
if (color != NULL) {
|
||||||
/* message to active channel in window */
|
/* highlighted nick */
|
||||||
if (color != NULL) {
|
TEXT_DEST_REC dest;
|
||||||
/* highlighted nick */
|
format_create_dest(&dest, server, target, level, NULL);
|
||||||
printformat(server, target, level,
|
hilight_update_text_dest(&dest,hilight);
|
||||||
TXT_PUBMSG_HILIGHT,
|
if (!print_channel) /* message to active channel in window */
|
||||||
color, printnick, msg, nickmode);
|
printformat_dest(&dest, TXT_PUBMSG_HILIGHT, color,
|
||||||
} else {
|
printnick, msg, nickmode);
|
||||||
|
else /* message to not existing/active channel */
|
||||||
|
printformat_dest(&dest, TXT_PUBMSG_HILIGHT_CHANNEL,
|
||||||
|
color, printnick, target, msg,
|
||||||
|
nickmode);
|
||||||
|
} else {
|
||||||
|
if (!print_channel)
|
||||||
printformat(server, target, level,
|
printformat(server, target, level,
|
||||||
for_me ? TXT_PUBMSG_ME : TXT_PUBMSG,
|
for_me ? TXT_PUBMSG_ME : TXT_PUBMSG,
|
||||||
printnick, msg, nickmode);
|
printnick, msg, nickmode);
|
||||||
}
|
else
|
||||||
} else {
|
|
||||||
/* message to not existing/active channel */
|
|
||||||
if (color != NULL) {
|
|
||||||
/* highlighted nick */
|
|
||||||
printformat(server, target, level,
|
|
||||||
TXT_PUBMSG_HILIGHT_CHANNEL,
|
|
||||||
color, printnick, target, msg, nickmode);
|
|
||||||
} else {
|
|
||||||
printformat(server, target, level,
|
printformat(server, target, level,
|
||||||
for_me ? TXT_PUBMSG_ME_CHANNEL :
|
for_me ? TXT_PUBMSG_ME_CHANNEL :
|
||||||
TXT_PUBMSG_CHANNEL,
|
TXT_PUBMSG_CHANNEL,
|
||||||
printnick, target, msg, nickmode);
|
printnick, target, msg, nickmode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
g_free_not_null(freemsg);
|
g_free_not_null(freemsg);
|
||||||
g_free_not_null(color);
|
g_free_not_null(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ static char *hilight_get_act_color(HILIGHT_REC *rec)
|
|||||||
settings_get_str("hilight_act_color"));
|
settings_get_str("hilight_act_color"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *hilight_get_color(HILIGHT_REC *rec)
|
char *hilight_get_color(HILIGHT_REC *rec)
|
||||||
{
|
{
|
||||||
const char *color;
|
const char *color;
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ static char *hilight_get_color(HILIGHT_REC *rec)
|
|||||||
return format_string_expand(color, NULL);
|
return format_string_expand(color, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec)
|
void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec)
|
||||||
{
|
{
|
||||||
dest->level |= MSGLEVEL_HILIGHT;
|
dest->level |= MSGLEVEL_HILIGHT;
|
||||||
|
|
||||||
@ -305,6 +305,8 @@ static void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec)
|
|||||||
dest->hilight_color = hilight_get_act_color(rec);
|
dest->hilight_color = hilight_get_act_color(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hilight_print(int index, HILIGHT_REC *rec);
|
||||||
|
|
||||||
static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
|
static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
|
||||||
const char *stripped)
|
const char *stripped)
|
||||||
{
|
{
|
||||||
@ -398,19 +400,15 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
|
|||||||
signal_stop();
|
signal_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *hilight_match_nick(SERVER_REC *server, const char *channel,
|
HILIGHT_REC *hilight_match_nick(SERVER_REC *server, const char *channel,
|
||||||
const char *nick, const char *address,
|
const char *nick, const char *address,
|
||||||
int level, const char *msg)
|
int level, const char *msg)
|
||||||
{
|
{
|
||||||
HILIGHT_REC *rec;
|
HILIGHT_REC *rec;
|
||||||
char *color;
|
|
||||||
|
|
||||||
rec = hilight_match(server, channel, nick, address,
|
rec = hilight_match(server, channel, nick, address,
|
||||||
level, msg, NULL, NULL);
|
level, msg, NULL, NULL);
|
||||||
color = rec == NULL || !rec->nick ? NULL :
|
return (rec == NULL || !rec->nick) ? NULL : rec;
|
||||||
hilight_get_color(rec);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_hilight_config(void)
|
static void read_hilight_config(void)
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
# include <regex.h>
|
# include <regex.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "formats.h"
|
||||||
|
|
||||||
typedef struct _HILIGHT_REC HILIGHT_REC;
|
typedef struct _HILIGHT_REC HILIGHT_REC;
|
||||||
|
|
||||||
struct _HILIGHT_REC {
|
struct _HILIGHT_REC {
|
||||||
@ -36,9 +38,12 @@ HILIGHT_REC *hilight_match(SERVER_REC *server, const char *channel,
|
|||||||
int level, const char *str,
|
int level, const char *str,
|
||||||
int *match_beg, int *match_end);
|
int *match_beg, int *match_end);
|
||||||
|
|
||||||
char *hilight_match_nick(SERVER_REC *server, const char *channel,
|
HILIGHT_REC *hilight_match_nick(SERVER_REC *server, const char *channel,
|
||||||
const char *nick, const char *address,
|
const char *nick, const char *address,
|
||||||
int level, const char *msg);
|
int level, const char *msg);
|
||||||
|
|
||||||
|
char *hilight_get_color(HILIGHT_REC *rec);
|
||||||
|
void hilight_update_text_dest(TEXT_DEST_REC *dest, HILIGHT_REC *rec);
|
||||||
|
|
||||||
void hilight_create(HILIGHT_REC *rec);
|
void hilight_create(HILIGHT_REC *rec);
|
||||||
void hilight_remove(HILIGHT_REC *rec);
|
void hilight_remove(HILIGHT_REC *rec);
|
||||||
|
Loading…
Reference in New Issue
Block a user