mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #11 from ailin-nemui/print_text_after_time-api
add print_text_after_time to specify time stamp for lines
This commit is contained in:
commit
2e6f16c0fa
@ -334,6 +334,9 @@ gui-readline.c:
|
|||||||
gui-printtext.c:
|
gui-printtext.c:
|
||||||
"beep"
|
"beep"
|
||||||
|
|
||||||
|
textbuffer-view.c
|
||||||
|
"gui textbuffer line removed", TEXTBUFFER_VIEW_REC *view, LINE_REC *line, LINE_REC *prev_line
|
||||||
|
|
||||||
Perl
|
Perl
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ void gui_printtext(int xpos, int ypos, const char *str)
|
|||||||
next_xpos = next_ypos = -1;
|
next_xpos = next_ypos = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_printtext_after(TEXT_DEST_REC *dest, LINE_REC *prev, const char *str)
|
void gui_printtext_after_time(TEXT_DEST_REC *dest, LINE_REC *prev, const char *str, time_t time)
|
||||||
{
|
{
|
||||||
GUI_WINDOW_REC *gui;
|
GUI_WINDOW_REC *gui;
|
||||||
|
|
||||||
@ -110,10 +110,16 @@ void gui_printtext_after(TEXT_DEST_REC *dest, LINE_REC *prev, const char *str)
|
|||||||
|
|
||||||
gui->use_insert_after = TRUE;
|
gui->use_insert_after = TRUE;
|
||||||
gui->insert_after = prev;
|
gui->insert_after = prev;
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gui_printtext_after(TEXT_DEST_REC *dest, LINE_REC *prev, const char *str)
|
||||||
|
{
|
||||||
|
gui_printtext_after_time(dest, prev, str, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static void remove_old_lines(TEXT_BUFFER_VIEW_REC *view)
|
static void remove_old_lines(TEXT_BUFFER_VIEW_REC *view)
|
||||||
{
|
{
|
||||||
LINE_REC *line;
|
LINE_REC *line;
|
||||||
@ -199,9 +205,10 @@ static void sig_gui_print_text(WINDOW_REC *window, void *fgcolor,
|
|||||||
}
|
}
|
||||||
|
|
||||||
lineinfo.level = dest == NULL ? 0 : dest->level;
|
lineinfo.level = dest == NULL ? 0 : dest->level;
|
||||||
lineinfo.time = time(NULL);
|
|
||||||
|
|
||||||
gui = WINDOW_GUI(window);
|
gui = WINDOW_GUI(window);
|
||||||
|
lineinfo.time = (gui->use_insert_after && gui->insert_after_time) ?
|
||||||
|
gui->insert_after_time : time(NULL);
|
||||||
|
|
||||||
view = gui->view;
|
view = gui->view;
|
||||||
insert_after = gui->use_insert_after ?
|
insert_after = gui->use_insert_after ?
|
||||||
gui->insert_after : view->buffer->cur_line;
|
gui->insert_after : view->buffer->cur_line;
|
||||||
|
@ -18,5 +18,6 @@ INDENT_FUNC get_default_indent_func(void);
|
|||||||
|
|
||||||
void gui_printtext(int xpos, int ypos, const char *str);
|
void gui_printtext(int xpos, int ypos, const char *str);
|
||||||
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);
|
||||||
|
void gui_printtext_after_time(TEXT_DEST_REC *dest, LINE_REC *prev, const char *str, time_t time);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,6 +20,7 @@ typedef struct {
|
|||||||
unsigned int sticky:1;
|
unsigned int sticky:1;
|
||||||
unsigned int use_insert_after:1;
|
unsigned int use_insert_after:1;
|
||||||
LINE_REC *insert_after;
|
LINE_REC *insert_after;
|
||||||
|
time_t insert_after_time;
|
||||||
} GUI_WINDOW_REC;
|
} GUI_WINDOW_REC;
|
||||||
|
|
||||||
void gui_windows_init(void);
|
void gui_windows_init(void);
|
||||||
|
@ -1141,6 +1141,8 @@ void textbuffer_view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
|
|||||||
g_return_if_fail(view != NULL);
|
g_return_if_fail(view != NULL);
|
||||||
g_return_if_fail(line != NULL);
|
g_return_if_fail(line != NULL);
|
||||||
|
|
||||||
|
signal_emit("gui textbuffer line removed", 3, view, line, line->prev);
|
||||||
|
|
||||||
linecount = view_get_linecount(view, line);
|
linecount = view_get_linecount(view, line);
|
||||||
update_counter = view->cache->update_counter+1;
|
update_counter = view->cache->update_counter+1;
|
||||||
|
|
||||||
|
@ -57,6 +57,10 @@ while (<STDIN>) {
|
|||||||
WINDOW_REC => 'Irssi::UI::Window',
|
WINDOW_REC => 'Irssi::UI::Window',
|
||||||
WI_ITEM_REC => 'iobject',
|
WI_ITEM_REC => 'iobject',
|
||||||
|
|
||||||
|
# fe-text
|
||||||
|
TEXTBUFFER_VIEW_REC => 'Irssi::TextUI::TextBufferView',
|
||||||
|
LINE_REC => 'Irssi::TextUI::Line',
|
||||||
|
|
||||||
# perl
|
# perl
|
||||||
PERL_SCRIPT_REC => 'Irssi::Script',
|
PERL_SCRIPT_REC => 'Irssi::Script',
|
||||||
);
|
);
|
||||||
|
@ -139,11 +139,12 @@ CODE:
|
|||||||
MODULE = Irssi::TextUI PACKAGE = Irssi::UI::Window
|
MODULE = Irssi::TextUI PACKAGE = Irssi::UI::Window
|
||||||
|
|
||||||
void
|
void
|
||||||
print_after(window, prev, level, str)
|
print_after(window, prev, level, str, time = 0)
|
||||||
Irssi::UI::Window window
|
Irssi::UI::Window window
|
||||||
Irssi::TextUI::Line prev
|
Irssi::TextUI::Line prev
|
||||||
int level
|
int level
|
||||||
char *str
|
char *str
|
||||||
|
time_t time
|
||||||
PREINIT:
|
PREINIT:
|
||||||
TEXT_DEST_REC dest;
|
TEXT_DEST_REC dest;
|
||||||
char *text;
|
char *text;
|
||||||
@ -152,21 +153,22 @@ CODE:
|
|||||||
format_create_dest(&dest, NULL, NULL, level, window);
|
format_create_dest(&dest, NULL, NULL, level, window);
|
||||||
text = format_string_expand(str, NULL);
|
text = format_string_expand(str, NULL);
|
||||||
text2 = g_strconcat(text, "\n", NULL);
|
text2 = g_strconcat(text, "\n", NULL);
|
||||||
gui_printtext_after(&dest, prev, text2);
|
gui_printtext_after_time(&dest, prev, text2, time);
|
||||||
g_free(text);
|
g_free(text);
|
||||||
g_free(text2);
|
g_free(text2);
|
||||||
|
|
||||||
void
|
void
|
||||||
gui_printtext_after(window, prev, level, str)
|
gui_printtext_after(window, prev, level, str, time = 0)
|
||||||
Irssi::UI::Window window
|
Irssi::UI::Window window
|
||||||
Irssi::TextUI::Line prev
|
Irssi::TextUI::Line prev
|
||||||
int level
|
int level
|
||||||
char *str
|
char *str
|
||||||
|
time_t time
|
||||||
PREINIT:
|
PREINIT:
|
||||||
TEXT_DEST_REC dest;
|
TEXT_DEST_REC dest;
|
||||||
CODE:
|
CODE:
|
||||||
format_create_dest(&dest, NULL, NULL, level, window);
|
format_create_dest(&dest, NULL, NULL, level, window);
|
||||||
gui_printtext_after(&dest, prev, str);
|
gui_printtext_after_time(&dest, prev, str, time);
|
||||||
|
|
||||||
Irssi::TextUI::Line
|
Irssi::TextUI::Line
|
||||||
last_line_insert(window)
|
last_line_insert(window)
|
||||||
@ -179,17 +181,18 @@ OUTPUT:
|
|||||||
MODULE = Irssi::TextUI PACKAGE = Irssi::Server
|
MODULE = Irssi::TextUI PACKAGE = Irssi::Server
|
||||||
|
|
||||||
void
|
void
|
||||||
gui_printtext_after(server, target, prev, level, str)
|
gui_printtext_after(server, target, prev, level, str, time = 0)
|
||||||
Irssi::Server server
|
Irssi::Server server
|
||||||
char *target
|
char *target
|
||||||
Irssi::TextUI::Line prev
|
Irssi::TextUI::Line prev
|
||||||
int level
|
int level
|
||||||
char *str
|
char *str
|
||||||
|
time_t time
|
||||||
PREINIT:
|
PREINIT:
|
||||||
TEXT_DEST_REC dest;
|
TEXT_DEST_REC dest;
|
||||||
CODE:
|
CODE:
|
||||||
format_create_dest(&dest, server, target, level, NULL);
|
format_create_dest(&dest, server, target, level, NULL);
|
||||||
gui_printtext_after(&dest, prev, str);
|
gui_printtext_after_time(&dest, prev, str, time);
|
||||||
|
|
||||||
BOOT:
|
BOOT:
|
||||||
irssi_boot(TextUI__Statusbar);
|
irssi_boot(TextUI__Statusbar);
|
||||||
|
Loading…
Reference in New Issue
Block a user