Fix potential race condition when encrypting

(do not try to rely on the current tab)
This commit is contained in:
mathieui 2019-08-23 12:51:19 +02:00 committed by Maxime “pep” Buquet
parent 0c86e9a52f
commit 97d29bc1cd

View file

@ -21,7 +21,14 @@ from typing import (
from slixmpp import InvalidJID, JID, Message from slixmpp import InvalidJID, JID, Message
from slixmpp.xmlstream import StanzaBase from slixmpp.xmlstream import StanzaBase
from poezio.tabs import ConversationTab, DynamicConversationTab, StaticConversationTab, PrivateTab, MucTab from poezio.tabs import (
ChatTab,
ConversationTab,
DynamicConversationTab,
MucTab,
PrivateTab,
StaticConversationTab,
)
from poezio.plugin import BasePlugin from poezio.plugin import BasePlugin
from asyncio import iscoroutinefunction from asyncio import iscoroutinefunction
@ -222,8 +229,8 @@ class E2EEPlugin(BasePlugin):
return stanza return stanza
message = stanza message = stanza
tab = self.api.current_tab() jid = stanza['to']
jid = tab.jid tab = self.core.tabs.by_name_and_class(jid, ChatTab)
if not self._encryption_enabled(jid): if not self._encryption_enabled(jid):
return message return message