[omemo] Fix activating groupchat
This commit is contained in:
@@ -154,7 +154,8 @@ class OmemoPlugin(GajimPlugin):
|
|||||||
|
|
||||||
def activate_encryption(self, chat_control):
|
def activate_encryption(self, chat_control):
|
||||||
if isinstance(chat_control, GroupchatControl):
|
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(
|
dialogs.ErrorDialog(
|
||||||
_('Bad Configuration'),
|
_('Bad Configuration'),
|
||||||
_('To use OMEMO in a Groupchat, the Groupchat should be'
|
_('To use OMEMO in a Groupchat, the Groupchat should be'
|
||||||
@@ -210,8 +211,8 @@ class OmemoPlugin(GajimPlugin):
|
|||||||
room = chat_control.room_jid
|
room = chat_control.room_jid
|
||||||
missing = True
|
missing = True
|
||||||
own_jid = app.get_jid_from_account(account)
|
own_jid = app.get_jid_from_account(account)
|
||||||
for nick in self.groupchat[room]:
|
for nick in con.groupchat[room]:
|
||||||
real_jid = self.groupchat[room][nick]
|
real_jid = con.groupchat[room][nick]
|
||||||
if real_jid == own_jid:
|
if real_jid == own_jid:
|
||||||
continue
|
continue
|
||||||
if not self.connections[account].are_keys_missing(real_jid):
|
if not self.connections[account].are_keys_missing(real_jid):
|
||||||
@@ -233,12 +234,13 @@ class OmemoPlugin(GajimPlugin):
|
|||||||
def new_fingerprints_available(self, chat_control):
|
def new_fingerprints_available(self, chat_control):
|
||||||
jid = chat_control.contact.jid
|
jid = chat_control.contact.jid
|
||||||
account = chat_control.account
|
account = chat_control.account
|
||||||
|
con = self.connections[account]
|
||||||
omemo = self.get_omemo(account)
|
omemo = self.get_omemo(account)
|
||||||
if isinstance(chat_control, GroupchatControl):
|
if isinstance(chat_control, GroupchatControl):
|
||||||
room_jid = chat_control.room_jid
|
room_jid = chat_control.room_jid
|
||||||
if room_jid in self.groupchat:
|
if room_jid in con.groupchat:
|
||||||
for nick in self.groupchat[room_jid]:
|
for nick in con.groupchat[room_jid]:
|
||||||
real_jid = self.groupchat[room_jid][nick]
|
real_jid = con.groupchat[room_jid][nick]
|
||||||
fingerprints = omemo.store. \
|
fingerprints = omemo.store. \
|
||||||
getNewFingerprints(real_jid)
|
getNewFingerprints(real_jid)
|
||||||
if fingerprints:
|
if fingerprints:
|
||||||
|
|||||||
17
omemo/ui.py
17
omemo/ui.py
@@ -208,22 +208,10 @@ class OMEMOConfigDialog(GajimPluginConfigDialog):
|
|||||||
|
|
||||||
def on_yes(checked, identity_key):
|
def on_yes(checked, identity_key):
|
||||||
state.store.setTrust(identity_key, State.TRUSTED)
|
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()
|
self.update_context_list()
|
||||||
|
|
||||||
def on_no(identity_key):
|
def on_no(identity_key):
|
||||||
state.store.setTrust(identity_key, State.UNTRUSTED)
|
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()
|
self.update_context_list()
|
||||||
|
|
||||||
for path in paths:
|
for path in paths:
|
||||||
@@ -373,6 +361,7 @@ class FingerprintWindow(Gtk.Dialog):
|
|||||||
self.windowinstances = windowinstances
|
self.windowinstances = windowinstances
|
||||||
self.account = self.contact.account.name
|
self.account = self.contact.account.name
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
|
self.con = plugin.connections[self.account]
|
||||||
self.omemostate = self.plugin.get_omemo(self.account)
|
self.omemostate = self.plugin.get_omemo(self.account)
|
||||||
self.own_jid = app.get_jid_from_account(self.account)
|
self.own_jid = app.get_jid_from_account(self.account)
|
||||||
Gtk.Dialog.__init__(self,
|
Gtk.Dialog.__init__(self,
|
||||||
@@ -498,8 +487,8 @@ class FingerprintWindow(Gtk.Dialog):
|
|||||||
trust_str = {0: 'False', 1: 'True', 2: 'Undecided'}
|
trust_str = {0: 'False', 1: 'True', 2: 'Undecided'}
|
||||||
if self.groupchat and self.notebook.get_current_page() == 0:
|
if self.groupchat and self.notebook.get_current_page() == 0:
|
||||||
contact_jids = []
|
contact_jids = []
|
||||||
for nick in self.plugin.groupchat[contact_jid]:
|
for nick in self.con.groupchat[contact_jid]:
|
||||||
real_jid = self.plugin.groupchat[contact_jid][nick]
|
real_jid = self.con.groupchat[contact_jid][nick]
|
||||||
if real_jid == self.own_jid:
|
if real_jid == self.own_jid:
|
||||||
continue
|
continue
|
||||||
contact_jids.append(real_jid)
|
contact_jids.append(real_jid)
|
||||||
|
|||||||
Reference in New Issue
Block a user