[omemo] Fix activating groupchat

This commit is contained in:
Philipp Hörist
2017-11-15 16:10:36 +01:00
parent a86c0a2ba6
commit 13c9ba9b5b
2 changed files with 11 additions and 20 deletions

View File

@@ -154,7 +154,8 @@ class OmemoPlugin(GajimPlugin):
def activate_encryption(self, chat_control):
if isinstance(chat_control, GroupchatControl):
if chat_control.room_jid not in self.groupchat:
omemo_con = self.connections[chat_control.account]
if chat_control.room_jid not in omemo_con.groupchat:
dialogs.ErrorDialog(
_('Bad Configuration'),
_('To use OMEMO in a Groupchat, the Groupchat should be'
@@ -210,8 +211,8 @@ class OmemoPlugin(GajimPlugin):
room = chat_control.room_jid
missing = True
own_jid = app.get_jid_from_account(account)
for nick in self.groupchat[room]:
real_jid = self.groupchat[room][nick]
for nick in con.groupchat[room]:
real_jid = con.groupchat[room][nick]
if real_jid == own_jid:
continue
if not self.connections[account].are_keys_missing(real_jid):
@@ -233,12 +234,13 @@ class OmemoPlugin(GajimPlugin):
def new_fingerprints_available(self, chat_control):
jid = chat_control.contact.jid
account = chat_control.account
con = self.connections[account]
omemo = self.get_omemo(account)
if isinstance(chat_control, GroupchatControl):
room_jid = chat_control.room_jid
if room_jid in self.groupchat:
for nick in self.groupchat[room_jid]:
real_jid = self.groupchat[room_jid][nick]
if room_jid in con.groupchat:
for nick in con.groupchat[room_jid]:
real_jid = con.groupchat[room_jid][nick]
fingerprints = omemo.store. \
getNewFingerprints(real_jid)
if fingerprints:

View File

@@ -208,22 +208,10 @@ class OMEMOConfigDialog(GajimPluginConfigDialog):
def on_yes(checked, identity_key):
state.store.setTrust(identity_key, State.TRUSTED)
try:
if self.plugin.ui_list[account]:
self.plugin.ui_list[account][jid]. \
refresh_auth_lock_icon()
except:
log.debug('UI not available')
self.update_context_list()
def on_no(identity_key):
state.store.setTrust(identity_key, State.UNTRUSTED)
try:
if jid in self.plugin.ui_list[account]:
self.plugin.ui_list[account][jid]. \
refresh_auth_lock_icon()
except:
log.debug('UI not available')
self.update_context_list()
for path in paths:
@@ -373,6 +361,7 @@ class FingerprintWindow(Gtk.Dialog):
self.windowinstances = windowinstances
self.account = self.contact.account.name
self.plugin = plugin
self.con = plugin.connections[self.account]
self.omemostate = self.plugin.get_omemo(self.account)
self.own_jid = app.get_jid_from_account(self.account)
Gtk.Dialog.__init__(self,
@@ -498,8 +487,8 @@ class FingerprintWindow(Gtk.Dialog):
trust_str = {0: 'False', 1: 'True', 2: 'Undecided'}
if self.groupchat and self.notebook.get_current_page() == 0:
contact_jids = []
for nick in self.plugin.groupchat[contact_jid]:
real_jid = self.plugin.groupchat[contact_jid][nick]
for nick in self.con.groupchat[contact_jid]:
real_jid = self.con.groupchat[contact_jid][nick]
if real_jid == self.own_jid:
continue
contact_jids.append(real_jid)