From 7b01c62e07612a123f3ffe94583f51099e470c3b Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 20 Oct 2014 20:03:16 +0200 Subject: Change the API of Config.get_by_tabname Make the "default" parameter optional and thus move it to the end of the command with the other optional parameters. And change all the calls. --- plugins/otr.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/otr.py b/plugins/otr.py index c2e5a663..44fdb323 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -210,7 +210,7 @@ def hl(tab): conv_jid = safeJID(tab.name) if 'private' in config.get('beep_on', 'highlight private').split(): - if not config.get_by_tabname('disable_beep', False, conv_jid.bare, False): + if not config.get_by_tabname('disable_beep', conv_jid.bare, default=False): curses.beep() class PoezioContext(Context): @@ -430,11 +430,11 @@ class Plugin(BasePlugin): jid = safeJID(jid).full if not jid in self.contexts: flags = POLICY_FLAGS.copy() - policy = self.config.get_by_tabname('encryption_policy', 'ondemand', jid).lower() - logging_policy = self.config.get_by_tabname('log', 'false', jid).lower() - allow_v2 = self.config.get_by_tabname('allow_v2', 'true', jid).lower() + policy = self.config.get_by_tabname('encryption_policy', jid, default='ondemand').lower() + logging_policy = self.config.get_by_tabname('log', jid, default='false').lower() + allow_v2 = self.config.get_by_tabname('allow_v2', jid, default='true').lower() flags['ALLOW_V2'] = (allow_v2 != 'false') - allow_v1 = self.config.get_by_tabname('allow_v1', 'false', jid).lower() + allow_v1 = self.config.get_by_tabname('allow_v1', jid, default='false').lower() flags['ALLOW_V1'] = (allow_v1 == 'true') self.contexts[jid] = PoezioContext(self.account, jid, self.core.xmpp, self.core) self.contexts[jid].log = 1 if logging_policy != 'false' else 0 @@ -544,7 +544,7 @@ class Plugin(BasePlugin): nick_color = get_theme().COLOR_REMOTE_USER body = txt.decode() - if self.config.get_by_tabname('decode_xhtml', True, msg['from'].bare): + if self.config.get_by_tabname('decode_xhtml', msg['from'].bare, default=True): try: body = xhtml.xhtml_to_poezio_colors(body, force=True) except: -- cgit v1.2.3 From 22f9b7a66ab4a3f5d3927e429912237df2a3aa15 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 27 Oct 2014 19:00:38 +0100 Subject: Prevent a (harmless) traceback while generating the documentation --- plugins/screen_detach.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/screen_detach.py b/plugins/screen_detach.py index 3552a179..53827c11 100644 --- a/plugins/screen_detach.py +++ b/plugins/screen_detach.py @@ -7,15 +7,14 @@ import os import stat import pyinotify -SCREEN_DIR = '/var/run/screen/S-%s' % (os.getlogin(),) - class Plugin(BasePlugin): def init(self): + screen_dir = '/var/run/screen/S-%s' % (os.getlogin(),) self.timed_event = None sock_path = None self.thread = None - for f in os.listdir(SCREEN_DIR): - path = os.path.join(SCREEN_DIR, f) + for f in os.listdir(screen_dir): + path = os.path.join(screen_dir, f) if screen_attached(path): sock_path = path self.attached = True -- cgit v1.2.3