xep-0308: update the UI upon sending a corrected message
So far we don't do this for encrypted messages. Still needs to be done. And MUC also needs to be done.
This commit is contained in:
@@ -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,16 +324,17 @@ chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id,
|
||||
enc_char = prefs_get_omemo_char();
|
||||
}
|
||||
|
||||
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, id, replace_id, "%s", message);
|
||||
}
|
||||
|
||||
// save last id and message for LMC
|
||||
if (id) {
|
||||
_chatwin_set_last_message(chatwin, id, message);
|
||||
}
|
||||
|
||||
if (request_receipt && id) {
|
||||
win_print_with_receipt((ProfWin*)chatwin, enc_char, "me", message, id);
|
||||
} else {
|
||||
win_print_outgoing((ProfWin*)chatwin, enc_char, "%s", message);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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, ...);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user