about summary refs log tree commit diff stats
path: root/tests/unittests
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-03-26 23:19:53 +0100
committerPaul Fariello <paul@fariello.eu>2019-04-10 17:23:45 +0200
commitdaf84ced0cbead11c930017df1bd713b02776ee3 (patch)
treed939de1bc02d8977faa35f190ad018dafa9c31b0 /tests/unittests
parent4a1c3c8c1ef8c86e28afe34848b2b9d87489c2f1 (diff)
downloadprofani-tty-daf84ced0cbead11c930017df1bd713b02776ee3.tar.gz
Add required OMEMO stub for unit-test
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/log/stub_log.c8
-rw-r--r--tests/unittests/omemo/stub_omemo.c61
-rw-r--r--tests/unittests/ui/stub_ui.c3
3 files changed, 69 insertions, 3 deletions
diff --git a/tests/unittests/log/stub_log.c b/tests/unittests/log/stub_log.c
index e7d744b3..dfbec2bd 100644
--- a/tests/unittests/log/stub_log.c
+++ b/tests/unittests/log/stub_log.c
@@ -58,10 +58,12 @@ void chat_log_init(void) {}
 void chat_log_msg_out(const char * const barejid, const char * const msg) {}
 void chat_log_otr_msg_out(const char * const barejid, const char * const msg) {}
 void chat_log_pgp_msg_out(const char * const barejid, const char * const msg) {}
+void chat_log_omemo_msg_out(const char *const barejid, const char *const msg) {}
 
 void chat_log_msg_in(const char * const barejid, const char * const msg, GDateTime *timestamp) {}
 void chat_log_otr_msg_in(const char * const barejid, const char * const msg, gboolean was_decrypted, GDateTime *timestamp) {}
 void chat_log_pgp_msg_in(const char * const barejid, const char * const msg, GDateTime *timestamp) {}
+void chat_log_omemo_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp) {}
 
 void chat_log_close(void) {}
 GSList * chat_log_get_previous(const gchar * const login,
@@ -71,5 +73,7 @@ GSList * chat_log_get_previous(const gchar * const login,
 }
 
 void groupchat_log_init(void) {}
-void groupchat_log_chat(const gchar * const login, const gchar * const room,
-    const gchar * const nick, const gchar * const msg) {}
+void groupchat_log_msg_in(const gchar *const room, const gchar *const nick, const gchar *const msg) {}
+void groupchat_log_msg_out(const gchar *const room, const gchar *const msg) {}
+void groupchat_log_omemo_msg_in(const gchar *const room, const gchar *const nick, const gchar *const msg) {}
+void groupchat_log_omemo_msg_out(const gchar *const room, const gchar *const msg) {}
diff --git a/tests/unittests/omemo/stub_omemo.c b/tests/unittests/omemo/stub_omemo.c
new file mode 100644
index 00000000..200226b0
--- /dev/null
+++ b/tests/unittests/omemo/stub_omemo.c
@@ -0,0 +1,61 @@
+#include <glib.h>
+
+#include "config/account.h"
+#include "ui/ui.h"
+
+void omemo_init(void) {}
+
+char*
+omemo_fingerprint_autocomplete(const char *const search_str, gboolean previous)
+{
+    return NULL;
+}
+
+void omemo_fingerprint_autocomplete_reset(void) {}
+
+char *
+omemo_format_fingerprint(const char *const fingerprint)
+{
+    return NULL;
+}
+
+void omemo_generate_crypto_materials(ProfAccount *account) {}
+
+gboolean
+omemo_is_trusted_identity(const char *const jid, const char *const fingerprint)
+{
+    return TRUE;
+}
+
+GList *
+omemo_known_device_identities(const char *const jid)
+{
+    return NULL;
+}
+
+gboolean
+omemo_loaded(void)
+{
+    return TRUE;
+}
+
+void omemo_on_connect(ProfAccount *account) {}
+void omemo_on_disconnect(void) {}
+
+char *
+omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc)
+{
+    return NULL;
+}
+
+char *
+omemo_own_fingerprint(gboolean formatted)
+{
+    return NULL;
+}
+
+void omemo_start_muc_sessions(const char *const roomjid) {}
+void omemo_start_session(const char *const barejid) {}
+void omemo_trust(const char *const jid, const char *const fingerprint_formatted) {}
+void omemo_untrust(const char *const jid, const char *const fingerprint_formatted) {}
+void omemo_devicelist_publish(GList *device_list) {}
diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c
index 855dca22..e08c3ce1 100644
--- a/tests/unittests/ui/stub_ui.c
+++ b/tests/unittests/ui/stub_ui.c
@@ -190,7 +190,8 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char
     const char * const affiliation, const char * const actor, const char * const reason) {}
 void mucwin_roster(ProfMucWin *mucwin, GList *occupants, const char * const presence) {}
 void mucwin_history(ProfMucWin *mucwin, const char * const nick, GDateTime *timestamp, const char * const message) {}
-void mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message, GSList *mentions, GList *triggers) {}
+void mucwin_incoming_msg(ProfMucWin *mucwin, const char *const nick, const char *const message, GSList *mentions, GList *triggers, prof_enc_t enc_mode) {}
+void mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, prof_enc_t enc_mode) {}
 void mucwin_subject(ProfMucWin *mucwin, const char * const nick, const char * const subject) {}
 void mucwin_requires_config(ProfMucWin *mucwin) {}
 void ui_room_destroy(const char * const roomjid) {}