mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
properly restore the saved text dest
This commit is contained in:
parent
964c067b1e
commit
0cc1e4b7cd
@ -246,7 +246,7 @@ FE common
|
|||||||
"gui print text", WINDOW_REC, int fg, int bg, int flags, char *text, TEXT_DEST_REC
|
"gui print text", WINDOW_REC, int fg, int bg, int flags, char *text, TEXT_DEST_REC
|
||||||
|
|
||||||
(Can be used to determine when all "gui print text"s are sent (not required))
|
(Can be used to determine when all "gui print text"s are sent (not required))
|
||||||
"gui print text finished", WINDOW_REC
|
"gui print text finished", WINDOW_REC, TEXT_DEST_REC
|
||||||
|
|
||||||
* Provides signals:
|
* Provides signals:
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ gui-readline.c:
|
|||||||
|
|
||||||
gui-printtext.c:
|
gui-printtext.c:
|
||||||
"beep"
|
"beep"
|
||||||
"gui print text after finished", WINDOW_REC, LINE_REC *line, LINE_REC *prev_line
|
"gui print text after finished", WINDOW_REC, LINE_REC *line, LINE_REC *prev_line, TEXT_DEST_REC
|
||||||
|
|
||||||
textbuffer-view.c
|
textbuffer-view.c
|
||||||
"gui textbuffer line removed", TEXTBUFFER_VIEW_REC *view, LINE_REC *line, LINE_REC *prev_line
|
"gui textbuffer line removed", TEXTBUFFER_VIEW_REC *view, LINE_REC *line, LINE_REC *prev_line
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
|
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
|
||||||
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
|
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
|
||||||
|
|
||||||
#define IRSSI_ABI_VERSION 29
|
#define IRSSI_ABI_VERSION 30
|
||||||
|
|
||||||
#define DEFAULT_SERVER_ADD_PORT 6667
|
#define DEFAULT_SERVER_ADD_PORT 6667
|
||||||
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
|
||||||
|
@ -442,7 +442,7 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text)
|
|||||||
format_send_to_gui(dest, str);
|
format_send_to_gui(dest, str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
|
|
||||||
signal_emit_id(signal_gui_print_text_finished, 1, dest->window);
|
signal_emit_id(signal_gui_print_text_finished, 2, dest->window, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_print_format(THEME_REC *theme, const char *module, TEXT_DEST_REC *dest,
|
static void sig_print_format(THEME_REC *theme, const char *module, TEXT_DEST_REC *dest,
|
||||||
|
@ -158,7 +158,8 @@ void gui_printtext_after_time(TEXT_DEST_REC *dest, LINE_REC *prev, const char *s
|
|||||||
gui->insert_after_time = time;
|
gui->insert_after_time = time;
|
||||||
format_send_to_gui(dest, str);
|
format_send_to_gui(dest, str);
|
||||||
gui->use_insert_after = FALSE;
|
gui->use_insert_after = FALSE;
|
||||||
signal_emit("gui print text after finished", 3, dest->window, gui->insert_after, prev);
|
signal_emit("gui print text after finished", 4, dest->window, gui->insert_after, prev,
|
||||||
|
dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_printtext_after(TEXT_DEST_REC *dest, LINE_REC *prev, const char *str)
|
void gui_printtext_after(TEXT_DEST_REC *dest, LINE_REC *prev, const char *str)
|
||||||
@ -376,7 +377,7 @@ static void sig_gui_print_text(WINDOW_REC *window, void *fgcolor,
|
|||||||
gui->insert_after = insert_after;
|
gui->insert_after = insert_after;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_gui_printtext_finished(WINDOW_REC *window)
|
static void sig_gui_printtext_finished(WINDOW_REC *window, TEXT_DEST_REC *dest)
|
||||||
{
|
{
|
||||||
TEXT_BUFFER_VIEW_REC *view;
|
TEXT_BUFFER_VIEW_REC *view;
|
||||||
LINE_REC *insert_after;
|
LINE_REC *insert_after;
|
||||||
|
@ -42,6 +42,7 @@ void textbuffer_format_rec_free(TEXT_BUFFER_FORMAT_REC *rec)
|
|||||||
i_refstr_release(rec->server_tag);
|
i_refstr_release(rec->server_tag);
|
||||||
i_refstr_release(rec->target);
|
i_refstr_release(rec->target);
|
||||||
i_refstr_release(rec->nick);
|
i_refstr_release(rec->nick);
|
||||||
|
i_refstr_release(rec->address);
|
||||||
if (rec->nargs >= 1) {
|
if (rec->nargs >= 1) {
|
||||||
i_refstr_release(rec->args[0]);
|
i_refstr_release(rec->args[0]);
|
||||||
}
|
}
|
||||||
@ -54,17 +55,13 @@ void textbuffer_format_rec_free(TEXT_BUFFER_FORMAT_REC *rec)
|
|||||||
g_slice_free(TEXT_BUFFER_FORMAT_REC, rec);
|
g_slice_free(TEXT_BUFFER_FORMAT_REC, rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TEXT_BUFFER_FORMAT_REC *format_rec_new(const char *module, const char *format_tag,
|
static TEXT_BUFFER_FORMAT_REC *format_rec_new(const char *module, const char *format_tag, int nargs,
|
||||||
const char *server_tag, const char *target,
|
const char **args)
|
||||||
const char *nick, int nargs, const char **args)
|
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
TEXT_BUFFER_FORMAT_REC *ret = g_slice_new0(TEXT_BUFFER_FORMAT_REC);
|
TEXT_BUFFER_FORMAT_REC *ret = g_slice_new0(TEXT_BUFFER_FORMAT_REC);
|
||||||
ret->module = i_refstr_intern(module);
|
ret->module = i_refstr_intern(module);
|
||||||
ret->format = i_refstr_intern(format_tag);
|
ret->format = i_refstr_intern(format_tag);
|
||||||
ret->server_tag = i_refstr_intern(server_tag);
|
|
||||||
ret->target = i_refstr_intern(target);
|
|
||||||
ret->nick = i_refstr_intern(nick);
|
|
||||||
ret->nargs = nargs;
|
ret->nargs = nargs;
|
||||||
ret->args = g_new0(char *, nargs);
|
ret->args = g_new0(char *, nargs);
|
||||||
if (nargs >= 1) {
|
if (nargs >= 1) {
|
||||||
@ -76,6 +73,19 @@ static TEXT_BUFFER_FORMAT_REC *format_rec_new(const char *module, const char *fo
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void format_rec_set_dest(TEXT_BUFFER_FORMAT_REC *rec, const TEXT_DEST_REC *dest)
|
||||||
|
{
|
||||||
|
i_refstr_release(rec->server_tag);
|
||||||
|
i_refstr_release(rec->target);
|
||||||
|
i_refstr_release(rec->nick);
|
||||||
|
i_refstr_release(rec->address);
|
||||||
|
rec->server_tag = i_refstr_intern(dest->server_tag);
|
||||||
|
rec->target = i_refstr_intern(dest->target);
|
||||||
|
rec->nick = i_refstr_intern(dest->nick);
|
||||||
|
rec->address = i_refstr_intern(dest->address);
|
||||||
|
rec->flags = dest->flags & ~PRINT_FLAG_FORMAT;
|
||||||
|
}
|
||||||
|
|
||||||
static LINE_INFO_REC *store_lineinfo_tmp(TEXT_DEST_REC *dest)
|
static LINE_INFO_REC *store_lineinfo_tmp(TEXT_DEST_REC *dest)
|
||||||
{
|
{
|
||||||
GUI_WINDOW_REC *gui;
|
GUI_WINDOW_REC *gui;
|
||||||
@ -132,11 +142,10 @@ static void sig_print_format(THEME_REC *theme, const char *module, TEXT_DEST_REC
|
|||||||
formatnum = GPOINTER_TO_INT(formatnump);
|
formatnum = GPOINTER_TO_INT(formatnump);
|
||||||
formats = g_hash_table_lookup(default_formats, module);
|
formats = g_hash_table_lookup(default_formats, module);
|
||||||
|
|
||||||
info->format = format_rec_new(module, formats[formatnum].tag, dest->server_tag,
|
info->format =
|
||||||
dest->target, dest->nick, formats[formatnum].params, args);
|
format_rec_new(module, formats[formatnum].tag, formats[formatnum].params, args);
|
||||||
special_push_collector(&info->format->expando_cache);
|
special_push_collector(&info->format->expando_cache);
|
||||||
|
|
||||||
info->format->flags = dest->flags;
|
|
||||||
dest->flags |= PRINT_FLAG_FORMAT;
|
dest->flags |= PRINT_FLAG_FORMAT;
|
||||||
|
|
||||||
signal_continue(5, theme, module, dest, formatnump, args);
|
signal_continue(5, theme, module, dest, formatnump, args);
|
||||||
@ -155,11 +164,9 @@ static void sig_print_noformat(TEXT_DEST_REC *dest, const char *text)
|
|||||||
special_push_collector(NULL);
|
special_push_collector(NULL);
|
||||||
info = store_lineinfo_tmp(dest);
|
info = store_lineinfo_tmp(dest);
|
||||||
|
|
||||||
info->format = format_rec_new(NULL, NULL, dest->server_tag, dest->target, dest->nick, 2,
|
info->format = format_rec_new(NULL, NULL, 2, (const char *[]){ NULL, text });
|
||||||
(const char *[]){ NULL, text });
|
|
||||||
special_push_collector(&info->format->expando_cache);
|
special_push_collector(&info->format->expando_cache);
|
||||||
|
|
||||||
info->format->flags = dest->flags;
|
|
||||||
dest->flags |= PRINT_FLAG_FORMAT;
|
dest->flags |= PRINT_FLAG_FORMAT;
|
||||||
|
|
||||||
signal_continue(2, dest, text);
|
signal_continue(2, dest, text);
|
||||||
@ -182,7 +189,7 @@ static GSList *reverse_collector(GSList *a1)
|
|||||||
return c1;
|
return c1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_gui_print_text_finished(WINDOW_REC *window)
|
static void sig_gui_print_text_finished(WINDOW_REC *window, TEXT_DEST_REC *dest)
|
||||||
{
|
{
|
||||||
GUI_WINDOW_REC *gui;
|
GUI_WINDOW_REC *gui;
|
||||||
LINE_REC *insert_after;
|
LINE_REC *insert_after;
|
||||||
@ -202,6 +209,7 @@ static void sig_gui_print_text_finished(WINDOW_REC *window)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
info->format->expando_cache = reverse_collector(info->format->expando_cache);
|
info->format->expando_cache = reverse_collector(info->format->expando_cache);
|
||||||
|
format_rec_set_dest(info->format, dest);
|
||||||
|
|
||||||
info->level |= MSGLEVEL_FORMAT;
|
info->level |= MSGLEVEL_FORMAT;
|
||||||
|
|
||||||
@ -290,12 +298,16 @@ char *textbuffer_line_get_text(TEXT_BUFFER_REC *buffer, LINE_REC *line)
|
|||||||
|
|
||||||
curr = line;
|
curr = line;
|
||||||
line = NULL;
|
line = NULL;
|
||||||
format_rec = curr->info.format;
|
|
||||||
|
|
||||||
format_create_dest(
|
format_rec = curr->info.format;
|
||||||
|
format_create_dest_tag(
|
||||||
&dest,
|
&dest,
|
||||||
format_rec->server_tag != NULL ? server_find_tag(format_rec->server_tag) : NULL,
|
format_rec->server_tag != NULL ? server_find_tag(format_rec->server_tag) : NULL,
|
||||||
format_rec->target, curr->info.level & ~MSGLEVEL_FORMAT, buffer->window);
|
format_rec->server_tag, format_rec->target, curr->info.level & ~MSGLEVEL_FORMAT,
|
||||||
|
buffer->window);
|
||||||
|
dest.nick = format_rec->nick;
|
||||||
|
dest.address = format_rec->address;
|
||||||
|
dest.flags = format_rec->flags;
|
||||||
|
|
||||||
theme = window_get_theme(dest.window);
|
theme = window_get_theme(dest.window);
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ typedef struct _TEXT_BUFFER_FORMAT_REC {
|
|||||||
char *server_tag;
|
char *server_tag;
|
||||||
char *target;
|
char *target;
|
||||||
char *nick;
|
char *nick;
|
||||||
|
char *address;
|
||||||
char **args;
|
char **args;
|
||||||
int nargs;
|
int nargs;
|
||||||
GSList *expando_cache;
|
GSList *expando_cache;
|
||||||
|
Loading…
Reference in New Issue
Block a user