summaryrefslogtreecommitdiff
path: root/data.h
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2022-08-19 10:51:24 +0200
committerxengineering <me@xengineering.eu>2022-08-19 12:13:49 +0200
commit43aa02ccbd484d8c7cecec7c38c446847b34e007 (patch)
tree5e34779ee75c8788760d74a9f73a01575c335f54 /data.h
parent4c848f4085cd174d1ad54169632a95023774717b (diff)
downloadlimox-43aa02ccbd484d8c7cecec7c38c446847b34e007.tar
limox-43aa02ccbd484d8c7cecec7c38c446847b34e007.tar.zst
limox-43aa02ccbd484d8c7cecec7c38c446847b34e007.zip
Implement new datastructures
Diffstat (limited to 'data.h')
-rw-r--r--data.h38
1 files changed, 36 insertions, 2 deletions
diff --git a/data.h b/data.h
index 6fabbe6..6b6e936 100644
--- a/data.h
+++ b/data.h
@@ -1,2 +1,36 @@
-void add_roster_item(const char* jid, const char* subscription, const char* name);
-void* data_get_chat_page(void* roster_item_widget);
+#ifndef DATA_H
+#define DATA_H
+
+// https://www.rfc-editor.org/rfc/rfc6121#section-2.1.2.5
+typedef enum {
+ SUB_NONE,
+ SUB_TO,
+ SUB_FROM,
+ SUB_BOTH
+} subscription_t;
+
+typedef struct _message_t {
+ char* content;
+ char* sender_jid;
+ struct _message_t* next;
+ void* widget;
+} message_t;
+
+typedef struct _chat_t {
+ message_t* messages;
+ void* widget;
+} chat_t;
+
+typedef struct _roster_item_t {
+ char* name; // could be NULL
+ char* jid;
+ subscription_t sub;
+ chat_t* chat;
+ struct _roster_item_t* next;
+ void* widget;
+} roster_item_t;
+
+void data_add_roster_item(const char* jid, const char* subscription,
+ const char* name);
+void data_add_incoming_message(const char* sender_jid, const char* content);
+#endif