diff options
-rw-r--r-- | src/event/client_events.c | 29 | ||||
-rw-r--r-- | src/event/server_events.c | 66 | ||||
-rw-r--r-- | src/event/server_events.h | 4 | ||||
-rw-r--r-- | src/log.c | 64 | ||||
-rw-r--r-- | src/log.h | 7 | ||||
-rw-r--r-- | src/omemo/omemo.c | 72 | ||||
-rw-r--r-- | src/omemo/omemo.h | 2 | ||||
-rw-r--r-- | src/ui/mucwin.c | 46 | ||||
-rw-r--r-- | src/ui/ui.h | 3 | ||||
-rw-r--r-- | src/ui/window.c | 1 | ||||
-rw-r--r-- | src/xmpp/message.c | 7 |
11 files changed, 227 insertions, 74 deletions
diff --git a/src/event/client_events.c b/src/event/client_events.c index 1488174a..d1cdc797 100644 --- a/src/event/client_events.c +++ b/src/event/client_events.c @@ -218,7 +218,10 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo #ifndef HAVE_LIBGPGME #ifdef HAVE_OMEMO if (chatwin->is_omemo) { - omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); + char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); + chat_log_omemo_msg_out(chatwin->barejid, plugin_msg); + chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt); + free(id); } else { char *id = message_send_chat(chatwin->barejid, plugin_msg, oob_url, request_receipt); chat_log_msg_out(chatwin->barejid, plugin_msg); @@ -238,7 +241,10 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo #ifndef HAVE_LIBGPGME #ifdef HAVE_OMEMO if (chatwin->is_omemo) { - omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); + char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); + chat_log_omemo_msg_out(chatwin->barejid, plugin_msg); + chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt); + free(id); } else { gboolean handled = otr_on_message_send(chatwin, plugin_msg, request_receipt); if (!handled) { @@ -261,7 +267,10 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo #ifdef HAVE_LIBGPGME #ifdef HAVE_OMEMO if (chatwin->is_omemo) { - omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); + char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); + chat_log_omemo_msg_out(chatwin->barejid, plugin_msg); + chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt); + free(id); } else if (chatwin->pgp_send) { char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt); chat_log_pgp_msg_out(chatwin->barejid, plugin_msg); @@ -286,7 +295,10 @@ cl_ev_send_msg(ProfChatWin *chatwin, const char *const msg, const char *const oo #ifdef HAVE_LIBGPGME #ifdef HAVE_OMEMO if (chatwin->is_omemo) { - omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); + char *id = omemo_on_message_send((ProfWin *)chatwin, plugin_msg, request_receipt, FALSE); + chat_log_omemo_msg_out(chatwin->barejid, plugin_msg); + chatwin_outgoing_msg(chatwin, plugin_msg, id, PROF_MSG_OMEMO, request_receipt); + free(id); } else if (chatwin->pgp_send) { char *id = message_send_chat_pgp(chatwin->barejid, plugin_msg, request_receipt); chat_log_pgp_msg_out(chatwin->barejid, plugin_msg); @@ -336,9 +348,14 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const #ifdef HAVE_OMEMO if (mucwin->is_omemo) { - omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE); + char *id = omemo_on_message_send((ProfWin *)mucwin, plugin_msg, FALSE, TRUE); + groupchat_log_omemo_msg_out(mucwin->roomjid, plugin_msg); + mucwin_outgoing_msg(mucwin, plugin_msg, PROF_MSG_OMEMO); + free(id); } else { message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url); + groupchat_log_msg_out(mucwin->roomjid, plugin_msg); + mucwin_outgoing_msg(mucwin, plugin_msg, PROF_MSG_PLAIN); } plugins_post_room_message_send(mucwin->roomjid, plugin_msg); @@ -348,6 +365,8 @@ cl_ev_send_muc_msg(ProfMucWin *mucwin, const char *const msg, const char *const #ifndef HAVE_OMEMO message_send_groupchat(mucwin->roomjid, plugin_msg, oob_url); + groupchat_log_msg_out(mucwin->roomjid, plugin_msg); + mucwin_outgoing_msg(mucwin, plugin_msg, id, PROF_MSG_PLAIN, request_receipt); plugins_post_room_message_send(mucwin->roomjid, plugin_msg); free(plugin_msg); diff --git a/src/event/server_events.c b/src/event/server_events.c index 7f293198..fd719cc1 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -260,21 +260,26 @@ sv_ev_room_history(const char *const room_jid, const char *const nick, } void -sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message) +sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message, gboolean omemo) { - if (prefs_get_boolean(PREF_GRLOG)) { - Jid *jid = jid_create(connection_get_fulljid()); - groupchat_log_chat(jid->barejid, room_jid, nick, message); - jid_destroy(jid); - } - ProfMucWin *mucwin = wins_get_muc(room_jid); if (!mucwin) { return; } - char *new_message = plugins_pre_room_message_display(room_jid, nick, message); char *mynick = muc_nick(mucwin->roomjid); + if (g_strcmp0(mynick, nick) == 0) { + /* Ignore message reflection */ + return; + } + + if (omemo) { + groupchat_log_omemo_msg_in(room_jid, nick, message); + } else { + groupchat_log_msg_in(room_jid, nick, message); + } + + char *new_message = plugins_pre_room_message_display(room_jid, nick, message); gboolean whole_word = prefs_get_boolean(PREF_NOTIFY_MENTION_WHOLE_WORD); gboolean case_sensitive = prefs_get_boolean(PREF_NOTIFY_MENTION_CASE_SENSITIVE); @@ -289,7 +294,11 @@ sv_ev_room_message(const char *const room_jid, const char *const nick, const cha GList *triggers = prefs_message_get_triggers(new_message); - mucwin_message(mucwin, nick, new_message, mentions, triggers); + if (omemo) { + mucwin_incoming_msg(mucwin, nick, new_message, mentions, triggers, PROF_MSG_OMEMO); + } else { + mucwin_incoming_msg(mucwin, nick, new_message, mentions, triggers, PROF_MSG_PLAIN); + } g_slist_free(mentions); @@ -607,15 +616,50 @@ sv_ev_incoming_carbon(char *barejid, char *resource, char *message, char *pgp_me } #ifdef HAVE_LIBGPGME +#ifndef HAVE_OMEMO if (pgp_message) { _sv_ev_incoming_pgp(chatwin, new_win, barejid, resource, message, pgp_message, NULL); } else { _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL); } -#else - _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL); + rosterwin_roster(); + return; +#endif #endif + +#ifdef HAVE_LIBGPGME +#ifdef HAVE_OMEMO + if (pgp_message) { + _sv_ev_incoming_pgp(chatwin, new_win, barejid, resource, message, pgp_message, NULL); + } else if (omemo) { + _sv_ev_incoming_omemo(chatwin, new_win, barejid, resource, message, NULL); + } else { + _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL); + } rosterwin_roster(); + return; +#endif +#endif + +#ifndef HAVE_LIBGPGME +#ifdef HAVE_OMEMO + if (omemo) { + _sv_ev_incoming_omemo(chatwin, new_win, barejid, resource, message, NULL); + } else { + _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL); + } + rosterwin_roster(); + return; +#endif +#endif + +#ifndef HAVE_LIBGPGME +#ifndef HAVE_OMEMO + _sv_ev_incoming_plain(chatwin, new_win, barejid, resource, message, NULL); + rosterwin_roster(); + return; +#endif +#endif } void diff --git a/src/event/server_events.h b/src/event/server_events.h index 96fdb58c..0fa9989f 100644 --- a/src/event/server_events.h +++ b/src/event/server_events.h @@ -46,9 +46,9 @@ void sv_ev_room_invite(jabber_invite_t invite_type, void sv_ev_room_broadcast(const char *const room_jid, const char *const message); void sv_ev_room_subject(const char *const room, const char *const nick, const char *const subject); void sv_ev_room_history(const char *const room_jid, const char *const nick, - GDateTime *timestamp, const char *const message); + GDateTime *timestamp, const char *const message, gboolean omemo); void sv_ev_room_message(const char *const room_jid, const char *const nick, - const char *const message); + const char *const message, gboolean omemo); void sv_ev_incoming_message(char *barejid, char *resource, char *message, char *pgp_message, GDateTime *timestamp, gboolean omemo); void sv_ev_incoming_private_message(const char *const fulljid, char *message); void sv_ev_delayed_private_message(const char *const fulljid, char *message, GDateTime *timestamp); diff --git a/src/log.c b/src/log.c index 090fd2f8..b679eb1a 100644 --- a/src/log.c +++ b/src/log.c @@ -48,6 +48,7 @@ #include "config/files.h" #include "config/preferences.h" #include "xmpp/xmpp.h" +#include "xmpp/muc.h" #define PROF "prof" @@ -89,6 +90,8 @@ static void _rotate_log_file(void); static char* _log_string_from_level(log_level_t level); static void _chat_log_chat(const char *const login, const char *const other, const gchar *const msg, chat_log_direction_t direction, GDateTime *timestamp); +static void _groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, + const gchar *const msg); void log_debug(const char *const msg, ...) @@ -440,7 +443,66 @@ _chat_log_chat(const char *const login, const char *const other, const char *con } void -groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, const gchar *const msg) +groupchat_log_msg_out(const gchar *const room, const gchar *const msg) +{ + if (prefs_get_boolean(PREF_GRLOG)) { + const char *jid = connection_get_fulljid(); + Jid *jidp = jid_create(jid); + char *mynick = muc_nick(room); + _groupchat_log_chat(jidp->barejid, room, mynick, msg); + jid_destroy(jidp); + } +} + +void +groupchat_log_msg_in(const gchar *const room, const gchar *const nick, const gchar *const msg) +{ + if (prefs_get_boolean(PREF_GRLOG)) { + const char *jid = connection_get_fulljid(); + Jid *jidp = jid_create(jid); + _groupchat_log_chat(jidp->barejid, room, nick, msg); + jid_destroy(jidp); + } +} + +void +groupchat_log_omemo_msg_out(const gchar *const room, const gchar *const msg) +{ + if (prefs_get_boolean(PREF_CHLOG)) { + const char *jid = connection_get_fulljid(); + Jid *jidp = jid_create(jid); + char *pref_omemo_log = prefs_get_string(PREF_OMEMO_LOG); + char *mynick = muc_nick(room); + if (strcmp(pref_omemo_log, "on") == 0) { + _groupchat_log_chat(jidp->barejid, room, mynick, msg); + } else if (strcmp(pref_omemo_log, "redact") == 0) { + _groupchat_log_chat(jidp->barejid, room, mynick, "[redacted]"); + } + prefs_free_string(pref_omemo_log); + jid_destroy(jidp); + } +} + +void +groupchat_log_omemo_msg_in(const gchar *const room, const gchar *const nick, const gchar *const msg) +{ + if (prefs_get_boolean(PREF_CHLOG)) { + const char *jid = connection_get_fulljid(); + Jid *jidp = jid_create(jid); + char *pref_omemo_log = prefs_get_string(PREF_OMEMO_LOG); + if (strcmp(pref_omemo_log, "on") == 0) { + _groupchat_log_chat(jidp->barejid, room, nick, msg); + } else if (strcmp(pref_omemo_log, "redact") == 0) { + _groupchat_log_chat(jidp->barejid, room, nick, "[redacted]"); + } + prefs_free_string(pref_omemo_log); + jid_destroy(jidp); + } +} + +void +_groupchat_log_chat(const gchar *const login, const gchar *const room, const gchar *const nick, + const gchar *const msg) { struct dated_chat_log *dated_log = g_hash_table_lookup(groupchat_logs, room); diff --git a/src/log.h b/src/log.h index b14231b7..1f45545c 100644 --- a/src/log.h +++ b/src/log.h @@ -82,7 +82,10 @@ void chat_log_close(void); GSList* chat_log_get_previous(const gchar *const login, const gchar *const recipient); 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_out(const gchar *const room, const gchar *const msg); +void groupchat_log_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); +void groupchat_log_omemo_msg_in(const gchar *const room, const gchar *const nick, const gchar *const msg); #endif diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c index 3fb52b08..548c3b9c 100644 --- a/src/omemo/omemo.c +++ b/src/omemo/omemo.c @@ -542,16 +542,14 @@ out: jid_destroy(ownjid); } -gboolean +char * omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc) { + char *id = NULL; int res; - gboolean ret = FALSE; Jid *jid = jid_create(connection_get_fulljid()); GList *keys = NULL; - GList *sender_device_id = g_hash_table_lookup(omemo_ctx.device_list, jid->barejid); - unsigned char *key; unsigned char *iv; unsigned char *ciphertext; @@ -643,50 +641,48 @@ omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_ g_list_free_full(recipients, free); - for (device_ids_iter = sender_device_id; device_ids_iter != NULL; device_ids_iter = device_ids_iter->next) { - int res; - ciphertext_message *ciphertext; - session_cipher *cipher; - signal_protocol_address address = { - .name = jid->barejid, - .name_len = strlen(jid->barejid), - .device_id = GPOINTER_TO_INT(device_ids_iter->data) - }; - - res = session_cipher_create(&cipher, omemo_ctx.store, &address, omemo_ctx.signal); - if (res != 0) { - log_error("OMEMO: cannot create cipher for %s device id %d", address.name, address.device_id); - continue; - } + if (!muc) { + GList *sender_device_id = g_hash_table_lookup(omemo_ctx.device_list, jid->barejid); + for (device_ids_iter = sender_device_id; device_ids_iter != NULL; device_ids_iter = device_ids_iter->next) { + int res; + ciphertext_message *ciphertext; + session_cipher *cipher; + signal_protocol_address address = { + .name = jid->barejid, + .name_len = strlen(jid->barejid), + .device_id = GPOINTER_TO_INT(device_ids_iter->data) + }; - res = session_cipher_encrypt(cipher, key_tag, AES128_GCM_KEY_LENGTH + AES128_GCM_TAG_LENGTH, &ciphertext); - if (res != 0) { - log_error("OMEMO: cannot encrypt key for %s device id %d", address.name, address.device_id); - continue; + res = session_cipher_create(&cipher, omemo_ctx.store, &address, omemo_ctx.signal); + if (res != 0) { + log_error("OMEMO: cannot create cipher for %s device id %d", address.name, address.device_id); + continue; + } + + res = session_cipher_encrypt(cipher, key_tag, AES128_GCM_KEY_LENGTH + AES128_GCM_TAG_LENGTH, &ciphertext); + if (res != 0) { + log_error("OMEMO: cannot encrypt key for %s device id %d", address.name, address.device_id); + continue; + } + signal_buffer *buffer = ciphertext_message_get_serialized(ciphertext); + omemo_key_t *key = malloc(sizeof(omemo_key_t)); + key->data = signal_buffer_data(buffer); + key->length = signal_buffer_len(buffer); + key->device_id = GPOINTER_TO_INT(device_ids_iter->data); + key->prekey = ciphertext_message_get_type(ciphertext) == CIPHERTEXT_PREKEY_TYPE; + keys = g_list_append(keys, key); } - signal_buffer *buffer = ciphertext_message_get_serialized(ciphertext); - omemo_key_t *key = malloc(sizeof(omemo_key_t)); - key->data = signal_buffer_data(buffer); - key->length = signal_buffer_len(buffer); - key->device_id = GPOINTER_TO_INT(device_ids_iter->data); - key->prekey = ciphertext_message_get_type(ciphertext) == CIPHERTEXT_PREKEY_TYPE; - keys = g_list_append(keys, key); } if (muc) { ProfMucWin *mucwin = (ProfMucWin *)win; assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK); - char *id = message_send_chat_omemo(mucwin->roomjid, omemo_ctx.device_id, keys, iv, AES128_GCM_IV_LENGTH, ciphertext, ciphertext_len, request_receipt, TRUE); - free(id); + id = message_send_chat_omemo(mucwin->roomjid, omemo_ctx.device_id, keys, iv, AES128_GCM_IV_LENGTH, ciphertext, ciphertext_len, request_receipt, TRUE); } else { ProfChatWin *chatwin = (ProfChatWin *)win; assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); - char *id = message_send_chat_omemo(chatwin->barejid, omemo_ctx.device_id, keys, iv, AES128_GCM_IV_LENGTH, ciphertext, ciphertext_len, request_receipt, FALSE); - chat_log_omemo_msg_out(chatwin->barejid, message); - chatwin_outgoing_msg(chatwin, message, id, PROF_MSG_OMEMO, request_receipt); - free(id); + id = message_send_chat_omemo(chatwin->barejid, omemo_ctx.device_id, keys, iv, AES128_GCM_IV_LENGTH, ciphertext, ciphertext_len, request_receipt, FALSE); } - ret = TRUE; out: jid_destroy(jid); @@ -697,7 +693,7 @@ out: gcry_free(tag); gcry_free(key_tag); - return ret; + return id; } char * diff --git a/src/omemo/omemo.h b/src/omemo/omemo.h index a8af1a66..e78bd09b 100644 --- a/src/omemo/omemo.h +++ b/src/omemo/omemo.h @@ -40,5 +40,5 @@ void omemo_start_muc_sessions(const char *const roomjid); void omemo_start_device_session(const char *const jid, uint32_t device_id, GList *prekeys, uint32_t signed_prekey_id, const unsigned char *const signed_prekey, size_t signed_prekey_len, const unsigned char *const signature, size_t signature_len, const unsigned char *const identity_key, size_t identity_key_len); gboolean omemo_loaded(void); -gboolean omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc); +char * omemo_on_message_send(ProfWin *win, const char *const message, gboolean request_receipt, gboolean muc); char * omemo_on_message_recv(const char *const from, uint32_t sid, const unsigned char *const iv, size_t iv_len, GList *keys, const unsigned char *const payload, size_t payload_len, gboolean muc); diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 0f9f4f2b..abbcd21c 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -478,7 +478,7 @@ _mucwin_print_triggers(ProfWin *window, const char *const message, GList *trigge } void -mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const message, GSList *mentions, GList *triggers) +mucwin_outgoing_msg(ProfMucWin *mucwin, const char *const message, prof_enc_t enc_mode) { assert(mucwin != NULL); @@ -488,19 +488,43 @@ mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const mes char ch = '-'; if (mucwin->message_char) { ch = mucwin->message_char[0]; + } else if (enc_mode == PROF_MSG_OTR) { + ch = prefs_get_otr_char(); + } else if (enc_mode == PROF_MSG_PGP) { + ch = prefs_get_pgp_char(); + } else if (enc_mode == PROF_MSG_OMEMO) { + ch = prefs_get_omemo_char(); } - if (g_strcmp0(nick, mynick) != 0) { - if (g_slist_length(mentions) > 0) { - _mucwin_print_mention(window, message, nick, mynick, mentions, &ch); - } else if (triggers) { - win_print_them(window, THEME_ROOMTRIGGER, ch, nick); - _mucwin_print_triggers(window, message, triggers); - } else { - win_println_them_message(window, ch, nick, "%s", message); - } + win_println_me_message(window, ch, mynick, "%s", message); +} + +void +mucwin_incoming_msg(ProfMucWin *mucwin, const char *const nick, const char *const message, GSList *mentions, GList *triggers, prof_enc_t enc_mode) +{ + assert(mucwin != NULL); + + ProfWin *window = (ProfWin*)mucwin; + char *mynick = muc_nick(mucwin->roomjid); + + char ch = '-'; + if (mucwin->message_char) { + ch = mucwin->message_char[0]; + } else if (enc_mode == PROF_MSG_OTR) { + ch = prefs_get_otr_char(); + } else if (enc_mode == PROF_MSG_PGP) { + ch = prefs_get_pgp_char(); + } else if (enc_mode == PROF_MSG_OMEMO) { + ch = prefs_get_omemo_char(); + } + + if (g_slist_length(mentions) > 0) { + _mucwin_print_mention(window, message, nick, mynick, mentions, &ch); + } else if (triggers) { + win_print_them(window, THEME_ROOMTRIGGER, ch, nick); + _mucwin_print_triggers(window, message, triggers); } else { - win_println_me_message(window, ch, mynick, "%s", message); + win_println_them_message(window, ch, nick, "%s", message); } } diff --git a/src/ui/ui.h b/src/ui/ui.h index 95d291b4..e3cece81 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -162,7 +162,8 @@ void mucwin_occupant_role_and_affiliation_change(ProfMucWin *mucwin, const char const char *const role, 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_outgoing_msg(ProfMucWin *mucwin, const char *const message, prof_enc_t enc_mode); +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_subject(ProfMucWin *mucwin, const char *const nick, const char *const subject); void mucwin_requires_config(ProfMucWin *mucwin); void mucwin_info(ProfMucWin *mucwin); diff --git a/src/ui/window.c b/src/ui/window.c index ef0f93d2..64b04365 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -197,6 +197,7 @@ win_create_muc(const char *const roomjid) } new_win->enctext = NULL; new_win->message_char = NULL; + new_win->is_omemo = FALSE; new_win->memcheck = PROFMUCWIN_MEMCHECK; diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 47a21438..cc3d66bd 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -729,8 +729,11 @@ _handle_groupchat(xmpp_stanza_t *const stanza) return; } + // check omemo encryption + gboolean omemo = FALSE; #ifdef HAVE_OMEMO message = omemo_receive_message(stanza); + omemo = message != NULL; #endif if (!message) { @@ -744,10 +747,10 @@ _handle_groupchat(xmpp_stanza_t *const stanza) // determine if the notifications happened whilst offline GDateTime *timestamp = stanza_get_delay(stanza); if (timestamp) { - sv_ev_room_history(jid->barejid, jid->resourcepart, timestamp, message); + sv_ev_room_history(jid->barejid, jid->resourcepart, timestamp, message, omemo); g_date_time_unref(timestamp); } else { - sv_ev_room_message(jid->barejid, jid->resourcepart, message); + sv_ev_room_message(jid->barejid, jid->resourcepart, message, omemo); } xmpp_free(ctx, message); |