diff options
author | mathieui <mathieui@mathieui.net> | 2018-08-09 00:45:10 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2018-08-09 00:45:10 +0200 |
commit | 53ea677bad481a7140de8cf718796790f5927af4 (patch) | |
tree | 679f3053210b8db26524d30c8e7b333c80aa322f /plugins | |
parent | 6cc1360a3a999c4384531e4f6576144040886768 (diff) | |
download | poezio-53ea677bad481a7140de8cf718796790f5927af4.tar.gz poezio-53ea677bad481a7140de8cf718796790f5927af4.tar.bz2 poezio-53ea677bad481a7140de8cf718796790f5927af4.tar.xz poezio-53ea677bad481a7140de8cf718796790f5927af4.zip |
Fix the OTR plugin
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/otr.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/otr.py b/plugins/otr.py index 1d7d2719..dbaaac7c 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -175,14 +175,15 @@ real JID of your contact (or check if the same nick is used by different people) """ from gettext import gettext as _ -import potr import logging log = logging.getLogger(__name__) import os import html import curses +from pathlib import Path +import potr from potr.context import NotEncryptedError, UnencryptedMessage, ErrorReceived, NotOTRMessage,\ STATE_ENCRYPTED, STATE_PLAINTEXT, STATE_FINISHED, Context, Account, crypt @@ -360,9 +361,9 @@ class PoezioContext(Context): 'bare_jid': safeJID(self.peer).bare } - tab = self.core.get_tab_by_name(self.peer) + tab = self.core.tabs.by_name(self.peer) if not tab: - tab = self.core.get_tab_by_name(safeJID(self.peer).bare, + tab = self.core.tabs.by_name(safeJID(self.peer).bare, DynamicConversationTab) if tab and not tab.locked_resource == safeJID(self.peer).resource: tab = None @@ -472,13 +473,13 @@ class Plugin(BasePlugin): keys_dir = self.config.get('keys_dir', '') otr_dir = Path(keys_dir).expanduser() if keys_dir else xdg.DATA_HOME / 'otr' try: - otr_dir.mkdir(parents=True, exists_ok=True) + otr_dir.mkdir(parents=True, exist_ok=True) except OSError as e: self.api.information('The OTR-specific folder could not ' 'be created: %s. Poezio will be unable ' 'to save keys and trusts' % e, 'OTR') - except: + except Exception as e: self.api.information('The OTR-specific folder could not ' 'be created. Poezio will be unable ' 'to save keys and trusts', 'OTR') |