mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #303 from vague666/fs275
Applied patch from fs#275 to make /hilight -mask -line work properly
This commit is contained in:
commit
074af68578
@ -175,6 +175,7 @@ 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 */
|
||||||
@ -187,8 +188,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_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
|
hilight_match(server, target, nick, address, MSGLEVEL_PUBLIC, msg, &match_beg, &match_end);
|
||||||
color = (hilight == NULL) ? NULL : hilight_get_color(hilight);
|
color = (hilight == NULL || !hilight->nick) ? 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);
|
||||||
@ -214,10 +215,13 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||||||
if (printnick == NULL)
|
if (printnick == NULL)
|
||||||
printnick = nick;
|
printnick = nick;
|
||||||
|
|
||||||
|
TEXT_DEST_REC dest;
|
||||||
|
format_create_dest(&dest, server, target, level, NULL);
|
||||||
|
dest.hilight = hilight;
|
||||||
|
dest.match_beg = match_beg;
|
||||||
|
dest.match_end = match_end;
|
||||||
if (color != NULL) {
|
if (color != NULL) {
|
||||||
/* highlighted nick */
|
/* highlighted nick */
|
||||||
TEXT_DEST_REC dest;
|
|
||||||
format_create_dest(&dest, server, target, level, NULL);
|
|
||||||
hilight_update_text_dest(&dest,hilight);
|
hilight_update_text_dest(&dest,hilight);
|
||||||
if (!print_channel) /* message to active channel in window */
|
if (!print_channel) /* message to active channel in window */
|
||||||
printformat_dest(&dest, TXT_PUBMSG_HILIGHT, color,
|
printformat_dest(&dest, TXT_PUBMSG_HILIGHT, color,
|
||||||
@ -228,11 +232,11 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||||||
nickmode);
|
nickmode);
|
||||||
} else {
|
} else {
|
||||||
if (!print_channel)
|
if (!print_channel)
|
||||||
printformat(server, target, level,
|
printformat_dest(&dest,
|
||||||
for_me ? TXT_PUBMSG_ME : TXT_PUBMSG,
|
for_me ? TXT_PUBMSG_ME : TXT_PUBMSG,
|
||||||
printnick, msg, nickmode);
|
printnick, msg, nickmode);
|
||||||
else
|
else
|
||||||
printformat(server, target, level,
|
printformat_dest(&dest,
|
||||||
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);
|
||||||
|
@ -416,6 +416,8 @@ 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);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,9 @@ struct _FORMAT_REC {
|
|||||||
#define PRINT_FLAG_SET_SERVERTAG 0x0010
|
#define PRINT_FLAG_SET_SERVERTAG 0x0010
|
||||||
#define PRINT_FLAG_UNSET_SERVERTAG 0x0020
|
#define PRINT_FLAG_UNSET_SERVERTAG 0x0020
|
||||||
|
|
||||||
|
// FIXME: sould use better
|
||||||
|
typedef struct _HILIGHT_REC HILIGHT_REC;
|
||||||
|
|
||||||
typedef struct _TEXT_DEST_REC {
|
typedef struct _TEXT_DEST_REC {
|
||||||
WINDOW_REC *window;
|
WINDOW_REC *window;
|
||||||
SERVER_REC *server;
|
SERVER_REC *server;
|
||||||
@ -52,6 +55,9 @@ typedef struct _TEXT_DEST_REC {
|
|||||||
const char *target;
|
const char *target;
|
||||||
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;
|
||||||
|
@ -325,11 +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 = hilight_end = 0;
|
hilight_start = dest->match_beg;
|
||||||
hilight = hilight_match(dest->server, dest->target,
|
hilight_end = dest->match_end;
|
||||||
NULL, NULL, dest->level, stripped,
|
hilight = dest->hilight;
|
||||||
&hilight_start,
|
|
||||||
&hilight_end);
|
|
||||||
if (hilight == NULL)
|
if (hilight == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "formats.h"
|
#include "formats.h"
|
||||||
|
|
||||||
typedef struct _HILIGHT_REC HILIGHT_REC;
|
//typedef struct _HILIGHT_REC HILIGHT_REC;
|
||||||
|
|
||||||
struct _HILIGHT_REC {
|
struct _HILIGHT_REC {
|
||||||
char *text;
|
char *text;
|
||||||
|
Loading…
Reference in New Issue
Block a user