summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2019-08-23 12:51:19 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2019-12-27 18:57:33 +0100
commit97d29bc1cdb66f3f3c8f0a66acb124ee62e190b0 (patch)
treedff84324c12937bd58570151b888f2e1f33fda4c
parent0c86e9a52f9e251b21696f023ea67a3bd7c55450 (diff)
downloadpoezio-97d29bc1cdb66f3f3c8f0a66acb124ee62e190b0.tar.gz
poezio-97d29bc1cdb66f3f3c8f0a66acb124ee62e190b0.tar.bz2
poezio-97d29bc1cdb66f3f3c8f0a66acb124ee62e190b0.tar.xz
poezio-97d29bc1cdb66f3f3c8f0a66acb124ee62e190b0.zip
Fix potential race condition when encrypting
(do not try to rely on the current tab)
-rw-r--r--poezio/plugin_e2ee.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/poezio/plugin_e2ee.py b/poezio/plugin_e2ee.py
index ab644f7a..b18aae3b 100644
--- a/poezio/plugin_e2ee.py
+++ b/poezio/plugin_e2ee.py
@@ -21,7 +21,14 @@ from typing import (
from slixmpp import InvalidJID, JID, Message
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 asyncio import iscoroutinefunction
@@ -222,8 +229,8 @@ class E2EEPlugin(BasePlugin):
return stanza
message = stanza
- tab = self.api.current_tab()
- jid = tab.jid
+ jid = stanza['to']
+ tab = self.core.tabs.by_name_and_class(jid, ChatTab)
if not self._encryption_enabled(jid):
return message