1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

keep track of address in text_dest for hilight purposes

This commit is contained in:
ailin-nemui 2015-12-28 00:07:42 +01:00
parent 787956af3a
commit 7cc85b9427
4 changed files with 10 additions and 14 deletions

View File

@ -175,7 +175,6 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
int for_me, print_channel, level; int for_me, print_channel, level;
char *nickmode, *color, *freemsg = NULL; char *nickmode, *color, *freemsg = NULL;
HILIGHT_REC *hilight; HILIGHT_REC *hilight;
int match_beg = 0, match_end = 0;
/* 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 */
@ -188,8 +187,8 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
nick_match_msg(chanrec, msg, server->nick) : nick_match_msg(chanrec, msg, server->nick) :
nick_match_msg_everywhere(chanrec, msg, server->nick); nick_match_msg_everywhere(chanrec, msg, server->nick);
hilight = for_me ? NULL : hilight = for_me ? NULL :
hilight_match(server, target, nick, address, MSGLEVEL_PUBLIC, msg, &match_beg, &match_end); hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
color = (hilight == NULL || !hilight->nick) ? NULL : hilight_get_color(hilight); 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);
@ -217,9 +216,8 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
TEXT_DEST_REC dest; TEXT_DEST_REC dest;
format_create_dest(&dest, server, target, level, NULL); format_create_dest(&dest, server, target, level, NULL);
dest.hilight = hilight; dest.address = address;
dest.match_beg = match_beg; dest.nick = nick;
dest.match_end = match_end;
if (color != NULL) { if (color != NULL) {
/* highlighted nick */ /* highlighted nick */
hilight_update_text_dest(&dest,hilight); hilight_update_text_dest(&dest,hilight);

View File

@ -416,8 +416,6 @@ void format_create_dest_tag(TEXT_DEST_REC *dest, void *server,
dest->server_tag = server != NULL ? SERVER(server)->tag : server_tag; dest->server_tag = server != NULL ? SERVER(server)->tag : server_tag;
dest->target = target; dest->target = target;
dest->level = level; dest->level = level;
dest->match_beg = 0;
dest->match_end = 0;
dest->window = window != NULL ? window : dest->window = window != NULL ? window :
window_find_closest(server, target, level); window_find_closest(server, target, level);
} }

View File

@ -52,11 +52,10 @@ typedef struct _TEXT_DEST_REC {
SERVER_REC *server; SERVER_REC *server;
const char *server_tag; /* if server is non-NULL, must be server->tag */ const char *server_tag; /* if server is non-NULL, must be server->tag */
const char *target; const char *target;
const char *nick;
const char *address;
int level; int level;
HILIGHT_REC *hilight;
int match_beg;
int match_end;
int hilight_priority; int hilight_priority;
char *hilight_color; char *hilight_color;
int flags; int flags;

View File

@ -325,9 +325,10 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
if (dest->level & MSGLEVEL_NOHILIGHT) if (dest->level & MSGLEVEL_NOHILIGHT)
return; return;
hilight_start = dest->match_beg; hilight_start = hilight_end = 0;
hilight_end = dest->match_end; hilight = hilight_match(dest->server, dest->target, dest->nick,
hilight = dest->hilight; dest->address, dest->level, stripped,
&hilight_start, &hilight_end);
if (hilight == NULL) if (hilight == NULL)
return; return;