mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 12:53:42 +02:00
Lots of /HILIGHT changes. You can use color names with -color. Window
numbers are colored with the highlight color in activity statusbar item. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@398 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
5da58d5849
commit
e90cdaf4ca
10 changed files with 145 additions and 26 deletions
|
|
@ -61,15 +61,18 @@ void fe_ignore_deinit(void);
|
|||
void fe_query_init(void);
|
||||
void fe_query_deinit(void);
|
||||
|
||||
void irc_window_activity_init(void);
|
||||
void irc_window_activity_deinit(void);
|
||||
|
||||
void irc_completion_init(void);
|
||||
void irc_completion_deinit(void);
|
||||
|
||||
void fe_netsplit_init(void);
|
||||
void fe_netsplit_deinit(void);
|
||||
|
||||
void irc_hilight_text_init(void);
|
||||
void irc_hilight_text_deinit(void);
|
||||
|
||||
void irc_window_activity_init(void);
|
||||
void irc_window_activity_deinit(void);
|
||||
|
||||
static char *autocon_server;
|
||||
static char *autocon_password;
|
||||
static int autocon_port;
|
||||
|
|
@ -115,6 +118,7 @@ void fe_common_irc_init(void)
|
|||
fe_netsplit_init();
|
||||
fe_query_init();
|
||||
irc_completion_init();
|
||||
irc_hilight_text_init();
|
||||
irc_window_activity_init();
|
||||
|
||||
fe_irc_modules_init();
|
||||
|
|
@ -135,6 +139,7 @@ void fe_common_irc_deinit(void)
|
|||
fe_netsplit_deinit();
|
||||
fe_query_deinit();
|
||||
irc_completion_deinit();
|
||||
irc_hilight_text_deinit();
|
||||
irc_window_activity_deinit();
|
||||
|
||||
theme_unregister();
|
||||
|
|
|
|||
|
|
@ -19,10 +19,13 @@
|
|||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "hilight-text.h"
|
||||
|
||||
static int last_color;
|
||||
|
||||
char *irc_hilight_find_nick(const char *channel, const char *nick,
|
||||
const char *address, int level, const char *msg)
|
||||
{
|
||||
|
|
@ -32,6 +35,28 @@ char *irc_hilight_find_nick(const char *channel, const char *nick,
|
|||
color = hilight_match(channel, mask, level, msg);
|
||||
g_free(mask);
|
||||
|
||||
last_color = (color != NULL && *color == 3) ?
|
||||
atoi(color+1) : 0;
|
||||
return color;
|
||||
}
|
||||
|
||||
int irc_hilight_last_color(void)
|
||||
{
|
||||
return last_color;
|
||||
}
|
||||
|
||||
static void event_privmsg(void)
|
||||
{
|
||||
last_color = 0;
|
||||
}
|
||||
|
||||
void irc_hilight_text_init(void)
|
||||
{
|
||||
last_color = 0;
|
||||
signal_add_last("event privmsg", (SIGNAL_FUNC) event_privmsg);
|
||||
}
|
||||
|
||||
void irc_hilight_text_deinit(void)
|
||||
{
|
||||
signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,6 @@
|
|||
char *irc_hilight_find_nick(const char *channel, const char *nick,
|
||||
const char *address, int level, const char *msg);
|
||||
|
||||
int irc_hilight_last_color(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "completion.h"
|
||||
#include "windows.h"
|
||||
#include "window-items.h"
|
||||
#include "irc-hilight-text.h"
|
||||
|
||||
static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr)
|
||||
{
|
||||
|
|
@ -53,9 +54,10 @@ static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char *
|
|||
that it didn't get ignored */
|
||||
if (window != active_win && !ignore_check(server, nick, addr, target, msg, level)) {
|
||||
/* hilight */
|
||||
level = !ischannel(*target) ||
|
||||
item->last_color = irc_hilight_last_color();
|
||||
level = item->last_color > 0 || !ischannel(*target) ||
|
||||
irc_nick_match(server->nick, msg) ?
|
||||
NEWDATA_MSG_FORYOU : NEWDATA_MSG;
|
||||
NEWDATA_HILIGHT : NEWDATA_MSG;
|
||||
if (item != NULL && item->new_data < level) {
|
||||
item->new_data = level;
|
||||
signal_emit("window item hilight", 1, item);
|
||||
|
|
@ -64,6 +66,7 @@ static void event_privmsg(const char *data, IRC_SERVER_REC *server, const char *
|
|||
|
||||
if (window->new_data < level) {
|
||||
window->new_data = level;
|
||||
window->last_color = irc_hilight_last_color();
|
||||
signal_emit("window hilight", 2, window, GINT_TO_POINTER(oldlevel));
|
||||
}
|
||||
signal_emit("window activity", 2, window, GINT_TO_POINTER(oldlevel));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue