From 015d99ea636e513a601c4375d044065e2772d58e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <philipp@hoerist.com>
Date: Wed, 21 Feb 2018 22:21:35 +0100
Subject: [PATCH] Print correct archive jid in log message

---
 gajim/common/connection_handlers_events.py | 6 +++++-
 gajim/common/logger.py                     | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gajim/common/connection_handlers_events.py b/gajim/common/connection_handlers_events.py
index ee21ccb131..f8a0c0303d 100644
--- a/gajim/common/connection_handlers_events.py
+++ b/gajim/common/connection_handlers_events.py
@@ -1278,8 +1278,12 @@ class MessageReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
         # We do this because of MUC History messages
         type_ = self.stanza.getType()
         if type_ == 'groupchat' or self.self_message or self.muc_pm:
+            if type_ == 'groupchat':
+                archive_jid = self.stanza.getFrom().getStripped()
+            else:
+                archive_jid = self.conn.get_own_jid()
             if app.logger.find_stanza_id(account,
-                                         self.stanza.getFrom().getStripped(),
+                                         archive_jid,
                                          self.unique_id,
                                          groupchat=type_ == 'groupchat'):
                 return
diff --git a/gajim/common/logger.py b/gajim/common/logger.py
index 09dcd2dae3..485236de82 100644
--- a/gajim/common/logger.py
+++ b/gajim/common/logger.py
@@ -1201,7 +1201,7 @@ class Logger:
 
         if result is not None:
             log.info('Found duplicated message, stanza-id: %s, origin-id: %s, '
-                     'archive-jid: %s, account: %s', stanza_id, origin_id, archive_id, account_id)
+                     'archive-jid: %s, account: %s', stanza_id, origin_id, archive_jid, account_id)
             return True
         return False
 
-- 
GitLab