diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/chatwin.c | 18 | ||||
-rw-r--r-- | src/ui/privwin.c | 4 | ||||
-rw-r--r-- | src/ui/ui.h | 6 | ||||
-rw-r--r-- | src/ui/window.c | 13 | ||||
-rw-r--r-- | src/ui/window.h | 2 |
5 files changed, 26 insertions, 17 deletions
diff --git a/src/ui/chatwin.c b/src/ui/chatwin.c index d7906815..55d20135 100644 --- a/src/ui/chatwin.c +++ b/src/ui/chatwin.c @@ -309,7 +309,7 @@ chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_cr void chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode, - gboolean request_receipt) + gboolean request_receipt, const char *const replace_id) { assert(chatwin != NULL); @@ -324,15 +324,16 @@ chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id, enc_char = prefs_get_omemo_char(); } - // save last id and message for LMC - if (id) { - _chatwin_set_last_message(chatwin, id, message); - } - if (request_receipt && id) { + //TODO: replace_id and id win_print_with_receipt((ProfWin*)chatwin, enc_char, "me", message, id); } else { - win_print_outgoing((ProfWin*)chatwin, enc_char, "%s", message); + win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, "%s", message); + } + + // save last id and message for LMC + if (id) { + _chatwin_set_last_message(chatwin, id, message); } } @@ -350,7 +351,8 @@ chatwin_outgoing_carbon(ProfChatWin *chatwin, ProfMessage *message) ProfWin *window = (ProfWin*)chatwin; - win_print_outgoing(window, enc_char, "%s", message->plain); + // TODO id set? + win_print_outgoing(window, enc_char, message->id, message->replace_id, "%s", message->plain); int num = wins_get_num(window); status_bar_active(num, WIN_CHAT, chatwin->barejid); } diff --git a/src/ui/privwin.c b/src/ui/privwin.c index 4befc325..9a64cd13 100644 --- a/src/ui/privwin.c +++ b/src/ui/privwin.c @@ -91,11 +91,11 @@ privwin_incoming_msg(ProfPrivateWin *privatewin, ProfMessage *message) } void -privwin_outgoing_msg(ProfPrivateWin *privwin, const char *const message) +privwin_outgoing_msg(ProfPrivateWin *privwin, const char *const id, const char *const replace_id, const char *const message) { assert(privwin != NULL); - win_print_outgoing((ProfWin*)privwin, '-', "%s", message); + win_print_outgoing((ProfWin*)privwin, '-', id, replace_id ,"%s", message); } void diff --git a/src/ui/ui.h b/src/ui/ui.h index e8d42410..6cafd13a 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -124,8 +124,7 @@ ProfChatWin* chatwin_new(const char *const barejid); void chatwin_incoming_msg(ProfChatWin *chatwin, ProfMessage *message, gboolean win_created); void chatwin_receipt_received(ProfChatWin *chatwin, const char *const id); void chatwin_recipient_gone(ProfChatWin *chatwin); -void chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode, - gboolean request_receipt); +void chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id, prof_enc_t enc_mode, gboolean request_receipt, const char *const replace_id); void chatwin_outgoing_carbon(ProfChatWin *chatwin, ProfMessage *message); void chatwin_contact_online(ProfChatWin *chatwin, Resource *resource, GDateTime *last_activity); void chatwin_contact_offline(ProfChatWin *chatwin, char *resource, char *status); @@ -198,8 +197,9 @@ void mucwin_set_message_char(ProfMucWin *mucwin, const char *const ch); void mucwin_unset_message_char(ProfMucWin *mucwin); // MUC private chat window +// TODO repalce_id? void privwin_incoming_msg(ProfPrivateWin *privatewin, ProfMessage *message); -void privwin_outgoing_msg(ProfPrivateWin *privwin, const char *const message); +void privwin_outgoing_msg(ProfPrivateWin *privwin, const char *const id, const char *const replace_id, const char *const message); void privwin_message_occupant_offline(ProfPrivateWin *privwin); void privwin_message_left_room(ProfPrivateWin *privwin); diff --git a/src/ui/window.c b/src/ui/window.c index c668bd34..1218b177 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1183,7 +1183,7 @@ win_println_me_message(ProfWin *window, char ch, const char *const me, const cha } void -win_print_outgoing(ProfWin *window, const char ch, const char *const message, ...) +win_print_outgoing(ProfWin *window, const char ch, const char *const id, const char *const replace_id, const char *const message, ...) { GDateTime *timestamp = g_date_time_new_now_local(); @@ -1192,9 +1192,16 @@ win_print_outgoing(ProfWin *window, const char ch, const char *const message, .. GString *fmt_msg = g_string_new(NULL); g_string_vprintf(fmt_msg, message, arg); - buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL, NULL); + if (replace_id) { + win_correct_incoming(window, fmt_msg->str, id, replace_id); + } else { + //TODO: without this it works. + //buffer_append(window->layout->buffer, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL, id); + + //_win_print(window, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL); + _win_printf(window, ch, 0, timestamp, 0, THEME_TEXT_THEM, "me", id, "%s", fmt_msg->str); + } - _win_print(window, ch, 0, timestamp, 0, THEME_TEXT_ME, "me", fmt_msg->str, NULL); inp_nonblocking(TRUE); g_date_time_unref(timestamp); diff --git a/src/ui/window.h b/src/ui/window.h index b1f9a4af..40e58d7a 100644 --- a/src/ui/window.h +++ b/src/ui/window.h @@ -65,7 +65,7 @@ void win_print_them(ProfWin *window, theme_item_t theme_item, char ch, int flags void win_println_them_message(ProfWin *window, char ch, int flags, const char *const them, const char *const message, ...); void win_println_me_message(ProfWin *window, char ch, const char *const me, const char *const message, ...); -void win_print_outgoing(ProfWin *window, const char ch, const char *const message, ...); +void win_print_outgoing(ProfWin *window, const char ch, const char *const id, const char *const replace_id, const char *const message, ...); void win_print_incoming(ProfWin *window, const char *const from, ProfMessage *message); void win_print_history(ProfWin *window, GDateTime *timestamp, const char *const message, ...); |