diff options
author | James Booth <boothj5@gmail.com> | 2016-10-15 20:55:45 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-10-15 20:55:45 +0100 |
commit | c814cb44b8dafc04baf402cad7f7be165aa1ce6b (patch) | |
tree | b26616b8e336de0010951650c4a3ea46a565d1a8 /src | |
parent | f761d403b3ba72595c8fb0328822b9cacd3aac9c (diff) | |
download | profani-tty-c814cb44b8dafc04baf402cad7f7be165aa1ce6b.tar.gz |
Add win_print_history
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/chatwin.c | 2 | ||||
-rw-r--r-- | src/ui/mucwin.c | 2 | ||||
-rw-r--r-- | src/ui/window.c | 20 | ||||
-rw-r--r-- | src/ui/window.h | 1 |
4 files changed, 23 insertions, 2 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index d7d0e62c..8eee3dee 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -401,7 +401,7 @@ _chatwin_history(ProfChatWin *chatwin, const char *const contact) char mm[3]; memcpy(mm, &line[3], 2); mm[2] = '\0'; int imm = atoi(mm); char ss[3]; memcpy(ss, &line[6], 2); ss[2] = '\0'; int iss = atoi(ss); GDateTime *timestamp = g_date_time_new_local(2000, 1, 1, ihh, imm, iss); - win_printf((ProfWin*)chatwin, '-', 0, timestamp, NO_COLOUR_DATE, THEME_DEFAULT, "", "%s", curr->data+11); + win_print_history((ProfWin*)chatwin, timestamp, "%s", curr->data+11); g_date_time_unref(timestamp); // header } else { diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 7ad9411d..6d1891d4 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -354,7 +354,7 @@ mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp, g_string_append(line, message); } - win_printf(window, '-', 0, timestamp, NO_COLOUR_DATE, 0, "", "%s", line->str); + win_print_history(window, timestamp, "%s", line->str); g_string_free(line, TRUE); plugins_on_room_history_message(mucwin->roomjid, nick, message, timestamp); diff --git a/src/ui/window.c b/src/ui/window.c index 07dcc9dc..1b456768 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1029,6 +1029,26 @@ win_print_outgoing(ProfWin *window, const char ch, const char *const message, .. } void +win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message, ...) +{ + g_date_time_ref(timestamp); + + va_list arg; + va_start(arg, message); + GString *fmt_msg = g_string_new(NULL); + g_string_vprintf(fmt_msg, message, arg); + + buffer_push(window->layout->buffer, '-', 0, timestamp, NO_COLOUR_DATE, THEME_DEFAULT, "", fmt_msg->str, NULL); + + _win_print(window, '-', 0, timestamp, NO_COLOUR_DATE, THEME_DEFAULT, "", fmt_msg->str, NULL); + inp_nonblocking(TRUE); + g_date_time_unref(timestamp); + + g_string_free(fmt_msg, TRUE); + va_end(arg); +} + +void win_printf(ProfWin *window, const char show_char, int pad_indent, GDateTime *timestamp, int flags, theme_item_t theme_item, const char *const from, const char *const message, ...) { diff --git a/src/ui/window.h b/src/ui/window.h index 9f84eabf..cdc18dfe 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -63,6 +63,7 @@ void win_show_status_string(ProfWin *window, const char *const from, void win_print_outgoing(ProfWin *window, const char ch, const char *const message, ...); void win_print_incoming(ProfWin *window, GDateTime *timestamp, const char *const from, const char *const message, prof_enc_t enc_mode); +void win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message, ...); void win_print_http_upload(ProfWin *window, const char *const message, char *url); |