mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 19:56:22 +00:00
Log incoming MUC messages if origin-id sais they dont come from us
Regards https://github.com/profanity-im/profanity/issues/1201
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include "event/common.h"
|
||||
#include "plugins/plugins.h"
|
||||
#include "ui/window_list.h"
|
||||
#include "xmpp/connection.h"
|
||||
#include "xmpp/muc.h"
|
||||
#include "xmpp/chat_session.h"
|
||||
#include "xmpp/roster_list.h"
|
||||
@@ -294,8 +295,25 @@ sv_ev_room_message(ProfMessage *message)
|
||||
|
||||
char *mynick = muc_nick(mucwin->roomjid);
|
||||
|
||||
// only log messages from others. we log our own via mucwin_outgoing_msg()
|
||||
if (g_strcmp0(mynick, message->jid->resourcepart) != 0) {
|
||||
// messages from ourselves
|
||||
if (g_strcmp0(mynick, message->jid->resourcepart) == 0) {
|
||||
// test if message was sent from this client
|
||||
// we check the </origin-id> for this we calculate a hash into it so we can detect
|
||||
// whether this client sent it. See connection_create_stanza_id()
|
||||
gsize tmp_len;
|
||||
char *tmp = (char*)g_base64_decode(message->id, &tmp_len);
|
||||
if (tmp_len > 10) {
|
||||
// log if not from this client
|
||||
if (g_strcmp0(&tmp[10], connection_get_profanity_identifier()) != 0) {
|
||||
if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||
groupchat_log_omemo_msg_in(message->jid->barejid, message->jid->resourcepart, (char*)tmp);
|
||||
} else {
|
||||
groupchat_log_msg_in(message->jid->barejid, message->jid->resourcepart, message->plain);
|
||||
}
|
||||
}
|
||||
}
|
||||
// messages from others
|
||||
} else {
|
||||
if (message->enc == PROF_MSG_ENC_OMEMO) {
|
||||
groupchat_log_omemo_msg_in(message->jid->barejid, message->jid->resourcepart, message->plain);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user