about summary refs log tree commit diff stats
path: root/src/ui/buffer.h
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-11-01 17:53:59 +0100
committerMichael Vetter <jubalh@iodoru.org>2019-11-01 17:53:59 +0100
commitbc282ef569ecd068cc8d523601264d9f4beefafe (patch)
treeab8f0e1cbe656b20a7f25c377cecdb3375db88c5 /src/ui/buffer.h
parentd5212d859389f14409af99b2708c4d002662fb92 (diff)
downloadprofani-tty-bc282ef569ecd068cc8d523601264d9f4beefafe.tar.gz
Move id from DeliveryReceipt to ProfBuffEntry struct
XEP-0184: Message Delivery Receipts, *requires* the id attribute.
Generally this is not the case.
For this reason the id was only present in the DeliveryReceipt struct
since it was only used for XEP-0184.

For https://github.com/profanity-im/profanity/issues/660 XEP-0313 MAM
and https://github.com/profanity-im/profanity/issues/805 XEP-0308 Last Message Correction
we will also need the id.

So in preparation for further work let's move the id to the general
ProfBuffEntry.

We will need to adapt code so that we actually always write the ID if we
receive one.
Diffstat (limited to 'src/ui/buffer.h')
-rw-r--r--src/ui/buffer.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ui/buffer.h b/src/ui/buffer.h
index 243b003a..b11a5381 100644
--- a/src/ui/buffer.h
+++ b/src/ui/buffer.h
@@ -41,7 +41,6 @@
 #include "config/theme.h"
 
 typedef struct delivery_receipt_t {
-    char *id;
     gboolean received;
 } DeliveryReceipt;
 
@@ -54,14 +53,16 @@ typedef struct prof_buff_entry_t {
     char *from;
     char *message;
     DeliveryReceipt *receipt;
+    // message id, in case we have it
+    char *id;
 } ProfBuffEntry;
 
 typedef struct prof_buff_t *ProfBuff;
 
 ProfBuff buffer_create();
 void buffer_free(ProfBuff buffer);
-void buffer_append(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time, int flags, theme_item_t theme_item,
-    const char *const from, const char *const message, DeliveryReceipt *receipt);
+void buffer_append(ProfBuff buffer, const char show_char, int pad_indent, GDateTime *time,
+    int flags, theme_item_t theme_item, const char *const from, const char *const message, DeliveryReceipt *receipt, const char *const id);
 int buffer_size(ProfBuff buffer);
 ProfBuffEntry* buffer_get_entry(ProfBuff buffer, int entry);
 ProfBuffEntry* buffer_get_entry_by_id(ProfBuff buffer, const char *const id);