From 7ece7dbaffae19c9335e088b11c4cbb114b27ae6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <philipp@hoerist.com>
Date: Thu, 4 Oct 2018 14:27:45 +0200
Subject: [PATCH] Pull correct security catalog for private messages

---
 gajim/chat_control_base.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/gajim/chat_control_base.py b/gajim/chat_control_base.py
index 5a2c4793e3..6d51f4234c 100644
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -179,13 +179,21 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
         # text to show is in in first column of liststore
         self.seclabel_combo.add_attribute(cell, 'text', 0)
         con = app.connections[self.account]
+        jid = self.contact.jid
+        if self.TYPE_ID == 'pm':
+            jid = self.gc_contact.room_jid
         if con.get_module('SecLabels').supported:
-            con.get_module('SecLabels').request_catalog(self.contact.jid)
+            con.get_module('SecLabels').request_catalog(jid)
 
     def _sec_labels_received(self, event):
         if event.account != self.account:
             return
-        if event.jid != self.contact.jid:
+
+        jid = self.contact.jid
+        if self.TYPE_ID == 'pm':
+            jid = self.gc_contact.room_jid
+
+        if event.jid != jid:
             return
         model = self.seclabel_combo.get_model()
         model.clear()
@@ -765,7 +773,10 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
             return
 
         con = app.connections[self.account]
-        catalog = con.get_module('SecLabels').get_catalog(self.contact.jid)
+        jid = self.contact.jid
+        if self.TYPE_ID == 'pm':
+            jid = self.gc_contact.room_jid
+        catalog = con.get_module('SecLabels').get_catalog(jid)
         labels, label_list, _ = catalog
         lname = label_list[idx]
         label = labels[lname]
-- 
GitLab