1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

xep-0308: enable correction in outgoing messages with delivery receipts

This commit is contained in:
Michael Vetter 2020-02-13 12:24:12 +01:00
parent 3aad0523d7
commit 9b3593bdf9
3 changed files with 10 additions and 8 deletions

View File

@ -326,8 +326,7 @@ chatwin_outgoing_msg(ProfChatWin *chatwin, const char *const message, char *id,
} }
if (request_receipt && id) { if (request_receipt && id) {
//TODO: replace_id and id win_print_outgoing_with_receipt((ProfWin*)chatwin, enc_char, "me", message, id, replace_id);
win_print_outgoing_with_receipt((ProfWin*)chatwin, enc_char, "me", message, id);
} else { } else {
win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, "%s", message); win_print_outgoing((ProfWin*)chatwin, enc_char, id, replace_id, "%s", message);
} }

View File

@ -1381,19 +1381,23 @@ win_appendln_highlight(ProfWin *window, theme_item_t theme_item, const char *con
void void
win_print_http_upload(ProfWin *window, const char *const message, char *url) win_print_http_upload(ProfWin *window, const char *const message, char *url)
{ {
win_print_outgoing_with_receipt(window, '!', NULL, message, url); win_print_outgoing_with_receipt(window, '!', NULL, message, url, NULL);
} }
void void
win_print_outgoing_with_receipt(ProfWin *window, const char show_char, const char *const from, const char *const message, char *id) 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)
{ {
GDateTime *time = g_date_time_new_now_local(); GDateTime *time = g_date_time_new_now_local();
DeliveryReceipt *receipt = malloc(sizeof(struct delivery_receipt_t)); DeliveryReceipt *receipt = malloc(sizeof(struct delivery_receipt_t));
receipt->received = FALSE; receipt->received = FALSE;
buffer_append(window->layout->buffer, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt, id); if (replace_id) {
_win_print_internal(window, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt); _win_correct(window, message, id, replace_id);
} else {
buffer_append(window->layout->buffer, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt, id);
_win_print_internal(window, show_char, 0, time, 0, THEME_TEXT_ME, from, message, receipt);
}
// TODO: cross-reference.. this should be replaced by a real event-based system // TODO: cross-reference.. this should be replaced by a real event-based system
inp_nonblocking(TRUE); inp_nonblocking(TRUE);

View File

@ -72,8 +72,7 @@ void win_print_history(ProfWin *window, GDateTime *timestamp, const char *const
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);
void win_print_outgoing_with_receipt(ProfWin *window, const char show_char, const char *const from, const char *const message, 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);
char *id);
void win_newline(ProfWin *window); void win_newline(ProfWin *window);
void win_redraw(ProfWin *window); void win_redraw(ProfWin *window);