diff options
author | Michael Vetter <jubalh@iodoru.org> | 2020-04-11 23:56:01 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2020-04-11 23:56:01 +0200 |
commit | dd566d8d561099bbfc81b2fab22318bbad0cf3da (patch) | |
tree | 2e32e9ff2a68d02dda146cf8897174553112d24b /src/event | |
parent | 180ec2b474b39de0b22964adbfc5e13bc3d2c791 (diff) | |
download | profani-tty-dd566d8d561099bbfc81b2fab22318bbad0cf3da.tar.gz |
MAM: Correctly display incoming MAM chat message
Diffstat (limited to 'src/event')
-rw-r--r-- | src/event/server_events.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c index 11b5d877..057af9bf 100644 --- a/src/event/server_events.c +++ b/src/event/server_events.c @@ -622,16 +622,30 @@ void sv_ev_incoming_message(ProfMessage *message) { gboolean new_win = FALSE; - ProfChatWin *chatwin = wins_get_chat(message->from_jid->barejid); + ProfChatWin *chatwin; + char *looking_for_jid = message->from_jid->barejid; + + if (message->is_mam) { + Jid *my_jid = jid_create(connection_get_fulljid()); + if (g_strcmp0(my_jid->barejid, message->from_jid->barejid) == 0) { + looking_for_jid = message->to_jid->barejid; + } + jid_destroy(my_jid); + } + + chatwin = wins_get_chat(looking_for_jid); + if (!chatwin) { - ProfWin *window = wins_new_chat(message->from_jid->barejid); + ProfWin *window = wins_new_chat(looking_for_jid); chatwin = (ProfChatWin*)window; new_win = TRUE; #ifdef HAVE_OMEMO - if (omemo_automatic_start(message->from_jid->barejid)) { - omemo_start_session(message->from_jid->barejid); - chatwin->is_omemo = TRUE; + if (!message->is_mam) { + if (omemo_automatic_start(message->from_jid->barejid)) { + omemo_start_session(message->from_jid->barejid); + chatwin->is_omemo = TRUE; + } } #endif } |