mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Refactor win_print_history()
We never use the printf like behaviour anyways.
This commit is contained in:
parent
6e68f1812b
commit
ea5a947f52
@ -488,7 +488,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 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);
|
char ss[3]; memcpy(ss, &line[6], 2); ss[2] = '\0'; int iss = atoi(ss);
|
||||||
GDateTime *timestamp = g_date_time_new_local(iyy, imo, idd, ihh, imm, iss);
|
GDateTime *timestamp = g_date_time_new_local(iyy, imo, idd, ihh, imm, iss);
|
||||||
win_print_history((ProfWin*)chatwin, timestamp, "%s", curr->data+11);
|
win_print_history((ProfWin*)chatwin, timestamp, curr->data+11);
|
||||||
g_date_time_unref(timestamp);
|
g_date_time_unref(timestamp);
|
||||||
// header, containing the date from filename "21/10/2019:"
|
// header, containing the date from filename "21/10/2019:"
|
||||||
} else {
|
} else {
|
||||||
|
@ -379,7 +379,7 @@ mucwin_history(ProfMucWin *mucwin, const char *const nick, GDateTime *timestamp,
|
|||||||
g_string_append(line, message);
|
g_string_append(line, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
win_print_history(window, timestamp, "%s", line->str);
|
win_print_history(window, timestamp, line->str);
|
||||||
g_string_free(line, TRUE);
|
g_string_free(line, TRUE);
|
||||||
|
|
||||||
plugins_on_room_history_message(mucwin->roomjid, nick, message, timestamp);
|
plugins_on_room_history_message(mucwin->roomjid, nick, message, timestamp);
|
||||||
|
@ -1196,23 +1196,15 @@ win_print_outgoing(ProfWin *window, const char ch, const char *const id, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message, ...)
|
win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message)
|
||||||
{
|
{
|
||||||
g_date_time_ref(timestamp);
|
g_date_time_ref(timestamp);
|
||||||
|
|
||||||
va_list arg;
|
buffer_append(window->layout->buffer, '-', 0, timestamp, 0, THEME_TEXT_HISTORY, "", message, NULL, NULL);
|
||||||
va_start(arg, message);
|
_win_print_internal(window, '-', 0, timestamp, 0, THEME_TEXT_HISTORY, "", message, NULL);
|
||||||
GString *fmt_msg = g_string_new(NULL);
|
|
||||||
g_string_vprintf(fmt_msg, message, arg);
|
|
||||||
|
|
||||||
buffer_append(window->layout->buffer, '-', 0, timestamp, 0, THEME_TEXT_HISTORY, "", fmt_msg->str, NULL, NULL);
|
|
||||||
_win_print_internal(window, '-', 0, timestamp, 0, THEME_TEXT_HISTORY, "", fmt_msg->str, NULL);
|
|
||||||
|
|
||||||
inp_nonblocking(TRUE);
|
inp_nonblocking(TRUE);
|
||||||
g_date_time_unref(timestamp);
|
g_date_time_unref(timestamp);
|
||||||
|
|
||||||
g_string_free(fmt_msg, TRUE);
|
|
||||||
va_end(arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -68,7 +68,7 @@ void win_print_outgoing(ProfWin *window, const char ch, const char *const id, co
|
|||||||
void win_print_outgoing_with_receipt(ProfWin *window, const char show_char, const char *const from, const char *const message, char *id, const char *const replace_id);
|
void win_print_outgoing_with_receipt(ProfWin *window, const char show_char, const char *const from, const char *const message, char *id, const char *const replace_id);
|
||||||
void win_println_incoming_muc_msg(ProfWin *window, char ch, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message);
|
void win_println_incoming_muc_msg(ProfWin *window, char ch, int flags, const char *const them, const char *const id, const char *const replace_id, const char *const message);
|
||||||
void win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message);
|
void win_print_outgoing_muc_msg(ProfWin *window, char ch, const char *const me, const char *const id, const char *const replace_id, const char *const message);
|
||||||
void win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message, ...);
|
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);
|
void win_print_http_upload(ProfWin *window, const char *const message, char *url);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user