about summary refs log tree commit diff stats
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-02-13 12:24:12 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-14 10:17:07 +0100
commit9b3593bdf9e00bb042de80f250899d201eccb091 (patch)
tree9d34c1c36d65a4f987a7d32946fe872a09fe3897 /src/ui/window.c
parent3aad0523d786ade3be55d3ec1b10ebacc4471bd7 (diff)
downloadprofani-tty-9b3593bdf9e00bb042de80f250899d201eccb091.tar.gz
xep-0308: enable correction in outgoing messages with delivery receipts
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 4d369c3a..4f6ceb2e 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -1381,19 +1381,23 @@ win_appendln_highlight(ProfWin *window, theme_item_t theme_item, const char *con
 void
 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
-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();
 
     DeliveryReceipt *receipt = malloc(sizeof(struct delivery_receipt_t));
     receipt->received = FALSE;
 
-    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);
+    if (replace_id) {
+        _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
     inp_nonblocking(TRUE);