about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-10-19 06:36:47 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-10-19 06:36:47 +0200
commitc3912df05b17c513a54b237227a8c96c51bd41ca (patch)
treeea2418e3e24cbeb9b96b5b5ceb044ee80c4bd2d6
parent4d7a496ae2dff956d473b2951f4232b45cbf6d1a (diff)
downloadprofani-tty-c3912df05b17c513a54b237227a8c96c51bd41ca.tar.gz
Move ProfMessage and message_is_sent_by_us to xmpp
Not meant for internal usage only.
-rw-r--r--src/xmpp/message.h23
-rw-r--r--src/xmpp/xmpp.h24
-rw-r--r--tests/unittests/xmpp/stub_xmpp.c1
3 files changed, 24 insertions, 24 deletions
diff --git a/src/xmpp/message.h b/src/xmpp/message.h
index 154fff49..7faa45d7 100644
--- a/src/xmpp/message.h
+++ b/src/xmpp/message.h
@@ -37,28 +37,6 @@
 
 #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 prof_message_t {
-   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;
-   gboolean mucuser;
-} ProfMessage;
-
 typedef int(*ProfMessageCallback)(xmpp_stanza_t *const stanza, void *const userdata);
 typedef void(*ProfMessageFreeCallback)(void *userdata);
 
@@ -67,6 +45,5 @@ void message_free(ProfMessage *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);
-bool message_is_sent_by_us(ProfMessage *message);
 
 #endif
diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h
index 29c0a9f0..4a1b9b2a 100644
--- a/src/xmpp/xmpp.h
+++ b/src/xmpp/xmpp.h
@@ -116,6 +116,28 @@ typedef struct disco_item_t {
     char *name;
 } DiscoItem;
 
+typedef enum {
+    PROF_MSG_ENC_PLAIN,
+    PROF_MSG_ENC_OTR,
+    PROF_MSG_ENC_PGP,
+    PROF_MSG_ENC_OMEMO
+} prof_enc_t;
+
+typedef struct prof_message_t {
+   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;
+   gboolean mucuser;
+} ProfMessage;
+
 void session_init(void);
 jabber_conn_status_t session_connect_with_details(const char *const jid, const char *const passwd,
     const char *const altdomain, const int port, const char *const tls_policy);
@@ -156,6 +178,8 @@ void message_send_paused(const char *const jid);
 void message_send_gone(const char *const jid);
 void message_send_invite(const char *const room, const char *const contact, const char *const reason);
 
+bool message_is_sent_by_us(ProfMessage *message);
+
 void presence_subscription(const char *const jid, const jabber_subscr_t action);
 GList* presence_get_subscription_requests(void);
 gint presence_sub_request_count(void);
diff --git a/tests/unittests/xmpp/stub_xmpp.c b/tests/unittests/xmpp/stub_xmpp.c
index 94129b30..9cc60fad 100644
--- a/tests/unittests/xmpp/stub_xmpp.c
+++ b/tests/unittests/xmpp/stub_xmpp.c
@@ -3,7 +3,6 @@
 #include <setjmp.h>
 #include <cmocka.h>
 
-#include "xmpp/message.h"
 #include "xmpp/xmpp.h"
 
 // connection functions