mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
removed "print text stripped" signal, the stripped text is now sent in
"print text" signal's third parameter git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1526 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
04cb7cfa23
commit
28899856a4
@ -254,8 +254,7 @@ keyboard.c:
|
|||||||
"keyinfo destroyed", KEYINFO_REC
|
"keyinfo destroyed", KEYINFO_REC
|
||||||
|
|
||||||
printtext.c:
|
printtext.c:
|
||||||
"print text", TEXT_DEST_REC *dest, char *text
|
"print text", TEXT_DEST_REC *dest, char *text, char *stripped
|
||||||
"print text stripped", TEXT_DEST_REC *dest, char *text
|
|
||||||
|
|
||||||
themes.c:
|
themes.c:
|
||||||
"theme created", THEME_REC
|
"theme created", THEME_REC
|
||||||
|
@ -170,7 +170,6 @@ static void event_command(const char *data)
|
|||||||
hide_output = TRUE;
|
hide_output = TRUE;
|
||||||
signal_add_first("print starting", (SIGNAL_FUNC) sig_stop);
|
signal_add_first("print starting", (SIGNAL_FUNC) sig_stop);
|
||||||
signal_add_first("print format", (SIGNAL_FUNC) sig_stop);
|
signal_add_first("print format", (SIGNAL_FUNC) sig_stop);
|
||||||
signal_add_first("print text stripped", (SIGNAL_FUNC) sig_stop);
|
|
||||||
signal_add_first("print text", (SIGNAL_FUNC) sig_stop);
|
signal_add_first("print text", (SIGNAL_FUNC) sig_stop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,7 +180,6 @@ static void event_command_last(const char *data)
|
|||||||
hide_output = FALSE;
|
hide_output = FALSE;
|
||||||
signal_remove("print starting", (SIGNAL_FUNC) sig_stop);
|
signal_remove("print starting", (SIGNAL_FUNC) sig_stop);
|
||||||
signal_remove("print format", (SIGNAL_FUNC) sig_stop);
|
signal_remove("print format", (SIGNAL_FUNC) sig_stop);
|
||||||
signal_remove("print text stripped", (SIGNAL_FUNC) sig_stop);
|
|
||||||
signal_remove("print text", (SIGNAL_FUNC) sig_stop);
|
signal_remove("print text", (SIGNAL_FUNC) sig_stop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,8 @@ static void log_line(WINDOW_REC *window, SERVER_REC *server,
|
|||||||
g_strfreev(lines);
|
g_strfreev(lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_printtext_stripped(TEXT_DEST_REC *dest, const char *text)
|
static void sig_printtext(TEXT_DEST_REC *dest, const char *text,
|
||||||
|
const char *stripped)
|
||||||
{
|
{
|
||||||
if (skip_next_printtext) {
|
if (skip_next_printtext) {
|
||||||
skip_next_printtext = FALSE;
|
skip_next_printtext = FALSE;
|
||||||
@ -469,7 +470,7 @@ static void sig_printtext_stripped(TEXT_DEST_REC *dest, const char *text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
log_line(dest->window, dest->server, dest->target,
|
log_line(dest->window, dest->server, dest->target,
|
||||||
dest->level, text);
|
dest->level, stripped);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_print_format(THEME_REC *theme, const char *module,
|
static void sig_print_format(THEME_REC *theme, const char *module,
|
||||||
@ -631,7 +632,7 @@ void fe_log_init(void)
|
|||||||
command_bind("log stop", NULL, (SIGNAL_FUNC) cmd_log_stop);
|
command_bind("log stop", NULL, (SIGNAL_FUNC) cmd_log_stop);
|
||||||
command_bind("window log", NULL, (SIGNAL_FUNC) cmd_window_log);
|
command_bind("window log", NULL, (SIGNAL_FUNC) cmd_window_log);
|
||||||
command_bind("window logfile", NULL, (SIGNAL_FUNC) cmd_window_logfile);
|
command_bind("window logfile", NULL, (SIGNAL_FUNC) cmd_window_logfile);
|
||||||
signal_add_first("print text stripped", (SIGNAL_FUNC) sig_printtext_stripped);
|
signal_add_first("print text", (SIGNAL_FUNC) sig_printtext);
|
||||||
signal_add("window item destroy", (SIGNAL_FUNC) sig_window_item_destroy);
|
signal_add("window item destroy", (SIGNAL_FUNC) sig_window_item_destroy);
|
||||||
signal_add("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed);
|
signal_add("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed);
|
||||||
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
|
signal_add("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
|
||||||
@ -657,7 +658,7 @@ void fe_log_deinit(void)
|
|||||||
command_unbind("log stop", (SIGNAL_FUNC) cmd_log_stop);
|
command_unbind("log stop", (SIGNAL_FUNC) cmd_log_stop);
|
||||||
command_unbind("window log", (SIGNAL_FUNC) cmd_window_log);
|
command_unbind("window log", (SIGNAL_FUNC) cmd_window_log);
|
||||||
command_unbind("window logfile", (SIGNAL_FUNC) cmd_window_logfile);
|
command_unbind("window logfile", (SIGNAL_FUNC) cmd_window_logfile);
|
||||||
signal_remove("print text stripped", (SIGNAL_FUNC) sig_printtext_stripped);
|
signal_remove("print text", (SIGNAL_FUNC) sig_printtext);
|
||||||
signal_remove("window item destroy", (SIGNAL_FUNC) sig_window_item_destroy);
|
signal_remove("window item destroy", (SIGNAL_FUNC) sig_window_item_destroy);
|
||||||
signal_remove("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed);
|
signal_remove("window refnum changed", (SIGNAL_FUNC) sig_window_refnum_changed);
|
||||||
signal_remove("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
|
signal_remove("server disconnected", (SIGNAL_FUNC) sig_server_disconnected);
|
||||||
|
@ -37,8 +37,7 @@
|
|||||||
#include "formats.h"
|
#include "formats.h"
|
||||||
|
|
||||||
static NICKMATCH_REC *nickmatch;
|
static NICKMATCH_REC *nickmatch;
|
||||||
static HILIGHT_REC *next_nick_hilight, *next_line_hilight;
|
static HILIGHT_REC *next_nick_hilight;
|
||||||
static int next_hilight_start, next_hilight_end;
|
|
||||||
static int never_hilight_level, default_hilight_level;
|
static int never_hilight_level, default_hilight_level;
|
||||||
GSList *hilights;
|
GSList *hilights;
|
||||||
|
|
||||||
@ -277,22 +276,24 @@ 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 sig_print_text_stripped(TEXT_DEST_REC *dest, const char *str)
|
static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
|
||||||
|
const char *stripped)
|
||||||
{
|
{
|
||||||
HILIGHT_REC *hilight;
|
HILIGHT_REC *hilight;
|
||||||
|
char *color, *newstr;
|
||||||
|
int hilight_start, hilight_end, hilight_len;
|
||||||
|
|
||||||
g_return_if_fail(str != NULL);
|
hilight_start = hilight_end = 0;
|
||||||
|
|
||||||
if (next_nick_hilight != NULL) {
|
if (next_nick_hilight != NULL) {
|
||||||
if (!next_nick_hilight->nick) {
|
if (!next_nick_hilight->nick) {
|
||||||
/* non-nick hilight wanted */
|
/* non-nick hilight wanted */
|
||||||
hilight = next_nick_hilight;
|
hilight = next_nick_hilight;
|
||||||
next_nick_hilight = NULL;
|
next_nick_hilight = NULL;
|
||||||
if (!hilight_match_text(hilight, str,
|
if (!hilight_match_text(hilight, stripped,
|
||||||
&next_hilight_start,
|
&hilight_start,
|
||||||
&next_hilight_end)) {
|
&hilight_end)) {
|
||||||
next_hilight_start = 0;
|
hilight_start = 0;
|
||||||
next_hilight_end = strlen(str);
|
hilight_end = strlen(stripped);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* nick is highlighted, just set priority */
|
/* nick is highlighted, just set priority */
|
||||||
@ -305,33 +306,23 @@ static void sig_print_text_stripped(TEXT_DEST_REC *dest, const char *str)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
hilight = hilight_match(dest->server, dest->target,
|
hilight = hilight_match(dest->server, dest->target,
|
||||||
NULL, NULL, dest->level, str,
|
NULL, NULL, dest->level, stripped,
|
||||||
&next_hilight_start,
|
&hilight_start,
|
||||||
&next_hilight_end);
|
&hilight_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hilight != NULL) {
|
if (hilight == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
/* update the level / hilight info */
|
/* update the level / hilight info */
|
||||||
hilight_update_text_dest(dest, hilight);
|
hilight_update_text_dest(dest, hilight);
|
||||||
|
|
||||||
next_line_hilight = hilight;
|
color = hilight_get_color(hilight);
|
||||||
}
|
hilight_len = hilight_end-hilight_start;
|
||||||
}
|
|
||||||
|
|
||||||
static void sig_print_text(TEXT_DEST_REC *dest, const char *str)
|
if (!hilight->word) {
|
||||||
{
|
|
||||||
char *color, *newstr;
|
|
||||||
int next_hilight_len;
|
|
||||||
|
|
||||||
if (next_line_hilight == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
color = hilight_get_color(next_line_hilight);
|
|
||||||
next_hilight_len = next_hilight_end-next_hilight_start;
|
|
||||||
|
|
||||||
if (!next_line_hilight->word) {
|
|
||||||
/* hilight whole line */
|
/* hilight whole line */
|
||||||
char *tmp = strip_codes(str);
|
char *tmp = strip_codes(text);
|
||||||
newstr = g_strconcat(color, tmp, NULL);
|
newstr = g_strconcat(color, tmp, NULL);
|
||||||
g_free(tmp);
|
g_free(tmp);
|
||||||
} else {
|
} else {
|
||||||
@ -343,25 +334,25 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *str)
|
|||||||
tmp = g_string_new(NULL);
|
tmp = g_string_new(NULL);
|
||||||
|
|
||||||
/* start of the line */
|
/* start of the line */
|
||||||
pos = strip_real_length(str, next_hilight_start, NULL, NULL);
|
pos = strip_real_length(text, hilight_start, NULL, NULL);
|
||||||
g_string_append(tmp, str);
|
g_string_append(tmp, text);
|
||||||
g_string_truncate(tmp, pos);
|
g_string_truncate(tmp, pos);
|
||||||
|
|
||||||
/* color */
|
/* color */
|
||||||
g_string_append(tmp, color);
|
g_string_append(tmp, color);
|
||||||
|
|
||||||
/* middle of the line, stripped */
|
/* middle of the line, stripped */
|
||||||
middle = strip_codes(str+pos);
|
middle = strip_codes(text+pos);
|
||||||
pos = tmp->len;
|
pos = tmp->len;
|
||||||
g_string_append(tmp, middle);
|
g_string_append(tmp, middle);
|
||||||
g_string_truncate(tmp, pos+next_hilight_len);
|
g_string_truncate(tmp, pos+hilight_len);
|
||||||
g_free(middle);
|
g_free(middle);
|
||||||
|
|
||||||
/* end of the line */
|
/* end of the line */
|
||||||
pos = strip_real_length(str, next_hilight_end,
|
pos = strip_real_length(text, hilight_end,
|
||||||
&color_pos, &color_len);
|
&color_pos, &color_len);
|
||||||
if (color_pos > 0)
|
if (color_pos > 0)
|
||||||
lastcolor = g_strndup(str+color_pos, color_len);
|
lastcolor = g_strndup(text+color_pos, color_len);
|
||||||
else {
|
else {
|
||||||
/* no colors in line, change back to default */
|
/* no colors in line, change back to default */
|
||||||
lastcolor = g_malloc0(3);
|
lastcolor = g_malloc0(3);
|
||||||
@ -369,15 +360,14 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *str)
|
|||||||
lastcolor[1] = FORMAT_STYLE_DEFAULTS;
|
lastcolor[1] = FORMAT_STYLE_DEFAULTS;
|
||||||
}
|
}
|
||||||
g_string_append(tmp, lastcolor);
|
g_string_append(tmp, lastcolor);
|
||||||
g_string_append(tmp, str+pos);
|
g_string_append(tmp, text+pos);
|
||||||
g_free(lastcolor);
|
g_free(lastcolor);
|
||||||
|
|
||||||
newstr = tmp->str;
|
newstr = tmp->str;
|
||||||
g_string_free(tmp, FALSE);
|
g_string_free(tmp, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
next_line_hilight = NULL;
|
signal_emit("print text", 3, dest, newstr, stripped);
|
||||||
signal_emit("print text", 2, dest, newstr);
|
|
||||||
|
|
||||||
g_free(color);
|
g_free(color);
|
||||||
g_free(newstr);
|
g_free(newstr);
|
||||||
@ -665,14 +655,12 @@ void hilight_text_init(void)
|
|||||||
settings_add_str("lookandfeel", "hilight_level", "PUBLIC DCCMSGS");
|
settings_add_str("lookandfeel", "hilight_level", "PUBLIC DCCMSGS");
|
||||||
|
|
||||||
next_nick_hilight = NULL;
|
next_nick_hilight = NULL;
|
||||||
next_line_hilight = NULL;
|
|
||||||
|
|
||||||
read_settings();
|
read_settings();
|
||||||
|
|
||||||
nickmatch = nickmatch_init(hilight_nick_cache);
|
nickmatch = nickmatch_init(hilight_nick_cache);
|
||||||
read_hilight_config();
|
read_hilight_config();
|
||||||
|
|
||||||
signal_add_first("print text stripped", (SIGNAL_FUNC) sig_print_text_stripped);
|
|
||||||
signal_add_first("print text", (SIGNAL_FUNC) sig_print_text);
|
signal_add_first("print text", (SIGNAL_FUNC) sig_print_text);
|
||||||
signal_add("setup reread", (SIGNAL_FUNC) read_hilight_config);
|
signal_add("setup reread", (SIGNAL_FUNC) read_hilight_config);
|
||||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
@ -687,7 +675,6 @@ void hilight_text_deinit(void)
|
|||||||
hilights_destroy_all();
|
hilights_destroy_all();
|
||||||
nickmatch_deinit(nickmatch);
|
nickmatch_deinit(nickmatch);
|
||||||
|
|
||||||
signal_remove("print text stripped", (SIGNAL_FUNC) sig_print_text_stripped);
|
|
||||||
signal_remove("print text", (SIGNAL_FUNC) sig_print_text);
|
signal_remove("print text", (SIGNAL_FUNC) sig_print_text);
|
||||||
signal_remove("setup reread", (SIGNAL_FUNC) read_hilight_config);
|
signal_remove("setup reread", (SIGNAL_FUNC) read_hilight_config);
|
||||||
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
static int beep_msg_level, beep_when_away, beep_when_window_active;
|
static int beep_msg_level, beep_when_away, beep_when_window_active;
|
||||||
|
|
||||||
static int signal_gui_print_text;
|
static int signal_gui_print_text;
|
||||||
static int signal_print_text_stripped;
|
|
||||||
static int signal_print_text;
|
static int signal_print_text;
|
||||||
static int signal_print_text_finished;
|
static int signal_print_text_finished;
|
||||||
static int signal_print_format;
|
static int signal_print_format;
|
||||||
@ -150,7 +149,7 @@ void printformat_module_gui(const char *module, int formatnum, ...)
|
|||||||
|
|
||||||
static void print_line(TEXT_DEST_REC *dest, const char *text)
|
static void print_line(TEXT_DEST_REC *dest, const char *text)
|
||||||
{
|
{
|
||||||
char *str, *tmp;
|
char *str, *tmp, *stripped;
|
||||||
|
|
||||||
g_return_if_fail(dest != NULL);
|
g_return_if_fail(dest != NULL);
|
||||||
g_return_if_fail(text != NULL);
|
g_return_if_fail(text != NULL);
|
||||||
@ -159,13 +158,12 @@ static void print_line(TEXT_DEST_REC *dest, const char *text)
|
|||||||
str = format_add_linestart(text, tmp);
|
str = format_add_linestart(text, tmp);
|
||||||
g_free_not_null(tmp);
|
g_free_not_null(tmp);
|
||||||
|
|
||||||
/* send the plain text version for logging etc.. */
|
/* send both the formatted + stripped (for logging etc.) */
|
||||||
tmp = strip_codes(str);
|
stripped = strip_codes(str);
|
||||||
signal_emit_id(signal_print_text_stripped, 2, dest, tmp);
|
signal_emit_id(signal_print_text, 3, dest, str, stripped);
|
||||||
g_free(tmp);
|
|
||||||
|
|
||||||
signal_emit_id(signal_print_text, 2, dest, str);
|
|
||||||
g_free(str);
|
g_free(str);
|
||||||
|
g_free(stripped);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* append string to `out', expand newlines. */
|
/* append string to `out', expand newlines. */
|
||||||
@ -434,7 +432,6 @@ void printtext_init(void)
|
|||||||
{
|
{
|
||||||
sending_print_starting = FALSE;
|
sending_print_starting = FALSE;
|
||||||
signal_gui_print_text = signal_get_uniq_id("gui print text");
|
signal_gui_print_text = signal_get_uniq_id("gui print text");
|
||||||
signal_print_text_stripped = signal_get_uniq_id("print text stripped");
|
|
||||||
signal_print_text = signal_get_uniq_id("print text");
|
signal_print_text = signal_get_uniq_id("print text");
|
||||||
signal_print_text_finished = signal_get_uniq_id("print text finished");
|
signal_print_text_finished = signal_get_uniq_id("print text finished");
|
||||||
signal_print_format = signal_get_uniq_id("print format");
|
signal_print_format = signal_get_uniq_id("print format");
|
||||||
|
Loading…
Reference in New Issue
Block a user