about summary refs log tree commit diff stats
path: root/src/xmpp/message.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmpp/message.h')
-rw-r--r--src/xmpp/message.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/xmpp/message.h b/src/xmpp/message.h
index b73406a0..f4861378 100644
--- a/src/xmpp/message.h
+++ b/src/xmpp/message.h
@@ -35,14 +35,34 @@
 #ifndef XMPP_MESSAGE_H
 #define XMPP_MESSAGE_H
 
-#define PROF_MSG_ENC_OTR     1
-#define PROF_MSG_ENC_PGP     2
-#define PROF_MSG_ENC_OMEMO   4
-#define PROF_MSG_TRUSTED     8
+#include "xmpp/xmpp.h"
+
+typedef enum {
+    PROF_MSG_ENC_PLAIN,
+    PROF_MSG_ENC_OTR,
+    PROF_MSG_ENC_PGP,
+    PROF_MSG_ENC_OMEMO
+} prof_enc_t;
+
+typedef struct {
+   Jid *jid;
+   char *id;
+   /* The raw body from xmpp message, either plaintext or OTR encrypted text */
+   char *body;
+   /* The encrypted message as for PGP */
+   char *encrypted;
+   /* The message that will be printed on screen and logs */
+   char *plain;
+   GDateTime *timestamp;
+   prof_enc_t enc;
+   gboolean trusted;
+} prof_message_t;
 
 typedef int(*ProfMessageCallback)(xmpp_stanza_t *const stanza, void *const userdata);
 typedef void(*ProfMessageFreeCallback)(void *userdata);
 
+prof_message_t *message_init(void);
+void message_free(prof_message_t *message);
 void message_handlers_init(void);
 void message_handlers_clear(void);
 void message_pubsub_event_handler_add(const char *const node, ProfMessageCallback func, ProfMessageFreeCallback free_func, void *userdata);