Fix bad-whitespace pylint errors

This commit is contained in:
Philipp Hörist 2018-09-18 12:06:01 +02:00 committed by Philipp Hörist
parent b2a64fe5cc
commit e842298724
39 changed files with 644 additions and 644 deletions

View File

@ -96,14 +96,14 @@ class AdvancedConfigurationWindow:
self.modelfilter.set_visible_func(self.visible_func) self.modelfilter.set_visible_func(self.visible_func)
renderer_text = Gtk.CellRendererText() renderer_text = Gtk.CellRendererText()
col = Gtk.TreeViewColumn(_('Preference Name'), renderer_text, text = 0) col = Gtk.TreeViewColumn(_('Preference Name'), renderer_text, text=0)
treeview.insert_column(col, -1) treeview.insert_column(col, -1)
col.set_resizable(True) col.set_resizable(True)
renderer_text = Gtk.CellRendererText() renderer_text = Gtk.CellRendererText()
renderer_text.connect('edited', self.on_config_edited) renderer_text.connect('edited', self.on_config_edited)
renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END) renderer_text.set_property('ellipsize', Pango.EllipsizeMode.END)
col = Gtk.TreeViewColumn(_('Value'),renderer_text, text = 1) col = Gtk.TreeViewColumn(_('Value'), renderer_text, text=1)
treeview.insert_column(col, -1) treeview.insert_column(col, -1)
col.set_cell_data_func(renderer_text, self.cb_value_column_data) col.set_cell_data_func(renderer_text, self.cb_value_column_data)
@ -112,7 +112,7 @@ class AdvancedConfigurationWindow:
col.props.sizing = Gtk.TreeViewColumnSizing.FIXED col.props.sizing = Gtk.TreeViewColumnSizing.FIXED
renderer_text = Gtk.CellRendererText() renderer_text = Gtk.CellRendererText()
col = Gtk.TreeViewColumn(_('Type'), renderer_text, text = 2) col = Gtk.TreeViewColumn(_('Type'), renderer_text, text=2)
treeview.insert_column(col, -1) treeview.insert_column(col, -1)
col.props.sizing = Gtk.TreeViewColumnSizing.FIXED col.props.sizing = Gtk.TreeViewColumnSizing.FIXED
@ -211,7 +211,7 @@ class AdvancedConfigurationWindow:
self.restart_box.hide() self.restart_box.hide()
for opt in self.changed_opts: for opt in self.changed_opts:
opt_path = opt.split('\n') opt_path = opt.split('\n')
if len(opt_path)==3: if len(opt_path) == 3:
restart = app.config.get_restart_per(opt_path[2], opt_path[1], restart = app.config.get_restart_per(opt_path[2], opt_path[1],
opt_path[0]) opt_path[0])
else: else:
@ -224,7 +224,7 @@ class AdvancedConfigurationWindow:
def on_config_edited(self, cell, path, text): def on_config_edited(self, cell, path, text):
# convert modelfilter path to model path # convert modelfilter path to model path
path=Gtk.TreePath.new_from_string(path) path = Gtk.TreePath.new_from_string(path)
modelpath = self.modelfilter.convert_path_to_child_path(path) modelpath = self.modelfilter.convert_path_to_child_path(path)
modelrow = self.model[modelpath] modelrow = self.model[modelpath]
option = modelrow[0] option = modelrow[0]
@ -253,7 +253,7 @@ class AdvancedConfigurationWindow:
# Check for GtkTreeIter # Check for GtkTreeIter
if iter_: if iter_:
path = model.get_path(iter_) path = model.get_path(iter_)
opt_path = self.get_option_path(model, iter_) opt_path = self.get_option_path(model, iter_)
if len(opt_path) == 1: if len(opt_path) == 1:
default = app.config.get_default(opt_path[0]) default = app.config.get_default(opt_path[0])
elif len(opt_path) == 3: elif len(opt_path) == 3:
@ -311,7 +311,7 @@ class AdvancedConfigurationWindow:
self.model.append(parent, [name, value, type_]) self.model.append(parent, [name, value, type_])
def visible_func(self, model, treeiter, data): def visible_func(self, model, treeiter, data):
search_string = self.entry.get_text().lower() search_string = self.entry.get_text().lower()
for it in tree_model_pre_order(model, treeiter): for it in tree_model_pre_order(model, treeiter):
if model[it][Column.TYPE] != '': if model[it][Column.TYPE] != '':
opt_path = self.get_option_path(model, it) opt_path = self.get_option_path(model, it)

View File

@ -364,7 +364,7 @@ def get_number_of_accounts():
""" """
return len(connections.keys()) return len(connections.keys())
def get_number_of_connected_accounts(accounts_list = None): def get_number_of_connected_accounts(accounts_list=None):
""" """
Returns the number of CONNECTED accounts. Uou can optionally pass an Returns the number of CONNECTED accounts. Uou can optionally pass an
accounts_list and if you do those will be checked, else all will be checked accounts_list and if you do those will be checked, else all will be checked
@ -456,7 +456,7 @@ def account_is_securely_connected(account):
return False return False
return con_types.get(account) in ('tls', 'ssl') return con_types.get(account) in ('tls', 'ssl')
def get_transport_name_from_jid(jid, use_config_setting = True): def get_transport_name_from_jid(jid, use_config_setting=True):
""" """
Returns 'gg', 'irc' etc Returns 'gg', 'irc' etc
@ -517,7 +517,7 @@ def get_our_jids():
our_jids.append(get_jid_from_account(account)) our_jids.append(get_jid_from_account(account))
return our_jids return our_jids
def get_hostname_from_account(account_name, use_srv = False): def get_hostname_from_account(account_name, use_srv=False):
""" """
Returns hostname (if custom hostname is used, that is returned) Returns hostname (if custom hostname is used, that is returned)
""" """

View File

@ -28,9 +28,10 @@
# along with Gajim. If not, see <http://www.gnu.org/licenses/>. # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
import re import re
from gi.repository import GLib
from enum import IntEnum, unique from enum import IntEnum, unique
from gi.repository import GLib
import gajim import gajim
from gajim.common.i18n import _ from gajim.common.i18n import _
@ -44,14 +45,15 @@ class Option(IntEnum):
# Option.DESC also should be there # Option.DESC also should be there
RESTART = 3 RESTART = 3
opt_int = [ 'integer', 0 ] opt_int = ['integer', 0]
opt_str = [ 'string', 0 ] opt_str = ['string', 0]
opt_bool = [ 'boolean', 0 ] opt_bool = ['boolean', 0]
opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)$' ] opt_color = ['color', '^(#[0-9a-fA-F]{6})|()|rgb\(\d+,\d+,\d+\)|rgba\(\d+,\d+,\d+,[01]\.?\d*\)$']
opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype'] opt_one_window_types = ['never', 'always', 'always_with_roster', 'peracct', 'pertype']
opt_show_roster_on_startup = ['always', 'never', 'last_state'] opt_show_roster_on_startup = ['always', 'never', 'last_state']
opt_treat_incoming_messages = ['', 'chat', 'normal'] opt_treat_incoming_messages = ['', 'chat', 'normal']
class Config: class Config:
DEFAULT_ICONSET = 'dcraven' DEFAULT_ICONSET = 'dcraven'
@ -63,415 +65,416 @@ class Config:
DEFAULT_FILE_MANAGER = 'xffm' DEFAULT_FILE_MANAGER = 'xffm'
__options = ({ __options = ({
# name: [ type, default_value, help_string ] # name: [ type, default_value, help_string ]
'verbose': [ opt_bool, False, '', True ], 'verbose': [opt_bool, False, '', True],
'autopopup': [ opt_bool, False ], 'autopopup': [opt_bool, False],
'notify_on_signin': [ opt_bool, True ], 'notify_on_signin': [opt_bool, True],
'notify_on_signout': [ opt_bool, False ], 'notify_on_signout': [opt_bool, False],
'notify_on_new_message': [ opt_bool, True ], 'notify_on_new_message': [opt_bool, True],
'autopopupaway': [ opt_bool, False ], 'autopopupaway': [opt_bool, False],
'autopopup_chat_opened': [ opt_bool, False, _('Show desktop notification even when a chat window is opened for this contact and does not have focus') ], 'autopopup_chat_opened': [opt_bool, False, _('Show desktop notification even when a chat window is opened for this contact and does not have focus')],
'sounddnd': [ opt_bool, False, _('Play sound when user is busy')], 'sounddnd': [opt_bool, False, _('Play sound when user is busy')],
'showoffline': [ opt_bool, False ], 'showoffline': [opt_bool, False],
'show_only_chat_and_online': [ opt_bool, False, _('Show only online and free for chat contacts in roster.')], 'show_only_chat_and_online': [opt_bool, False, _('Show only online and free for chat contacts in roster.')],
'show_transports_group': [ opt_bool, True ], 'show_transports_group': [opt_bool, True],
'autoaway': [ opt_bool, True ], 'autoaway': [opt_bool, True],
'autoawaytime': [ opt_int, 5, _('Time in minutes, after which your status changes to away.') ], 'autoawaytime': [opt_int, 5, _('Time in minutes, after which your status changes to away.')],
'autoaway_message': [ opt_str, _('$S (Away as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoawaytime.') ], 'autoaway_message': [opt_str, _('$S (Away as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoawaytime.')],
'autoxa': [ opt_bool, True ], 'autoxa': [opt_bool, True],
'autoxatime': [ opt_int, 15, _('Time in minutes, after which your status changes to not available.') ], 'autoxatime': [opt_int, 15, _('Time in minutes, after which your status changes to not available.')],
'autoxa_message': [ opt_str, _('$S (Not available as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoxatime.') ], 'autoxa_message': [opt_str, _('$S (Not available as a result of being idle more than $T min)'), _('$S will be replaced by current status message, $T by autoxatime.')],
'ask_online_status': [ opt_bool, False ], 'ask_online_status': [opt_bool, False],
'ask_offline_status': [ opt_bool, False ], 'ask_offline_status': [opt_bool, False],
'trayicon': [opt_str, 'always', _("When to show notification area icon. Can be 'never', 'on_event', 'always'."), False], 'trayicon': [opt_str, 'always', _("When to show notification area icon. Can be 'never', 'on_event', 'always'."), False],
'allow_hide_roster': [opt_bool, False, _("Allow to hide the roster window even if the tray icon is not shown."), False], 'allow_hide_roster': [opt_bool, False, _("Allow to hide the roster window even if the tray icon is not shown."), False],
'iconset': [ opt_str, DEFAULT_ICONSET, '', True ], 'iconset': [opt_str, DEFAULT_ICONSET, '', True],
'mood_iconset': [ opt_str, DEFAULT_MOOD_ICONSET, '', True ], 'mood_iconset': [opt_str, DEFAULT_MOOD_ICONSET, '', True],
'activity_iconset': [ opt_str, DEFAULT_ACTIVITY_ICONSET, '', True ], 'activity_iconset': [opt_str, DEFAULT_ACTIVITY_ICONSET, '', True],
'use_transports_iconsets': [ opt_bool, True, '', True ], 'use_transports_iconsets': [opt_bool, True, '', True],
'notif_signin_color': [ opt_color, '#32CD32', _('Contact signed in notification color.') ], # limegreen 'notif_signin_color': [opt_color, '#32CD32', _('Contact signed in notification color.')], # limegreen
'notif_signout_color': [ opt_color, '#FF0000', _('Contact signout notification color') ], # red 'notif_signout_color': [opt_color, '#FF0000', _('Contact signout notification color')], # red
'notif_message_color': [ opt_color, '#1E90FF', _('New message notification color.') ], # dodgerblue 'notif_message_color': [opt_color, '#1E90FF', _('New message notification color.')], # dodgerblue
'notif_ftrequest_color': [ opt_color, '#F0E68C', _('File transfer request notification color.') ], # khaki 'notif_ftrequest_color': [opt_color, '#F0E68C', _('File transfer request notification color.')], # khaki
'notif_fterror_color': [ opt_color, '#B22222', _('File transfer error notification color.') ], # firebrick 'notif_fterror_color': [opt_color, '#B22222', _('File transfer error notification color.')], # firebrick
'notif_ftcomplete_color': [ opt_color, '#9ACD32', _('File transfer complete or stopped notification color.') ], # yellowgreen 'notif_ftcomplete_color': [opt_color, '#9ACD32', _('File transfer complete or stopped notification color.')], # yellowgreen
'notif_invite_color': [ opt_color, '#D2B48C', _('Groupchat invitation notification color') ], # tan1 'notif_invite_color': [opt_color, '#D2B48C', _('Groupchat invitation notification color')], # tan1
'notif_status_color': [ opt_color, '#D8BFD8', _('Background color of status changed notification') ], # thistle2 'notif_status_color': [opt_color, '#D8BFD8', _('Background color of status changed notification')], # thistle2
'notif_other_color': [ opt_color, '#FFFFFF', _('Other dialogs color.') ], # white 'notif_other_color': [opt_color, '#FFFFFF', _('Other dialogs color.')], # white
'collapsed_rows': [ opt_str, '', _('List (space separated) of rows (accounts and groups) that are collapsed.'), True ], 'collapsed_rows': [opt_str, '', _('List (space separated) of rows (accounts and groups) that are collapsed.'), True],
'roster_theme': [ opt_str, _('default'), '', True ], 'roster_theme': [opt_str, _('default'), '', True],
'mergeaccounts': [ opt_bool, False, '', True ], 'mergeaccounts': [opt_bool, False, '', True],
'sort_by_show_in_roster': [ opt_bool, True, '', True ], 'sort_by_show_in_roster': [opt_bool, True, '', True],
'sort_by_show_in_muc': [ opt_bool, False, '', True ], 'sort_by_show_in_muc': [opt_bool, False, '', True],
'use_speller': [ opt_bool, False, ], 'use_speller': [opt_bool, False, ],
'ignore_incoming_xhtml': [ opt_bool, False, ], 'ignore_incoming_xhtml': [opt_bool, False, ],
'speller_language': [ opt_str, '', _('Language used by speller')], 'speller_language': [opt_str, '', _('Language used by speller')],
'print_time': [ opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')], 'print_time': [opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')],
'print_time_fuzzy': [ opt_int, 0, _('Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable fuzzyclock. 1 is the most precise clock, 4 the least precise one. This is used only if print_time is \'sometimes\'.') ], 'print_time_fuzzy': [opt_int, 0, _('Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable fuzzyclock. 1 is the most precise clock, 4 the least precise one. This is used only if print_time is \'sometimes\'.')],
'emoticons_theme': [opt_str, 'noto-emoticons', '', True ], 'emoticons_theme': [opt_str, 'noto-emoticons', '', True],
'ascii_emoticons': [opt_bool, True, _('When enabled, ASCII emoticons will be converted to graphical emojis.'), True], 'ascii_emoticons': [opt_bool, True, _('When enabled, ASCII emoticons will be converted to graphical emojis.'), True],
'ascii_formatting': [ opt_bool, True, 'ascii_formatting': [opt_bool, True,
_('Treat * / _ pairs as possible formatting characters.'), True], _('Treat * / _ pairs as possible formatting characters.'), True],
'show_ascii_formatting_chars': [ opt_bool, True, _('If true, do not ' 'show_ascii_formatting_chars': [opt_bool, True, _('If true, do not '
'remove */_ . So *abc* will be bold but with * * not removed.')], 'remove */_ . So *abc* will be bold but with * * not removed.')],
'rst_formatting_outgoing_messages': [ opt_bool, False, 'rst_formatting_outgoing_messages': [opt_bool, False,
_('Uses ReStructured text markup to send HTML, plus ascii formatting if selected. For syntax, see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html (If you want to use this, install docutils)')], _('Uses ReStructured text markup to send HTML, plus ascii formatting if selected. For syntax, see http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html (If you want to use this, install docutils)')],
'sounds_on': [ opt_bool, True ], 'sounds_on': [opt_bool, True],
# 'aplay', 'play', 'esdplay', 'artsplay' detected first time only # 'aplay', 'play', 'esdplay', 'artsplay' detected first time only
'soundplayer': [ opt_str, '' ], 'soundplayer': [opt_str, ''],
'openwith': [ opt_str, DEFAULT_OPENWITH ], 'openwith': [opt_str, DEFAULT_OPENWITH],
'custombrowser': [ opt_str, DEFAULT_BROWSER ], 'custombrowser': [opt_str, DEFAULT_BROWSER],
'custommailapp': [ opt_str, DEFAULT_MAILAPP ], 'custommailapp': [opt_str, DEFAULT_MAILAPP],
'custom_file_manager': [ opt_str, DEFAULT_FILE_MANAGER ], 'custom_file_manager': [opt_str, DEFAULT_FILE_MANAGER],
'gc-hpaned-position': [opt_int, 430], 'gc-hpaned-position': [opt_int, 430],
'gc_refer_to_nick_char': [opt_str, ',', _('Character to add after nickname when using nick completion (tab) in group chat.')], 'gc_refer_to_nick_char': [opt_str, ',', _('Character to add after nickname when using nick completion (tab) in group chat.')],
'gc_proposed_nick_char': [opt_str, '_', _('Character to propose to add after desired nickname when desired nickname is used by someone else in group chat.')], 'gc_proposed_nick_char': [opt_str, '_', _('Character to propose to add after desired nickname when desired nickname is used by someone else in group chat.')],
'msgwin-max-state': [opt_bool, False], 'msgwin-max-state': [opt_bool, False],
'msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide 'msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide 'msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'msgwin-width': [opt_int, 500], 'msgwin-width': [opt_int, 500],
'msgwin-height': [opt_int, 440], 'msgwin-height': [opt_int, 440],
'chat-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide 'chat-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'chat-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide 'chat-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'chat-msgwin-width': [opt_int, 480], 'chat-msgwin-width': [opt_int, 480],
'chat-msgwin-height': [opt_int, 440], 'chat-msgwin-height': [opt_int, 440],
'gc-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide 'gc-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'gc-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide 'gc-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'gc-msgwin-width': [opt_int, 600], 'gc-msgwin-width': [opt_int, 600],
'gc-msgwin-height': [opt_int, 440], 'gc-msgwin-height': [opt_int, 440],
'pm-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide 'pm-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide
'pm-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide 'pm-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide
'pm-msgwin-width': [opt_int, 480], 'pm-msgwin-width': [opt_int, 480],
'pm-msgwin-height': [opt_int, 440], 'pm-msgwin-height': [opt_int, 440],
'single-msg-x-position': [opt_int, 0], 'single-msg-x-position': [opt_int, 0],
'single-msg-y-position': [opt_int, 0], 'single-msg-y-position': [opt_int, 0],
'single-msg-width': [opt_int, 400], 'single-msg-width': [opt_int, 400],
'single-msg-height': [opt_int, 280], 'single-msg-height': [opt_int, 280],
'save-roster-position': [opt_bool, True, _('If true, Gajim will save roster position when hiding roster, and restore it when showing roster.')], 'save-roster-position': [opt_bool, True, _('If true, Gajim will save roster position when hiding roster, and restore it when showing roster.')],
'roster_x-position': [ opt_int, 0 ], 'roster_x-position': [opt_int, 0],
'roster_y-position': [ opt_int, 0 ], 'roster_y-position': [opt_int, 0],
'roster_width': [ opt_int, 200 ], 'roster_width': [opt_int, 200],
'roster_height': [ opt_int, 400 ], 'roster_height': [opt_int, 400],
'roster_hpaned_position': [opt_int, 200], 'roster_hpaned_position': [opt_int, 200],
'roster_on_the_right': [opt_bool, False, _('Place the roster on the right in single window mode'), True], 'roster_on_the_right': [opt_bool, False, _('Place the roster on the right in single window mode'), True],
'history_window_width': [ opt_int, -1 ], 'history_window_width': [opt_int, -1],
'history_window_height': [ opt_int, 450 ], 'history_window_height': [opt_int, 450],
'history_window_x-position': [ opt_int, 0 ], 'history_window_x-position': [opt_int, 0],
'history_window_y-position': [ opt_int, 0 ], 'history_window_y-position': [opt_int, 0],
'latest_disco_addresses': [ opt_str, '' ], 'latest_disco_addresses': [opt_str, ''],
'time_stamp': [ opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html') ], 'time_stamp': [opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html')],
'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ], 'before_nickname': [opt_str, '', _('Characters that are printed before the nickname in conversations')],
'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ], 'after_nickname': [opt_str, ':', _('Characters that are printed after the nickname in conversations')],
'use_gpg_agent': [ opt_bool, False ], 'use_gpg_agent': [opt_bool, False],
'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')], 'change_roster_title': [opt_bool, True, _('Add * and [n] in roster title?')],
'restore_lines': [opt_int, 10, _('How many history messages should be restored when a chat tab/window is reopened?')], 'restore_lines': [opt_int, 10, _('How many history messages should be restored when a chat tab/window is reopened?')],
'restore_timeout': [opt_int, -1, _('How far back in time (minutes) history is restored. -1 means no limit.')], 'restore_timeout': [opt_int, -1, _('How far back in time (minutes) history is restored. -1 means no limit.')],
'muc_restore_lines': [opt_int, 100, _('How many lines to request from server when entering a groupchat. -1 means no limit')], 'muc_restore_lines': [opt_int, 100, _('How many lines to request from server when entering a groupchat. -1 means no limit')],
'muc_restore_timeout': [opt_int, -1, _('Minutes of backlog to request when entering a groupchat. -1 means no limit')], 'muc_restore_timeout': [opt_int, -1, _('Minutes of backlog to request when entering a groupchat. -1 means no limit')],
'muc_autorejoin_timeout': [opt_int, 1, _('How many seconds to wait before trying to autorejoin to a conference you are being disconnected from. Set to 0 to disable autorejoining.')], 'muc_autorejoin_timeout': [opt_int, 1, _('How many seconds to wait before trying to autorejoin to a conference you are being disconnected from. Set to 0 to disable autorejoining.')],
'muc_autorejoin_on_kick': [opt_bool, False, _('Should autorejoin be activated when kicked from a conference?')], 'muc_autorejoin_on_kick': [opt_bool, False, _('Should autorejoin be activated when kicked from a conference?')],
'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')], 'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')],
'last_roster_visible': [opt_bool, True], 'last_roster_visible': [opt_bool, True],
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')], 'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],
'version': [ opt_str, gajim.__version__ ], # which version created the config 'version': [opt_str, gajim.__version__], # which version created the config
'search_engine': [opt_str, 'https://www.google.com/search?&q=%s&sourceid=gajim'], 'search_engine': [opt_str, 'https://www.google.com/search?&q=%s&sourceid=gajim'],
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom URL with %%s in it where %%s is the word/phrase or 'WIKTIONARY' which means use Wikitionary.")], 'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom URL with %%s in it where %%s is the word/phrase or 'WIKTIONARY' which means use Wikitionary.")],
'always_english_wikipedia': [opt_bool, False], 'always_english_wikipedia': [opt_bool, False],
'always_english_wiktionary': [opt_bool, True], 'always_english_wiktionary': [opt_bool, True],
'remote_control': [opt_bool, False, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True], 'remote_control': [opt_bool, False, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True],
'outgoing_chat_state_notifications': [opt_str, 'all', _('Sent chat state notifications. Can be one of all, composing_only, disabled.')], 'outgoing_chat_state_notifications': [opt_str, 'all', _('Sent chat state notifications. Can be one of all, composing_only, disabled.')],
'displayed_chat_state_notifications': [opt_str, 'all', _('Displayed chat state notifications in chat windows. Can be one of all, composing_only, disabled.')], 'displayed_chat_state_notifications': [opt_str, 'all', _('Displayed chat state notifications in chat windows. Can be one of all, composing_only, disabled.')],
'autodetect_browser_mailer': [opt_bool, True, '', True], 'autodetect_browser_mailer': [opt_bool, True, '', True],
'print_ichat_every_foo_minutes': [opt_int, 5, _('When not printing time for every message (print_time==sometimes), print it every x minutes.')], 'print_ichat_every_foo_minutes': [opt_int, 5, _('When not printing time for every message (print_time==sometimes), print it every x minutes.')],
'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')], 'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')],
'confirm_close_muc_rooms': [opt_str, '', _('Always ask for confirmation before closing groupchats with any of the JIDs on this space separated list.')], 'confirm_close_muc_rooms': [opt_str, '', _('Always ask for confirmation before closing groupchats with any of the JIDs on this space separated list.')],
'noconfirm_close_muc_rooms': [opt_str, '', _('Never ask for confirmation before closing groupchats with any of the JIDs on this space separated list.')], 'noconfirm_close_muc_rooms': [opt_str, '', _('Never ask for confirmation before closing groupchats with any of the JIDs on this space separated list.')],
'confirm_close_multiple_tabs': [opt_bool, True, _('Ask before closing tabbed chat window if there are controls that can lose data (chat, private chat, groupchat that will not be minimized)')], 'confirm_close_multiple_tabs': [opt_bool, True, _('Ask before closing tabbed chat window if there are controls that can lose data (chat, private chat, groupchat that will not be minimized)')],
'notify_on_file_complete': [opt_bool, True], 'notify_on_file_complete': [opt_bool, True],
'file_transfers_port': [opt_int, 28011], 'file_transfers_port': [opt_int, 28011],
'ft_add_hosts_to_send': [opt_str, '', _('Comma separated list of sent hosts, in addition of local interfaces, for File Transfer in case of address translation/port forwarding.')], 'ft_add_hosts_to_send': [opt_str, '', _('Comma separated list of sent hosts, in addition of local interfaces, for File Transfer in case of address translation/port forwarding.')],
'use_kib_mib': [opt_bool, False, _('IEC standard says KiB = 1024 bytes, KB = 1000 bytes.')], 'use_kib_mib': [opt_bool, False, _('IEC standard says KiB = 1024 bytes, KB = 1000 bytes.')],
'notify_on_all_muc_messages': [opt_bool, False], 'notify_on_all_muc_messages': [opt_bool, False],
'trayicon_notification_on_events': [opt_bool, True, _('Notify of events in the notification area.')], 'trayicon_notification_on_events': [opt_bool, True, _('Notify of events in the notification area.')],
'trayicon_blink': [opt_bool, True, _('If False, Gajim will display a static event icon instead of the blinking status icon in the notification area when notifying on event.')], 'trayicon_blink': [opt_bool, True, _('If False, Gajim will display a static event icon instead of the blinking status icon in the notification area when notifying on event.')],
'last_save_dir': [opt_str, ''], 'last_save_dir': [opt_str, ''],
'last_send_dir': [opt_str, ''], 'last_send_dir': [opt_str, ''],
'last_emoticons_dir': [opt_str, ''], 'last_emoticons_dir': [opt_str, ''],
'last_sounds_dir': [opt_str, ''], 'last_sounds_dir': [opt_str, ''],
'tabs_position': [opt_str, 'top'], 'tabs_position': [opt_str, 'top'],
'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')], 'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')],
'tabs_border': [opt_bool, False, _('Show tabbed notebook border in chat windows?')], 'tabs_border': [opt_bool, False, _('Show tabbed notebook border in chat windows?')],
'tabs_close_button': [opt_bool, True, _('Show close button in tab?')], 'tabs_close_button': [opt_bool, True, _('Show close button in tab?')],
'esession_modp': [opt_str, '15,16,14', _('A list of modp groups to use in a Diffie-Hellman, highest preference first, separated by commas. Valid groups are 1, 2, 5, 14, 15, 16, 17 and 18. Higher numbers are more secure, but take longer to calculate when you start a session.')], 'esession_modp': [opt_str, '15,16,14', _('A list of modp groups to use in a Diffie-Hellman, highest preference first, separated by commas. Valid groups are 1, 2, 5, 14, 15, 16, 17 and 18. Higher numbers are more secure, but take longer to calculate when you start a session.')],
'tooltip_status_online_color': [opt_color, '#73D216'], 'tooltip_status_online_color': [opt_color, '#73D216'],
'tooltip_status_free_for_chat_color': [opt_color, '#3465A4'], 'tooltip_status_free_for_chat_color': [opt_color, '#3465A4'],
'tooltip_status_away_color': [opt_color, '#EDD400'], 'tooltip_status_away_color': [opt_color, '#EDD400'],
'tooltip_status_busy_color': [opt_color, '#F57900'], 'tooltip_status_busy_color': [opt_color, '#F57900'],
'tooltip_status_na_color': [opt_color, '#CC0000'], 'tooltip_status_na_color': [opt_color, '#CC0000'],
'tooltip_status_offline_color': [opt_color, '#555753'], 'tooltip_status_offline_color': [opt_color, '#555753'],
'tooltip_affiliation_none_color': [opt_color, '#555753'], 'tooltip_affiliation_none_color': [opt_color, '#555753'],
'tooltip_affiliation_member_color': [opt_color, '#73D216'], 'tooltip_affiliation_member_color': [opt_color, '#73D216'],
'tooltip_affiliation_administrator_color': [opt_color, '#F57900'], 'tooltip_affiliation_administrator_color': [opt_color, '#F57900'],
'tooltip_affiliation_owner_color': [opt_color, '#CC0000'], 'tooltip_affiliation_owner_color': [opt_color, '#CC0000'],
'tooltip_account_name_color': [opt_color, '#888A85'], 'tooltip_account_name_color': [opt_color, '#888A85'],
'tooltip_idle_color': [opt_color, '#888A85'], 'tooltip_idle_color': [opt_color, '#888A85'],
'notification_preview_message': [opt_bool, True, _('Preview new messages in notification popup?')], 'notification_preview_message': [opt_bool, True, _('Preview new messages in notification popup?')],
'notification_position_x': [opt_int, -1], 'notification_position_x': [opt_int, -1],
'notification_position_y': [opt_int, -1], 'notification_position_y': [opt_int, -1],
'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in group chats.')], 'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in group chats.')],
'quit_on_roster_x_button': [opt_bool, False, _('If true, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if notification icon is used.')], 'quit_on_roster_x_button': [opt_bool, False, _('If true, quits Gajim when X button of Window Manager is clicked. This setting is taken into account only if notification icon is used.')],
'hide_on_roster_x_button': [opt_bool, False, _('If true, Gajim hides the Roster window on pressing the X button instead of minimizing into the Dock.')], 'hide_on_roster_x_button': [opt_bool, False, _('If true, Gajim hides the Roster window on pressing the X button instead of minimizing into the Dock.')],
'show_unread_tab_icon': [opt_bool, False, _('If true, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')], 'show_unread_tab_icon': [opt_bool, False, _('If true, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')],
'show_status_msgs_in_roster': [opt_bool, True, _('If true, Gajim will display the status message, if not empty, for every contact under the contact name in roster window.'), True], 'show_status_msgs_in_roster': [opt_bool, True, _('If true, Gajim will display the status message, if not empty, for every contact under the contact name in roster window.'), True],
'show_avatars_in_roster': [opt_bool, True, '', True], 'show_avatars_in_roster': [opt_bool, True, '', True],
'show_mood_in_roster': [opt_bool, True, '', True], 'show_mood_in_roster': [opt_bool, True, '', True],
'show_activity_in_roster': [opt_bool, True, '', True], 'show_activity_in_roster': [opt_bool, True, '', True],
'show_tunes_in_roster': [opt_bool, True, '', True], 'show_tunes_in_roster': [opt_bool, True, '', True],
'show_location_in_roster': [opt_bool, True, '', True], 'show_location_in_roster': [opt_bool, True, '', True],
'avatar_position_in_roster': [opt_str, 'right', _('Define the position of the avatar in roster. Can be left or right'), True], 'avatar_position_in_roster': [opt_str, 'right', _('Define the position of the avatar in roster. Can be left or right'), True],
'print_status_in_chats': [opt_bool, False, _('If False, Gajim will no longer print status line in chats when a contact changes their status and/or their status message.')], 'print_status_in_chats': [opt_bool, False, _('If False, Gajim will no longer print status line in chats when a contact changes their status and/or their status message.')],
'print_status_in_muc': [opt_str, 'none', _('Can be "none", "all" or "in_and_out". If "none", Gajim will no longer print status line in groupchats when a member changes their status and/or their status message. If "all" Gajim will print all status messages. If "in_and_out", Gajim will only print FOO enters/leaves group chat.')], 'print_status_in_muc': [opt_str, 'none', _('Can be "none", "all" or "in_and_out". If "none", Gajim will no longer print status line in groupchats when a member changes their status and/or their status message. If "all" Gajim will print all status messages. If "in_and_out", Gajim will only print FOO enters/leaves group chat.')],
'log_contact_status_changes': [opt_bool, False], 'log_contact_status_changes': [opt_bool, False],
'log_xhtml_messages': [opt_bool, False, _('Log XHTML messages instead of plain text messages.')], 'log_xhtml_messages': [opt_bool, False, _('Log XHTML messages instead of plain text messages.')],
'restored_messages_small': [opt_bool, True, _('If true, restored messages will use a smaller font than the default one.')], 'restored_messages_small': [opt_bool, True, _('If true, restored messages will use a smaller font than the default one.')],
'hide_avatar_of_transport': [opt_bool, False, _('Don\'t show avatar for the transport itself.')], 'hide_avatar_of_transport': [opt_bool, False, _('Don\'t show avatar for the transport itself.')],
'roster_window_skip_taskbar': [opt_bool, False, _('Don\'t show roster in the system taskbar.')], 'roster_window_skip_taskbar': [opt_bool, False, _('Don\'t show roster in the system taskbar.')],
'use_urgency_hint': [opt_bool, True, _('If true, make the window flash (the default behaviour in most Window Managers) when holding pending events.')], 'use_urgency_hint': [opt_bool, True, _('If true, make the window flash (the default behaviour in most Window Managers) when holding pending events.')],
'notification_timeout': [opt_int, 5], 'notification_timeout': [opt_int, 5],
'one_message_window': [opt_str, 'always', 'one_message_window': [opt_str, 'always',
#always, never, peracct, pertype should not be translated #always, never, peracct, pertype should not be translated
_('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'always_with_roster\' - Like \'always\' but the messages are in a single window along with the roster.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g. chats vs. groupchats) is sent to a specific window.')], _('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\n\'always_with_roster\' - Like \'always\' but the messages are in a single window along with the roster.\n\'never\' - All messages get their own window.\n\'peracct\' - Messages for each account are sent to a specific window.\n\'pertype\' - Each message type (e.g. chats vs. groupchats) is sent to a specific window.')],
'show_roster_on_startup':[opt_str, 'always', _('Show roster on startup.\n\'always\' - Always show roster.\n\'never\' - Never show roster.\n\'last_state\' - Restore the last state roster.')], 'show_roster_on_startup':[opt_str, 'always', _('Show roster on startup.\n\'always\' - Always show roster.\n\'never\' - Never show roster.\n\'last_state\' - Restore the last state roster.')],
'show_avatar_in_chat': [opt_bool, True, _('If False, you will no longer see the avatar in the chat window.')], 'show_avatar_in_chat': [opt_bool, True, _('If False, you will no longer see the avatar in the chat window.')],
'escape_key_closes': [opt_bool, True, _('If true, pressing the escape key closes a tab/window.')], 'escape_key_closes': [opt_bool, True, _('If true, pressing the escape key closes a tab/window.')],
'hide_groupchat_banner': [opt_bool, False, _('Hides the banner in a group chat window')], 'hide_groupchat_banner': [opt_bool, False, _('Hides the banner in a group chat window')],
'hide_chat_banner': [opt_bool, False, _('Hides the banner in two persons chat window')], 'hide_chat_banner': [opt_bool, False, _('Hides the banner in two persons chat window')],
'hide_groupchat_occupants_list': [opt_bool, False, _('Hides the group chat occupants list in group chat window.')], 'hide_groupchat_occupants_list': [opt_bool, False, _('Hides the group chat occupants list in group chat window.')],
'chat_merge_consecutive_nickname': [opt_bool, False, _('In a chat, show the nickname at the beginning of a line only when it\'s not the same person talking than in previous message.')], 'chat_merge_consecutive_nickname': [opt_bool, False, _('In a chat, show the nickname at the beginning of a line only when it\'s not the same person talking than in previous message.')],
'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickname.')], 'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickname.')],
'gc_nicknames_colors': [ opt_str, '#4e9a06:#f57900:#ce5c00:#3465a4:#204a87:#75507b:#5c3566:#c17d11:#8f5902:#ef2929:#cc0000:#a40000', _('List of colors, separated by ":", that will be used to color nicknames in group chats.'), True ], 'gc_nicknames_colors': [opt_str, '#4e9a06:#f57900:#ce5c00:#3465a4:#204a87:#75507b:#5c3566:#c17d11:#8f5902:#ef2929:#cc0000:#a40000', _('List of colors, separated by ":", that will be used to color nicknames in group chats.'), True],
'ctrl_tab_go_to_next_composing': [opt_bool, True, _('Ctrl-Tab go to next composing tab when none is unread.')], 'ctrl_tab_go_to_next_composing': [opt_bool, True, _('Ctrl-Tab go to next composing tab when none is unread.')],
'confirm_metacontacts': [ opt_str, '', _('Show the confirm metacontacts creation dialog or not? Empty string means never show the dialog.')], 'confirm_metacontacts': [opt_str, '', _('Show the confirm metacontacts creation dialog or not? Empty string means never show the dialog.')],
'confirm_block': [ opt_str, '', _('Show the confirm block contact dialog or not? Empty string means never show the dialog.')], 'confirm_block': [opt_str, '', _('Show the confirm block contact dialog or not? Empty string means never show the dialog.')],
'confirm_custom_status': [ opt_str, '', _('Show the confirm custom status dialog or not? Empty string means never show the dialog.')], 'confirm_custom_status': [opt_str, '', _('Show the confirm custom status dialog or not? Empty string means never show the dialog.')],
'enable_negative_priority': [ opt_bool, False, _('If true, you will be able to set a negative priority to your account in account modification window. BE CAREFUL, when you are logged in with a negative priority, you will NOT receive any message from your server.')], 'enable_negative_priority': [opt_bool, False, _('If true, you will be able to set a negative priority to your account in account modification window. BE CAREFUL, when you are logged in with a negative priority, you will NOT receive any message from your server.')],
'show_contacts_number': [opt_bool, True, _('If true, Gajim will show number of online and total contacts in account and group rows.')], 'show_contacts_number': [opt_bool, True, _('If true, Gajim will show number of online and total contacts in account and group rows.')],
'treat_incoming_messages': [ opt_str, '', _('Can be empty, \'chat\' or \'normal\'. If not empty, treat all incoming messages as if they were of this type')], 'treat_incoming_messages': [opt_str, '', _('Can be empty, \'chat\' or \'normal\'. If not empty, treat all incoming messages as if they were of this type')],
'scroll_roster_to_last_message': [opt_bool, True, _('If true, Gajim will scroll and select the contact who sent you the last message, if chat window is not already opened.')], 'scroll_roster_to_last_message': [opt_bool, True, _('If true, Gajim will scroll and select the contact who sent you the last message, if chat window is not already opened.')],
'change_status_window_timeout': [opt_int, 15, _('Time of inactivity needed before the change status window closes down.')], 'change_status_window_timeout': [opt_int, 15, _('Time of inactivity needed before the change status window closes down.')],
'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')], 'max_conversation_lines': [opt_int, 500, _('Maximum number of lines that are printed in conversations. Oldest lines are cleared.')],
'attach_notifications_to_systray': [opt_bool, False, _('If true, notification windows from notification-daemon will be attached to notification icon.')], 'attach_notifications_to_systray': [opt_bool, False, _('If true, notification windows from notification-daemon will be attached to notification icon.')],
'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')], 'check_idle_every_foo_seconds': [opt_int, 2, _('Choose interval between 2 checks of idleness.')],
'uri_schemes': [opt_str, 'aaa:// aaas:// acap:// cap:// cid: crid:// data: dav: dict:// dns: fax: file:/ ftp:// geo: go: gopher:// h323: http:// https:// iax: icap:// im: imap:// info: ipp:// iris: iris.beep: iris.xpc: iris.xpcs: iris.lwz: ldap:// mid: modem: msrp:// msrps:// mtqp:// mupdate:// news: nfs:// nntp:// opaquelocktoken: pop:// pres: prospero:// rtsp:// service: shttp:// sip: sips: sms: snmp:// soap.beep:// soap.beeps:// tag: tel: telnet:// tftp:// thismessage:/ tip:// tv: urn:// vemmi:// xmlrpc.beep:// xmlrpc.beeps:// z39.50r:// z39.50s:// about: apt: cvs:// daap:// ed2k:// feed: fish:// git:// iax2: irc:// ircs:// ldaps:// magnet: mms:// rsync:// ssh:// svn:// sftp:// smb:// webcal:// aesgcm://', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled separately)'), True], 'uri_schemes': [opt_str, 'aaa:// aaas:// acap:// cap:// cid: crid:// data: dav: dict:// dns: fax: file:/ ftp:// geo: go: gopher:// h323: http:// https:// iax: icap:// im: imap:// info: ipp:// iris: iris.beep: iris.xpc: iris.xpcs: iris.lwz: ldap:// mid: modem: msrp:// msrps:// mtqp:// mupdate:// news: nfs:// nntp:// opaquelocktoken: pop:// pres: prospero:// rtsp:// service: shttp:// sip: sips: sms: snmp:// soap.beep:// soap.beeps:// tag: tel: telnet:// tftp:// thismessage:/ tip:// tv: urn:// vemmi:// xmlrpc.beep:// xmlrpc.beeps:// z39.50r:// z39.50s:// about: apt: cvs:// daap:// ed2k:// feed: fish:// git:// iax2: irc:// ircs:// ldaps:// magnet: mms:// rsync:// ssh:// svn:// sftp:// smb:// webcal:// aesgcm://', _('Valid uri schemes. Only schemes in this list will be accepted as "real" uri. (mailto and xmpp are handled separately)'), True],
'shell_like_completion': [ opt_bool, False, _('If true, completion in groupchats will be like a shell auto-completion')], 'shell_like_completion': [opt_bool, False, _('If true, completion in groupchats will be like a shell auto-completion')],
'show_self_contact': [opt_str, 'when_other_resource', _('When is self contact row displayed. Can be "always", "when_other_resource" or "never"'), True], 'show_self_contact': [opt_str, 'when_other_resource', _('When is self contact row displayed. Can be "always", "when_other_resource" or "never"'), True],
'audio_input_device': [opt_str, 'autoaudiosrc ! volume name=gajim_vol'], 'audio_input_device': [opt_str, 'autoaudiosrc ! volume name=gajim_vol'],
'audio_output_device': [opt_str, 'autoaudiosink'], 'audio_output_device': [opt_str, 'autoaudiosink'],
'video_input_device': [opt_str, 'autovideosrc'], 'video_input_device': [opt_str, 'autovideosrc'],
'video_output_device': [opt_str, 'autovideosink'], 'video_output_device': [opt_str, 'autovideosink'],
'video_framerate': [opt_str, '', _('Optionally fix jingle output video framerate. Example: 10/1 or 25/2')], 'video_framerate': [opt_str, '', _('Optionally fix jingle output video framerate. Example: 10/1 or 25/2')],
'video_size': [opt_str, '', _('Optionally resize jingle output video. Example: 320x240')], 'video_size': [opt_str, '', _('Optionally resize jingle output video. Example: 320x240')],
'video_see_self': [opt_bool, True, _('If true, You will also see your webcam')], 'video_see_self': [opt_bool, True, _('If true, You will also see your webcam')],
'audio_input_volume': [opt_int, 50], 'audio_input_volume': [opt_int, 50],
'audio_output_volume': [opt_int, 50], 'audio_output_volume': [opt_int, 50],
'use_stun_server': [opt_bool, False, _('If true, Gajim will try to use a STUN server when using Jingle. The one in "stun_server" option, or the one given by the XMPP server.')], 'use_stun_server': [opt_bool, False, _('If true, Gajim will try to use a STUN server when using Jingle. The one in "stun_server" option, or the one given by the XMPP server.')],
'stun_server': [opt_str, '', _('STUN server to use when using Jingle')], 'stun_server': [opt_str, '', _('STUN server to use when using Jingle')],
'show_affiliation_in_groupchat': [opt_bool, True, _('If true, Gajim will show affiliation of groupchat occupants by adding a colored square to the status icon')], 'show_affiliation_in_groupchat': [opt_bool, True, _('If true, Gajim will show affiliation of groupchat occupants by adding a colored square to the status icon')],
'global_proxy': [opt_str, '', _('Proxy used for all outgoing connections if the account does not have a specific proxy configured')], 'global_proxy': [opt_str, '', _('Proxy used for all outgoing connections if the account does not have a specific proxy configured')],
'ignore_incoming_attention': [opt_bool, False, _('If true, Gajim will ignore incoming attention requestd ("wizz").')], 'ignore_incoming_attention': [opt_bool, False, _('If true, Gajim will ignore incoming attention requestd ("wizz").')],
'remember_opened_chat_controls': [ opt_bool, True, _('If enabled, Gajim will reopen chat windows that were opened last time Gajim was closed.')], 'remember_opened_chat_controls': [opt_bool, True, _('If enabled, Gajim will reopen chat windows that were opened last time Gajim was closed.')],
'positive_184_ack': [ opt_bool, False, _('If enabled, Gajim will show an icon to show that sent message has been received by your contact')], 'positive_184_ack': [opt_bool, False, _('If enabled, Gajim will show an icon to show that sent message has been received by your contact')],
'show_avatar_in_tabs': [ opt_bool, False, _('Show a mini avatar in chat window tabs and in window icon')], 'show_avatar_in_tabs': [opt_bool, False, _('Show a mini avatar in chat window tabs and in window icon')],
'use_keyring': [opt_bool, True, _('If true, Gajim will use the Systems Keyring to store account passwords.')], 'use_keyring': [opt_bool, True, _('If true, Gajim will use the Systems Keyring to store account passwords.')],
'pgp_encoding': [ opt_str, '', _('Sets the encoding used by python-gnupg'), True], 'pgp_encoding': [opt_str, '', _('Sets the encoding used by python-gnupg'), True],
'remote_commands': [opt_bool, False, _('If true, Gajim will execute XEP-0146 Commands.')], 'remote_commands': [opt_bool, False, _('If true, Gajim will execute XEP-0146 Commands.')],
}, {}) }, {})
__options_per_key = { __options_per_key = {
'accounts': ({ 'accounts': ({
'name': [ opt_str, '', '', True ], 'name': [opt_str, '', '', True],
'account_label': [ opt_str, '', '', False ], 'account_label': [opt_str, '', '', False],
'hostname': [ opt_str, '', '', True ], 'hostname': [opt_str, '', '', True],
'anonymous_auth': [ opt_bool, False ], 'anonymous_auth': [opt_bool, False],
'avatar_sha': [opt_str, '', '', False], 'avatar_sha': [opt_str, '', '', False],
'client_cert': [ opt_str, '', '', True ], 'client_cert': [opt_str, '', '', True],
'client_cert_encrypted': [ opt_bool, False, '', False ], 'client_cert_encrypted': [opt_bool, False, '', False],
'savepass': [ opt_bool, False ], 'savepass': [opt_bool, False],
'password': [ opt_str, '' ], 'password': [opt_str, ''],
'resource': [ opt_str, 'gajim.$rand', '', True ], 'resource': [opt_str, 'gajim.$rand', '', True],
'priority': [ opt_int, 5, '', True ], 'priority': [opt_int, 5, '', True],
'adjust_priority_with_status': [ opt_bool, True, _('Priority will change automatically according to your status. Priorities are defined in autopriority_* options.') ], 'adjust_priority_with_status': [opt_bool, True, _('Priority will change automatically according to your status. Priorities are defined in autopriority_* options.')],
'autopriority_online': [ opt_int, 50], 'autopriority_online': [opt_int, 50],
'autopriority_chat': [ opt_int, 50], 'autopriority_chat': [opt_int, 50],
'autopriority_away': [ opt_int, 40], 'autopriority_away': [opt_int, 40],
'autopriority_xa': [ opt_int, 30], 'autopriority_xa': [opt_int, 30],
'autopriority_dnd': [ opt_int, 20], 'autopriority_dnd': [opt_int, 20],
'autopriority_invisible': [ opt_int, 10], 'autopriority_invisible': [opt_int, 10],
'autoconnect': [ opt_bool, False, '', True ], 'autoconnect': [opt_bool, False, '', True],
'autoconnect_as': [ opt_str, 'online', _('Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. NOTE: this option is used only if restore_last_status is disabled'), True ], 'autoconnect_as': [opt_str, 'online', _('Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. NOTE: this option is used only if restore_last_status is disabled'), True],
'restore_last_status': [ opt_bool, False, _('If enabled, restore the last status that was used.') ], 'restore_last_status': [opt_bool, False, _('If enabled, restore the last status that was used.')],
'autoreconnect': [ opt_bool, True ], 'autoreconnect': [opt_bool, True],
'autoauth': [ opt_bool, False, _('If true, Contacts requesting authorization will be automatically accepted.')], 'autoauth': [opt_bool, False, _('If true, Contacts requesting authorization will be automatically accepted.')],
'active': [ opt_bool, True, _('If False, this account will be disabled and will not appear in roster window.'), True], 'active': [opt_bool, True, _('If False, this account will be disabled and will not appear in roster window.'), True],
'proxy': [ opt_str, '', '', True ], 'proxy': [opt_str, '', '', True],
'keyid': [ opt_str, '', '', True ], 'keyid': [opt_str, '', '', True],
'gpg_sign_presence': [ opt_bool, True, _('If disabled, don\'t sign presences with GPG key, even if GPG is configured.') ], 'gpg_sign_presence': [opt_bool, True, _('If disabled, don\'t sign presences with GPG key, even if GPG is configured.')],
'keyname': [ opt_str, '', '', True ], 'keyname': [opt_str, '', '', True],
'allow_plaintext_connection': [ opt_bool, False, _('Allow plaintext connections')], 'allow_plaintext_connection': [opt_bool, False, _('Allow plaintext connections')],
'tls_version': [ opt_str, '1.2', '' ], 'tls_version': [opt_str, '1.2', ''],
'cipher_list': [ opt_str, 'HIGH:!aNULL', '' ], 'cipher_list': [opt_str, 'HIGH:!aNULL', ''],
'authentication_mechanisms': [ opt_str, '', _('List (space separated) of authentication mechanisms to try. Can contain ANONYMOUS, EXTERNAL, GSSAPI, SCRAM-SHA-1-PLUS, SCRAM-SHA-1, DIGEST-MD5, PLAIN, X-MESSENGER-OAUTH2 or XEP-0078') ], 'authentication_mechanisms': [opt_str, '', _('List (space separated) of authentication mechanisms to try. Can contain ANONYMOUS, EXTERNAL, GSSAPI, SCRAM-SHA-1-PLUS, SCRAM-SHA-1, DIGEST-MD5, PLAIN, X-MESSENGER-OAUTH2 or XEP-0078')],
'action_when_plaintext_connection': [ opt_str, 'warn', _('Show a warning dialog before sending password on an plaintext connection. Can be \'warn\', \'connect\', \'disconnect\'') ], 'action_when_plaintext_connection': [opt_str, 'warn', _('Show a warning dialog before sending password on an plaintext connection. Can be \'warn\', \'connect\', \'disconnect\'')],
'warn_when_insecure_ssl_connection': [ opt_bool, True, _('Show a warning dialog before using standard SSL library.') ], 'warn_when_insecure_ssl_connection': [opt_bool, True, _('Show a warning dialog before using standard SSL library.')],
'warn_when_insecure_password': [ opt_bool, True, _('Show a warning dialog before sending PLAIN password over a plain connection.') ], 'warn_when_insecure_password': [opt_bool, True, _('Show a warning dialog before sending PLAIN password over a plain connection.')],
'ignore_ssl_errors': [ opt_str, '', _('Space separated list of ssl errors to ignore.') ], 'ignore_ssl_errors': [opt_str, '', _('Space separated list of ssl errors to ignore.')],
'use_srv': [ opt_bool, True, '', True ], 'use_srv': [opt_bool, True, '', True],
'use_custom_host': [ opt_bool, False, '', True ], 'use_custom_host': [opt_bool, False, '', True],
'custom_port': [ opt_int, 5222, '', True ], 'custom_port': [opt_int, 5222, '', True],
'custom_host': [ opt_str, '', '', True ], 'custom_host': [opt_str, '', '', True],
'sync_with_global_status': [ opt_bool, False, ], 'sync_with_global_status': [opt_bool, False, ],
'no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')], 'no_log_for': [opt_str, '', _('Space separated list of JIDs for which you do not want to store logs. You can also add account name to log nothing for this account.')],
'sync_logs_with_server': [ opt_bool, True, _('On startup, Gajim will download logs stored on server, provided the server supports XEP-0313')], 'sync_logs_with_server': [opt_bool, True, _('On startup, Gajim will download logs stored on server, provided the server supports XEP-0313')],
'allow_no_log_for': [ opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')], 'allow_no_log_for': [opt_str, '', _('Space separated list of JIDs for which you accept to not log conversations if he does not want to.')],
'non_minimized_gc': [ opt_str, '' ], 'non_minimized_gc': [opt_str, ''],
'attached_gpg_keys': [ opt_str, '' ], 'attached_gpg_keys': [opt_str, ''],
'keep_alives_enabled': [ opt_bool, True, _('Whitespace sent after inactivity')], 'keep_alives_enabled': [opt_bool, True, _('Whitespace sent after inactivity')],
'ping_alives_enabled': [ opt_bool, True, _('XMPP ping sent after inactivity')], 'ping_alives_enabled': [opt_bool, True, _('XMPP ping sent after inactivity')],
# send keepalive every N seconds of inactivity # send keepalive every N seconds of inactivity
'keep_alive_every_foo_secs': [ opt_int, 55 ], 'keep_alive_every_foo_secs': [opt_int, 55],
'ping_alive_every_foo_secs': [ opt_int, 120 ], 'ping_alive_every_foo_secs': [opt_int, 120],
'time_for_ping_alive_answer': [ opt_int, 60, _('How many seconds to wait for the answer of ping alive packet before trying to reconnect?') ], 'time_for_ping_alive_answer': [opt_int, 60, _('How many seconds to wait for the answer of ping alive packet before trying to reconnect?')],
# try for 1 minutes before giving up (aka. timeout after those seconds) # try for 1 minutes before giving up (aka. timeout after those seconds)
'try_connecting_for_foo_secs': [ opt_int, 60 ], 'try_connecting_for_foo_secs': [opt_int, 60],
'http_auth': [opt_str, 'ask'], # yes, no, ask 'http_auth': [opt_str, 'ask'], # yes, no, ask
'dont_ack_subscription': [opt_bool, False, _('Jabberd2 workaround')], 'dont_ack_subscription': [opt_bool, False, _('Jabberd2 workaround')],
# proxy65 for FT # proxy65 for FT
'file_transfer_proxies': [opt_str, ''], 'file_transfer_proxies': [opt_str, ''],
'use_ft_proxies': [opt_bool, False, _('If checked, Gajim will use your IP and proxies defined in file_transfer_proxies option for file transfer.'), True], 'use_ft_proxies': [opt_bool, False, _('If checked, Gajim will use your IP and proxies defined in file_transfer_proxies option for file transfer.'), True],
'test_ft_proxies_on_startup': [opt_bool, False, _('If true, Gajim will test file transfer proxies on startup to be sure it works. Openfire\'s proxies are known to fail this test even if they work.')], 'test_ft_proxies_on_startup': [opt_bool, False, _('If true, Gajim will test file transfer proxies on startup to be sure it works. Openfire\'s proxies are known to fail this test even if they work.')],
'msgwin-x-position': [opt_int, -1], # Default is to let the wm decide 'msgwin-x-position': [opt_int, -1], # Default is to let the wm decide
'msgwin-y-position': [opt_int, -1], # Default is to let the wm decide 'msgwin-y-position': [opt_int, -1], # Default is to let the wm decide
'msgwin-width': [opt_int, 480], 'msgwin-width': [opt_int, 480],
'msgwin-height': [opt_int, 440], 'msgwin-height': [opt_int, 440],
'is_zeroconf': [opt_bool, False], 'is_zeroconf': [opt_bool, False],
'last_status': [opt_str, 'online'], 'last_status': [opt_str, 'online'],
'last_status_msg': [opt_str, ''], 'last_status_msg': [opt_str, ''],
'zeroconf_first_name': [ opt_str, '', '', True ], 'zeroconf_first_name': [opt_str, '', '', True],
'zeroconf_last_name': [ opt_str, '', '', True ], 'zeroconf_last_name': [opt_str, '', '', True],
'zeroconf_jabber_id': [ opt_str, '', '', True ], 'zeroconf_jabber_id': [opt_str, '', '', True],
'zeroconf_email': [ opt_str, '', '', True ], 'zeroconf_email': [opt_str, '', '', True],
'use_env_http_proxy': [opt_bool, False], 'use_env_http_proxy': [opt_bool, False],
'answer_receipts': [opt_bool, True, _('Answer to receipt requests')], 'answer_receipts': [opt_bool, True, _('Answer to receipt requests')],
'request_receipt': [opt_bool, True, _('Sent receipt requests')], 'request_receipt': [opt_bool, True, _('Sent receipt requests')],
'publish_tune': [opt_bool, False], 'publish_tune': [opt_bool, False],
'publish_location': [opt_bool, False], 'publish_location': [opt_bool, False],
'subscribe_mood': [opt_bool, True], 'subscribe_mood': [opt_bool, True],
'subscribe_activity': [opt_bool, True], 'subscribe_activity': [opt_bool, True],
'subscribe_tune': [opt_bool, True], 'subscribe_tune': [opt_bool, True],
'subscribe_nick': [opt_bool, True], 'subscribe_nick': [opt_bool, True],
'subscribe_location': [opt_bool, True], 'subscribe_location': [opt_bool, True],
'ignore_unknown_contacts': [ opt_bool, False ], 'ignore_unknown_contacts': [opt_bool, False],
'send_os_info': [ opt_bool, True, _("Allow Gajim to send information about the operating system you are running.") ], 'send_os_info': [opt_bool, True, _("Allow Gajim to send information about the operating system you are running.")],
'send_time_info': [ opt_bool, True, _("Allow Gajim to send your local time.") ], 'send_time_info': [opt_bool, True, _("Allow Gajim to send your local time.")],
'send_idle_time': [ opt_bool, True ], 'send_idle_time': [opt_bool, True],
'roster_version': [opt_str, ''], 'roster_version': [opt_str, ''],
'subscription_request_msg': [opt_str, '', _('Message that is sent to contacts you want to add')], 'subscription_request_msg': [opt_str, '', _('Message that is sent to contacts you want to add')],
'enable_message_carbons': [ opt_bool, True, _('If enabled and if server supports this feature, Gajim will receive messages sent and received by other resources.')], 'enable_message_carbons': [opt_bool, True, _('If enabled and if server supports this feature, Gajim will receive messages sent and received by other resources.')],
'ft_send_local_ips': [ opt_bool, True, _('If enabled, Gajim will send your local IPs so your contact can connect to your machine to transfer files.')], 'ft_send_local_ips': [opt_bool, True, _('If enabled, Gajim will send your local IPs so your contact can connect to your machine to transfer files.')],
'oauth2_refresh_token': [ opt_str, '', _('Latest token for OAuth 2.0 authentication.')], 'oauth2_refresh_token': [opt_str, '', _('Latest token for OAuth 2.0 authentication.')],
'oauth2_client_id': [ opt_str, '0000000044077801', _('client_id for OAuth 2.0 authentication.')], 'oauth2_client_id': [opt_str, '0000000044077801', _('client_id for OAuth 2.0 authentication.')],
'oauth2_redirect_url': [ opt_str, 'https%3A%2F%2Fgajim.org%2Fmsnauth%2Findex.cgi', _('redirect_url for OAuth 2.0 authentication.')], 'oauth2_redirect_url': [opt_str, 'https%3A%2F%2Fgajim.org%2Fmsnauth%2Findex.cgi', _('redirect_url for OAuth 2.0 authentication.')],
'opened_chat_controls': [opt_str, '', _('Space separated list of JIDs for which chat window will be re-opened on next startup.')], 'opened_chat_controls': [opt_str, '', _('Space separated list of JIDs for which chat window will be re-opened on next startup.')],
'recent_groupchats': [ opt_str, '' ], 'recent_groupchats': [opt_str, ''],
'httpupload_verify': [ opt_bool, True, _('HTTP Upload: Enable HTTPS Verification')], 'httpupload_verify': [opt_bool, True, _('HTTP Upload: Enable HTTPS Verification')],
'filetransfer_preference' : [ opt_str, 'httpupload', _('Preferred file transfer mechanism for file drag&drop on chat window. Can be \'httpupload\' (default) or \'jingle\'')], 'filetransfer_preference' : [opt_str, 'httpupload', _('Preferred file transfer mechanism for file drag&drop on chat window. Can be \'httpupload\' (default) or \'jingle\'')],
'allow_posh': [ opt_bool, True, _('Allow cert verification with POSH')], 'allow_posh': [opt_bool, True, _('Allow cert verification with POSH')],
}, {}), }, {}),
'statusmsg': ({ 'statusmsg': ({
'message': [ opt_str, '' ], 'message': [opt_str, ''],
'activity': [ opt_str, '' ], 'activity': [opt_str, ''],
'subactivity': [ opt_str, '' ], 'subactivity': [opt_str, ''],
'activity_text': [ opt_str, '' ], 'activity_text': [opt_str, ''],
'mood': [ opt_str, '' ], 'mood': [opt_str, ''],
'mood_text': [ opt_str, '' ], 'mood_text': [opt_str, ''],
}, {}), }, {}),
'defaultstatusmsg': ({ 'defaultstatusmsg': ({
'enabled': [ opt_bool, False ], 'enabled': [opt_bool, False],
'message': [ opt_str, '' ], 'message': [opt_str, ''],
}, {}), }, {}),
'soundevents': ({ 'soundevents': ({
'enabled': [ opt_bool, True ], 'enabled': [opt_bool, True],
'path': [ opt_str, '' ], 'path': [opt_str, ''],
}, {}), }, {}),
'proxies': ({ 'proxies': ({
'type': [ opt_str, 'http' ], 'type': [opt_str, 'http'],
'host': [ opt_str, '' ], 'host': [opt_str, ''],
'port': [ opt_int, 3128 ], 'port': [opt_int, 3128],
'useauth': [ opt_bool, False ], 'useauth': [opt_bool, False],
'user': [ opt_str, '' ], 'user': [opt_str, ''],
'pass': [ opt_str, '' ], 'pass': [opt_str, ''],
'bosh_uri': [ opt_str, '' ], 'bosh_uri': [opt_str, ''],
'bosh_useproxy': [ opt_bool, False ], 'bosh_useproxy': [opt_bool, False],
'bosh_wait': [ opt_int, 30 ], 'bosh_wait': [opt_int, 30],
'bosh_hold': [ opt_int, 2 ], 'bosh_hold': [opt_int, 2],
'bosh_content': [ opt_str, 'text/xml; charset=utf-8' ], 'bosh_content': [opt_str, 'text/xml; charset=utf-8'],
'bosh_http_pipelining': [ opt_bool, False ], 'bosh_http_pipelining': [opt_bool, False],
'bosh_wait_for_restart_response': [ opt_bool, False ], 'bosh_wait_for_restart_response': [opt_bool, False],
}, {}), }, {}),
'contacts': ({ 'contacts': ({
'speller_language': [ opt_str, '', _('Language for which misspelled words will be checked')], 'speller_language': [opt_str, '', _('Language for which misspelled words will be checked')],
}, {}), }, {}),
'encryption': ({'encryption': [ opt_str, '', _('The currently active encryption for that contact')], 'encryption': ({
},{}), 'encryption': [opt_str, '', _('The currently active encryption for that contact')],
'rooms': ({ }, {}),
'speller_language': [ opt_str, '', _('Language for which misspelled words will be checked')], 'rooms': ({
'muc_restore_lines': [opt_int, -2, _('How many lines to request from server when entering a groupchat. -1 means no limit, -2 means global value')], 'speller_language': [opt_str, '', _('Language for which misspelled words will be checked')],
'muc_restore_timeout': [opt_int, -2, _('Minutes of backlog to request when entering a groupchat. -1 means no limit, -2 means global value')], 'muc_restore_lines': [opt_int, -2, _('How many lines to request from server when entering a groupchat. -1 means no limit, -2 means global value')],
'notify_on_all_messages': [opt_bool, False, _('State whether a notification is created for every message in this room')], 'muc_restore_timeout': [opt_int, -2, _('Minutes of backlog to request when entering a groupchat. -1 means no limit, -2 means global value')],
}, {}), 'notify_on_all_messages': [opt_bool, False, _('State whether a notification is created for every message in this room')],
'plugins': ({ }, {}),
'active': [opt_bool, False, _('State whether plugins should be activated on startup (this is saved on Gajim exit). This option SHOULD NOT be used to (de)activate plug-ins. Use GUI instead.')], 'plugins': ({
},{}), 'active': [opt_bool, False, _('State whether plugins should be activated on startup (this is saved on Gajim exit). This option SHOULD NOT be used to (de)activate plug-ins. Use GUI instead.')],
}, {}),
} }
statusmsg_default = { statusmsg_default = {
_('Sleeping'): [ 'ZZZZzzzzzZZZZZ', 'inactive', 'sleeping', '', 'sleepy', '' ], _('Sleeping'): ['ZZZZzzzzzZZZZZ', 'inactive', 'sleeping', '', 'sleepy', ''],
_('Back soon'): [ _('Back in some minutes.'), '', '', '', '', '' ], _('Back soon'): [_('Back in some minutes.'), '', '', '', '', ''],
_('Eating'): [ _("I'm eating, so leave me a message."), 'eating', 'other', '', '', '' ], _('Eating'): [_("I'm eating, so leave me a message."), 'eating', 'other', '', '', ''],
_('Movie'): [ _("I'm watching a movie."), 'relaxing', 'watching_a_movie', '', '', '' ], _('Movie'): [_("I'm watching a movie."), 'relaxing', 'watching_a_movie', '', '', ''],
_('Working'): [ _("I'm working."), 'working', 'other', '', '', '' ], _('Working'): [_("I'm working."), 'working', 'other', '', '', ''],
_('Phone'): [ _("I'm on the phone."), 'talking', 'on_the_phone', '', '', '' ], _('Phone'): [_("I'm on the phone."), 'talking', 'on_the_phone', '', '', ''],
_('Out'): [ _("I'm out enjoying life."), 'relaxing', 'going_out', '', '', '' ], _('Out'): [_("I'm out enjoying life."), 'relaxing', 'going_out', '', '', ''],
'_last_online': ['', '', '', '', '', ''], '_last_online': ['', '', '', '', '', ''],
'_last_chat': ['', '', '', '', '', ''], '_last_chat': ['', '', '', '', '', ''],
'_last_away': ['', '', '', '', '', ''], '_last_away': ['', '', '', '', '', ''],
'_last_xa': ['', '', '', '', '', ''], '_last_xa': ['', '', '', '', '', ''],
'_last_dnd': ['', '', '', '', '', ''], '_last_dnd': ['', '', '', '', '', ''],
'_last_invisible': ['', '', '', '', '', ''], '_last_invisible': ['', '', '', '', '', ''],
'_last_offline': ['', '', '', '', '', ''], '_last_offline': ['', '', '', '', '', ''],
} }
defaultstatusmsg_default = { defaultstatusmsg_default = {
'online': [ False, _("I'm available.") ], 'online': [False, _("I'm available.")],
'chat': [ False, _("I'm free for chat.") ], 'chat': [False, _("I'm free for chat.")],
'away': [ False, _('Be right back.') ], 'away': [False, _('Be right back.')],
'xa': [ False, _("I'm not available.") ], 'xa': [False, _("I'm not available.")],
'dnd': [ False, _('Do not disturb.') ], 'dnd': [False, _('Do not disturb.')],
'invisible': [ False, _('Bye!') ], 'invisible': [False, _('Bye!')],
'offline': [ False, _('Bye!') ], 'offline': [False, _('Bye!')],
} }
soundevents_default = { soundevents_default = {
'attention_received': [True, 'attention.wav'], 'attention_received': [True, 'attention.wav'],
'first_message_received': [ True, 'message1.wav' ], 'first_message_received': [True, 'message1.wav'],
'next_message_received_focused': [ True, 'message2.wav' ], 'next_message_received_focused': [True, 'message2.wav'],
'next_message_received_unfocused': [ True, 'message2.wav' ], 'next_message_received_unfocused': [True, 'message2.wav'],
'contact_connected': [ False, 'connected.wav' ], 'contact_connected': [False, 'connected.wav'],
'contact_disconnected': [ False, 'disconnected.wav' ], 'contact_disconnected': [False, 'disconnected.wav'],
'message_sent': [ False, 'sent.wav' ], 'message_sent': [False, 'sent.wav'],
'muc_message_highlight': [ True, 'gc_message1.wav', _('Sound to play when a group chat message contains one of the words in muc_highlight_words, or when a group chat message contains your nickname.')], 'muc_message_highlight': [True, 'gc_message1.wav', _('Sound to play when a group chat message contains one of the words in muc_highlight_words, or when a group chat message contains your nickname.')],
'muc_message_received': [ False, 'gc_message2.wav', _('Sound to play when any MUC message arrives.') ], 'muc_message_received': [False, 'gc_message2.wav', _('Sound to play when any MUC message arrives.')],
} }
proxies_default = { proxies_default = {
@ -597,7 +600,7 @@ class Config:
opt[1][name][o] = opt[0][o][Option.VAL] opt[1][name][o] = opt[0][o][Option.VAL]
self._timeout_save() self._timeout_save()
def del_per(self, typename, name, subname = None): # per_group_of_option def del_per(self, typename, name, subname=None): # per_group_of_option
if typename not in self.__options_per_key: if typename not in self.__options_per_key:
return return

View File

@ -169,7 +169,7 @@ class CommonConnection:
return 'bad_pass' return 'bad_pass'
return 'ok' return 'ok'
def get_signed_msg(self, msg, callback = None): def get_signed_msg(self, msg, callback=None):
""" """
Returns the signed message if possible or an empty string if gpg is not Returns the signed message if possible or an empty string if gpg is not
used or None if waiting for passphrase used or None if waiting for passphrase
@ -293,8 +293,8 @@ class CommonConnection:
addresses = msg_iq.addChild('addresses', addresses = msg_iq.addChild('addresses',
namespace=nbxmpp.NS_ADDRESS) namespace=nbxmpp.NS_ADDRESS)
for j in obj.jid: for j in obj.jid:
addresses.addChild('address', attrs = {'type': 'to', addresses.addChild('address',
'jid': j}) attrs={'type': 'to', 'jid': j})
else: else:
iqs = [] iqs = []
for j in obj.jid: for j in obj.jid:
@ -708,7 +708,7 @@ class Connection(CommonConnection, ConnectionHandlers):
def _connection_lost(self): def _connection_lost(self):
log.info('_connection_lost') log.info('_connection_lost')
self.disconnect(on_purpose = False) self.disconnect(on_purpose=False)
if self.removing_account: if self.removing_account:
return return
app.nec.push_incoming_event(ConnectionLostEvent(None, conn=self, app.nec.push_incoming_event(ConnectionLostEvent(None, conn=self,
@ -746,7 +746,7 @@ class Connection(CommonConnection, ConnectionHandlers):
self.gpg = gpg.GnuPG() self.gpg = gpg.GnuPG()
app.nec.push_incoming_event( app.nec.push_incoming_event(
AccountCreatedEvent(None, conn=self, AccountCreatedEvent(None, conn=self,
account_info = self.new_account_info)) account_info=self.new_account_info))
self.new_account_info = None self.new_account_info = None
self.new_account_form = None self.new_account_form = None
if self.connection: if self.connection:
@ -1062,7 +1062,7 @@ class Connection(CommonConnection, ConnectionHandlers):
log.info(msg) log.info(msg)
if self._proxy: if self._proxy:
msg = '>>>>>> ' msg = '>>>>>> '
if self._proxy['type']=='bosh': if self._proxy['type'] == 'bosh':
msg = '%s over BOSH %s' % (msg, self._proxy['bosh_uri']) msg = '%s over BOSH %s' % (msg, self._proxy['bosh_uri'])
if self._proxy['type'] in ['http', 'socks5'] or self._proxy['bosh_useproxy']: if self._proxy['type'] in ['http', 'socks5'] or self._proxy['bosh_useproxy']:
msg = '%s over proxy %s:%s' % (msg, self._proxy['host'], self._proxy['port']) msg = '%s over proxy %s:%s' % (msg, self._proxy['host'], self._proxy['port'])
@ -1072,7 +1072,7 @@ class Connection(CommonConnection, ConnectionHandlers):
if not con_type: if not con_type:
# we are not retrying, and not conecting # we are not retrying, and not conecting
if not self.retrycount and self.connected != 0: if not self.retrycount and self.connected != 0:
self.disconnect(on_purpose = True) self.disconnect(on_purpose=True)
if self._proxy: if self._proxy:
pritxt = _('Could not connect to "%(host)s" via proxy "%(proxy)s"') %\ pritxt = _('Could not connect to "%(host)s" via proxy "%(proxy)s"') %\
{'host': self._hostname, 'proxy': self._proxy['host']} {'host': self._hostname, 'proxy': self._proxy['host']}
@ -1097,7 +1097,7 @@ class Connection(CommonConnection, ConnectionHandlers):
log.error('Connection to proxy failed: %s', reason) log.error('Connection to proxy failed: %s', reason)
self.time_to_reconnect = None self.time_to_reconnect = None
self.on_connect_failure = None self.on_connect_failure = None
self.disconnect(on_purpose = True) self.disconnect(on_purpose=True)
app.nec.push_incoming_event(ConnectionLostEvent(None, conn=self, app.nec.push_incoming_event(ConnectionLostEvent(None, conn=self,
title=_('Connection to proxy failed'), msg=reason)) title=_('Connection to proxy failed'), msg=reason))
@ -1334,7 +1334,7 @@ class Connection(CommonConnection, ConnectionHandlers):
# Forget password, it's wrong # Forget password, it's wrong
self.password = None self.password = None
log.debug("Couldn't authenticate to %s", self._hostname) log.debug("Couldn't authenticate to %s", self._hostname)
self.disconnect(on_purpose = True) self.disconnect(on_purpose=True)
app.nec.push_incoming_event(OurShowEvent(None, conn=self, app.nec.push_incoming_event(OurShowEvent(None, conn=self,
show='offline')) show='offline'))
app.nec.push_incoming_event(InformationEvent(None, conn=self, app.nec.push_incoming_event(InformationEvent(None, conn=self,
@ -1351,7 +1351,7 @@ class Connection(CommonConnection, ConnectionHandlers):
if self.connection: if self.connection:
self.connection.send(' ') self.connection.send(' ')
def send_invisible_presence(self, msg, signed, initial = False): def send_invisible_presence(self, msg, signed, initial=False):
if not app.account_is_connected(self.name): if not app.account_is_connected(self.name):
return return
if not self.get_module('PrivacyLists').supported: if not self.get_module('PrivacyLists').supported:
@ -1412,7 +1412,7 @@ class Connection(CommonConnection, ConnectionHandlers):
# Inform GUI we just signed in # Inform GUI we just signed in
app.nec.push_incoming_event(SignedInEvent(None, conn=self)) app.nec.push_incoming_event(SignedInEvent(None, conn=self))
def get_signed_presence(self, msg, callback = None): def get_signed_presence(self, msg, callback=None):
if app.config.get_per('accounts', self.name, 'gpg_sign_presence'): if app.config.get_per('accounts', self.name, 'gpg_sign_presence'):
return self.get_signed_msg(msg, callback) return self.get_signed_msg(msg, callback)
return '' return ''

View File

@ -842,8 +842,8 @@ class FileRequestReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
n = file_tag.getTag('name') n = file_tag.getTag('name')
n = n.getData() if n else None n = n.getData() if n else None
pjid = app.get_jid_without_resource(self.fjid) pjid = app.get_jid_without_resource(self.fjid)
file_info = self.conn.get_file_info(pjid, hash_=h, file_info = self.conn.get_file_info(
name=n,account=self.conn.name) pjid, hash_=h, name=n, account=self.conn.name)
self.file_props.file_name = file_info['file-name'] self.file_props.file_name = file_info['file-name']
self.file_props.sender = self.conn._ft_get_our_jid() self.file_props.sender = self.conn._ft_get_our_jid()
self.file_props.receiver = self.fjid self.file_props.receiver = self.fjid
@ -1244,16 +1244,12 @@ class MessageOutgoingEvent(nec.NetworkOutgoingEvent):
return True return True
class StanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent): class StanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent):
name='stanza-message-outgoing' name = 'stanza-message-outgoing'
def generate(self):
return True
class GcStanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent): class GcStanzaMessageOutgoingEvent(nec.NetworkOutgoingEvent):
name='gc-stanza-message-outgoing' name = 'gc-stanza-message-outgoing'
def generate(self):
return True
class GcMessageOutgoingEvent(nec.NetworkOutgoingEvent): class GcMessageOutgoingEvent(nec.NetworkOutgoingEvent):
name = 'gc-message-outgoing' name = 'gc-message-outgoing'

View File

@ -61,7 +61,7 @@ class Event:
class ChatEvent(Event): class ChatEvent(Event):
type_ = 'chat' type_ = 'chat'
def __init__ (self, message, subject, kind, time_, encrypted, resource, def __init__(self, message, subject, kind, time_, encrypted, resource,
msg_log_id, correct_id=None, xhtml=None, session=None, form_node=None, msg_log_id, correct_id=None, xhtml=None, session=None, form_node=None,
displaymarking=None, sent_forwarded=False, show_in_roster=False, displaymarking=None, sent_forwarded=False, show_in_roster=False,
show_in_systray=True, additional_data=None): show_in_systray=True, additional_data=None):
@ -301,7 +301,7 @@ class Events:
def get_nb_events(self, types=None, account=None): def get_nb_events(self, types=None, account=None):
if types is None: if types is None:
types = [] types = []
return self._get_nb_events(types = types, account = account) return self._get_nb_events(types=types, account=account)
def get_events(self, account, jid=None, types=None): def get_events(self, account, jid=None, types=None):
""" """

View File

@ -274,7 +274,7 @@ def temp_failure_retry(func, *args, **kwargs):
else: else:
raise raise
def get_uf_show(show, use_mnemonic = False): def get_uf_show(show, use_mnemonic=False):
""" """
Return a userfriendly string for dnd/xa/chat and make all strings Return a userfriendly string for dnd/xa/chat and make all strings
translatable translatable
@ -361,7 +361,7 @@ def get_uf_ask(ask):
return uf_ask return uf_ask
def get_uf_role(role, plural = False): def get_uf_role(role, plural=False):
''' plural determines if you get Moderators or Moderator''' ''' plural determines if you get Moderators or Moderator'''
if role == 'none': if role == 'none':
role_name = Q_('?Group Chat Contact Role:None') role_name = Q_('?Group Chat Contact Role:None')
@ -516,7 +516,7 @@ def sanitize_filename(filename):
return filename return filename
def reduce_chars_newlines(text, max_chars = 0, max_lines = 0): def reduce_chars_newlines(text, max_chars=0, max_lines=0):
""" """
Cut the chars after 'max_chars' on each line and show only the first Cut the chars after 'max_chars' on each line and show only the first
'max_lines' 'max_lines'
@ -984,7 +984,7 @@ def get_notification_icon_tooltip_dict():
account_name = account['name'] account_name = account['name']
account['event_lines'] = [] account['event_lines'] = []
# Gather events per-account # Gather events per-account
pending_events = app.events.get_events(account = account_name) pending_events = app.events.get_events(account=account_name)
messages, non_messages, total_messages, total_non_messages = {}, {}, 0, 0 messages, non_messages, total_messages, total_non_messages = {}, {}, 0, 0
for jid in pending_events: for jid in pending_events:
for event in pending_events[jid]: for event in pending_events[jid]:
@ -1028,7 +1028,7 @@ def get_notification_icon_tooltip_dict():
text = ngettext( text = ngettext(
'%d event pending', '%d event pending',
'%d events pending', '%d events pending',
total_non_messages, total_non_messages,total_non_messages) total_non_messages, total_non_messages, total_non_messages)
account['event_lines'].append(text) account['event_lines'].append(text)
else: else:
for jid in non_messages: for jid in non_messages:
@ -1194,7 +1194,7 @@ def prepare_and_validate_gpg_keyID(account, jid, keyID):
keyID = 'UNKNOWN' keyID = 'UNKNOWN'
return keyID return keyID
def update_optional_features(account = None): def update_optional_features(account=None):
if account: if account:
accounts = [account] accounts = [account]
else: else:

View File

@ -1010,9 +1010,9 @@ class Logger:
lang = data[i + 2] lang = data[i + 2]
name = data[i + 3] name = data[i + 3]
identities.append({'category': category, 'type': type_, identities.append({'category': category, 'type': type_,
'xml:lang': lang, 'name': name}) 'xml:lang': lang, 'name': name})
i += 4 i += 4
i+=1 i += 1
while i < len(data): while i < len(data):
features.append(data[i]) features.append(data[i])
i += 1 i += 1

View File

@ -71,6 +71,7 @@ def parseAndSetLogLevels(arg):
class colors: class colors:
# pylint: disable=C0326
NONE = chr(27) + "[0m" NONE = chr(27) + "[0m"
BLACk = chr(27) + "[30m" BLACk = chr(27) + "[30m"
RED = chr(27) + "[31m" RED = chr(27) + "[31m"
@ -97,11 +98,11 @@ class FancyFormatter(logging.Formatter):
An eye-candy formatter with colors An eye-candy formatter with colors
""" """
colors_mapping = { colors_mapping = {
'DEBUG': colors.BLUE, 'DEBUG': colors.BLUE,
'INFO': colors.GREEN, 'INFO': colors.GREEN,
'WARNING': colors.BROWN, 'WARNING': colors.BROWN,
'ERROR': colors.RED, 'ERROR': colors.RED,
'CRITICAL': colors.BRIGHT_RED, 'CRITICAL': colors.BRIGHT_RED,
} }
def __init__(self, fmt, datefmt=None, use_color=False): def __init__(self, fmt, datefmt=None, use_color=False):
@ -138,11 +139,11 @@ def init():
consoleloghandler = logging.StreamHandler() consoleloghandler = logging.StreamHandler()
consoleloghandler.setFormatter( consoleloghandler.setFormatter(
FancyFormatter( FancyFormatter(
'%(asctime)s %(levelname)s %(name)s %(message)s', '%(asctime)s %(levelname)s %(name)s %(message)s',
'%x %H:%M:%S', '%x %H:%M:%S',
use_color use_color
) )
) )
# fake the root logger so we have 'gajim' root name instead of 'root' # fake the root logger so we have 'gajim' root name instead of 'root'

View File

@ -141,7 +141,7 @@ class ProxyResolver:
iq = nbxmpp.Protocol(name='iq', to=self.jid, typ='set') iq = nbxmpp.Protocol(name='iq', to=self.jid, typ='set')
query = iq.setTag('query') query = iq.setTag('query')
query.setNamespace(nbxmpp.NS_BYTESTREAM) query.setNamespace(nbxmpp.NS_BYTESTREAM)
query.setAttr('sid', self.sid) query.setAttr('sid', self.sid)
activate = query.setTag('activate') activate = query.setTag('activate')
activate.setData('test@gajim.org/test2') activate.setData('test@gajim.org/test2')

View File

@ -35,11 +35,11 @@ else:
result = int(text) result = int(text)
if result < 0: if result < 0:
raise ValueError("Error: value '%(text)s' " raise ValueError("Error: value '%(text)s' "
"must be a positive integer") "must be a positive integer")
return result return result
def generate_uri_role( role_name, aliases, anchor_text, base_url, def generate_uri_role(role_name, aliases, anchor_text, base_url,
interpret_url, validator): interpret_url, validator):
""" """
Create and register a uri based "interpreted role" Create and register a uri based "interpreted role"
@ -58,13 +58,13 @@ else:
should return the validated text, or raise ValueError should return the validated text, or raise ValueError
""" """
def uri_reference_role(role, rawtext, text, lineno, inliner, def uri_reference_role(role, rawtext, text, lineno, inliner,
options=None, content=None): options=None, content=None):
if options is None: if options is None:
options = {} options = {}
try: try:
valid_text = validator(text) valid_text = validator(text)
except ValueError as e: except ValueError as e:
msg = inliner.reporter.error( e.message % dict(text=text), line=lineno) msg = inliner.reporter.error(e.message % dict(text=text), line=lineno)
prb = inliner.problematic(rawtext, rawtext, msg) prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg] return [prb], [msg]
ref = base_url + interpret_url % valid_text ref = base_url + interpret_url % valid_text

View File

@ -24,19 +24,21 @@ import hashlib
import os import os
import time import time
import platform import platform
import logging
from errno import EWOULDBLOCK from errno import EWOULDBLOCK
from errno import ENOBUFS from errno import ENOBUFS
from errno import EINTR from errno import EINTR
from errno import EISCONN from errno import EISCONN
from errno import EINPROGRESS from errno import EINPROGRESS
from errno import EAFNOSUPPORT from errno import EAFNOSUPPORT
from nbxmpp.idlequeue import IdleObject from nbxmpp.idlequeue import IdleObject
import OpenSSL
from gajim.common.file_props import FilesProp from gajim.common.file_props import FilesProp
from gajim.common import app from gajim.common import app
from gajim.common import jingle_xtls from gajim.common import jingle_xtls
if jingle_xtls.PYOPENSSL_PRESENT:
import OpenSSL
import logging
log = logging.getLogger('gajim.c.socks5') log = logging.getLogger('gajim.c.socks5')
MAX_BUFF_LEN = 65536 MAX_BUFF_LEN = 65536
# after foo seconds without activity label transfer as 'stalled' # after foo seconds without activity label transfer as 'stalled'
@ -159,8 +161,8 @@ class SocksQueue:
file_props.proxy_sender = streamhost['target'] file_props.proxy_sender = streamhost['target']
file_props.proxy_receiver = streamhost['initiator'] file_props.proxy_receiver = streamhost['initiator']
socks5obj = Socks5SenderClient(self.idlequeue, idx, socks5obj = Socks5SenderClient(self.idlequeue, idx,
self, _sock=None,host=str(streamhost['host']), self, _sock=None, host=str(streamhost['host']),
port=int(streamhost['port']),fingerprint=fp, port=int(streamhost['port']), fingerprint=fp,
connected=False, file_props=file_props, connected=False, file_props=file_props,
initiator=streamhost['initiator'], initiator=streamhost['initiator'],
target=streamhost['target']) target=streamhost['target'])
@ -342,7 +344,7 @@ class SocksQueue:
sock_hash = sock.__hash__() sock_hash = sock.__hash__()
if listener.file_props.type_ == 's' and \ if listener.file_props.type_ == 's' and \
not self.isHashInSockObjs(self.senders, sock_hash): not self.isHashInSockObjs(self.senders, sock_hash):
sockobj = Socks5SenderServer(self.idlequeue, sock_hash, self, sockobj = Socks5SenderServer(self.idlequeue, sock_hash, self,
sock[0], sock[1][0], sock[1][1], fingerprint=None, sock[0], sock[1][0], sock[1][1], fingerprint=None,
file_props=listener.file_props) file_props=listener.file_props)
self._add(sockobj, self.senders, listener.file_props, sock_hash) self._add(sockobj, self.senders, listener.file_props, sock_hash)
@ -356,8 +358,8 @@ class SocksQueue:
sh['port'] = sock[1][1] sh['port'] = sock[1][1]
sh['initiator'] = None sh['initiator'] = None
sh['target'] = None sh['target'] = None
sockobj = Socks5ReceiverServer(idlequeue=self.idlequeue, sockobj = Socks5ReceiverServer(idlequeue=self.idlequeue,
streamhost=sh,transport_sid=None, streamhost=sh, transport_sid=None,
file_props=listener.file_props, fingerprint=None) file_props=listener.file_props, fingerprint=None)
self._add(sockobj, self.readers, listener.file_props, sock_hash) self._add(sockobj, self.readers, listener.file_props, sock_hash)
@ -411,8 +413,8 @@ class SocksQueue:
if idx != -1: if idx != -1:
for key in list(self.readers.keys()): for key in list(self.readers.keys()):
if idx in key: if idx in key:
self.remove_receiver_by_key(key, self.remove_receiver_by_key(
do_disconnect=do_disconnect) key, do_disconnect=do_disconnect)
if not remove_all: if not remove_all:
break break
@ -528,8 +530,8 @@ class Socks5:
def do_connect(self): def do_connect(self):
try: try:
self._sock.connect(self._server) self._sock.connect(self._server)
self._send=self._sock.send self._send = self._sock.send
self._recv=self._sock.recv self._recv = self._sock.recv
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError): except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError):
pass pass
except Exception as ee: except Exception as ee:
@ -545,8 +547,8 @@ class Socks5:
return None return None
# socket is already connected # socket is already connected
self._sock.setblocking(False) self._sock.setblocking(False)
self._send=self._sock.send self._send = self._sock.send
self._recv=self._sock.recv self._recv = self._sock.recv
self.buff = '' self.buff = ''
self.connected = True self.connected = True
self.file_props.connected = True self.file_props.connected = True
@ -855,7 +857,7 @@ class Socks5:
self.port >> 8, self.port & 0xff) self.port >> 8, self.port & 0xff)
return buff return buff
def _get_request_buff(self, msg, command = 0x01): def _get_request_buff(self, msg, command=0x01):
""" """
Connect request by domain name, sid sha, instead of domain name (jep Connect request by domain name, sid sha, instead of domain name (jep
0096) 0096)
@ -931,7 +933,7 @@ class Socks5Sender(IdleObject):
Class for sending file to socket over socks5 Class for sending file to socket over socks5
""" """
def __init__(self, idlequeue, sock_hash, parent, _sock, host=None, def __init__(self, idlequeue, sock_hash, parent, _sock, host=None,
port=None, fingerprint = None, connected=True, file_props=None): port=None, fingerprint=None, connected=True, file_props=None):
self.fingerprint = fingerprint self.fingerprint = fingerprint
self.queue_idx = sock_hash self.queue_idx = sock_hash
self.queue = parent self.queue = parent
@ -1010,8 +1012,8 @@ class Socks5Sender(IdleObject):
class Socks5Receiver(IdleObject): class Socks5Receiver(IdleObject):
def __init__(self, idlequeue, streamhost, sid, file_props = None, def __init__(self, idlequeue, streamhost, sid, file_props=None,
fingerprint=None): fingerprint=None):
""" """
fingerprint: fingerprint of certificates we shall use, set to None if fingerprint: fingerprint of certificates we shall use, set to None if
TLS connection not desired TLS connection not desired
@ -1345,23 +1347,23 @@ class Socks5Client(Socks5):
class Socks5SenderClient(Socks5Client, Socks5Sender): class Socks5SenderClient(Socks5Client, Socks5Sender):
def __init__(self, idlequeue, sock_hash, parent,_sock, host=None, def __init__(self, idlequeue, sock_hash, parent, _sock, host=None,
port=None, fingerprint = None, connected=True, file_props=None, port=None, fingerprint=None, connected=True, file_props=None,
initiator=None, target=None): initiator=None, target=None):
Socks5Client.__init__(self, idlequeue, host, port, initiator, target, Socks5Client.__init__(self, idlequeue, host, port, initiator, target,
file_props.transport_sid) file_props.transport_sid)
Socks5Sender.__init__(self,idlequeue, sock_hash, parent,_sock, Socks5Sender.__init__(self, idlequeue, sock_hash, parent, _sock,
host, port, fingerprint , connected, file_props) host, port, fingerprint, connected, file_props)
class Socks5SenderServer(Socks5Server, Socks5Sender): class Socks5SenderServer(Socks5Server, Socks5Sender):
def __init__(self, idlequeue, sock_hash, parent,_sock, host=None, def __init__(self, idlequeue, sock_hash, parent, _sock, host=None,
port=None, fingerprint = None, connected=True, file_props=None): port=None, fingerprint=None, connected=True, file_props=None):
Socks5Server.__init__(self, idlequeue, host, port, None, None, Socks5Server.__init__(self, idlequeue, host, port, None, None,
file_props.transport_sid) file_props.transport_sid)
Socks5Sender.__init__(self,idlequeue, sock_hash, parent, _sock, Socks5Sender.__init__(self, idlequeue, sock_hash, parent, _sock,
host, port, fingerprint , connected, file_props) host, port, fingerprint, connected, file_props)
class Socks5ReceiverClient(Socks5Client, Socks5Receiver): class Socks5ReceiverClient(Socks5Client, Socks5Receiver):
@ -1481,8 +1483,7 @@ class Socks5Listener(IdleObject):
""" """
Accept a new incomming connection Accept a new incomming connection
""" """
_sock = self._serv.accept() _sock = self._serv.accept()
_sock[0].setblocking(False) _sock[0].setblocking(False)
self.connections.append(_sock[0]) self.connections.append(_sock[0])
return _sock return _sock

View File

@ -315,7 +315,7 @@ class P2PClient(IdleObject):
def _register_handlers(self): def _register_handlers(self):
self._caller.peerhost = self.Connection._sock.getsockname() self._caller.peerhost = self.Connection._sock.getsockname()
self.RegisterHandler('message', lambda conn, self.RegisterHandler('message', lambda conn,
data:self._caller._messageCB(self.Server, conn, data)) data: self._caller._messageCB(self.Server, conn, data))
self.RegisterHandler('iq', self._caller._siSetCB, 'set', nbxmpp.NS_SI) self.RegisterHandler('iq', self._caller._siSetCB, 'set', nbxmpp.NS_SI)
self.RegisterHandler('iq', self._caller._siErrorCB, 'error', self.RegisterHandler('iq', self._caller._siErrorCB, 'error',
nbxmpp.NS_SI) nbxmpp.NS_SI)
@ -522,7 +522,7 @@ class P2PConnection(IdleObject, PlugIn):
self.pollend() self.pollend()
# don't proccess result, cas it will raise error # don't proccess result, cas it will raise error
return return
elif not received : elif not received:
if errnum != ssl.SSL_ERROR_EOF: if errnum != ssl.SSL_ERROR_EOF:
# 8 EOF occurred in violation of protocol # 8 EOF occurred in violation of protocol
self.pollend() self.pollend()
@ -716,7 +716,7 @@ class ClientZeroconf:
connection.force_disconnect() connection.force_disconnect()
def add_connection(self, connection, ip, port, recipient): def add_connection(self, connection, ip, port, recipient):
sock_hash=connection.sock_hash sock_hash = connection.sock_hash
if sock_hash not in self.connections: if sock_hash not in self.connections:
self.connections[sock_hash] = connection self.connections[sock_hash] = connection
self.ip_to_hash[ip] = sock_hash self.ip_to_hash[ip] = sock_hash

View File

@ -132,7 +132,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
for key in diffs: for key in diffs:
self.roster.setItem(key) self.roster.setItem(key)
app.nec.push_incoming_event(NetworkEvent( app.nec.push_incoming_event(NetworkEvent(
'roster-info', conn=self,jid=key, 'roster-info', conn=self, jid=key,
nickname=self.roster.getName(key), sub='both', nickname=self.roster.getName(key), sub='both',
ask='no', groups=self.roster.getGroups(key), ask='no', groups=self.roster.getGroups(key),
avatar_sha=None)) avatar_sha=None))

View File

@ -62,7 +62,7 @@ class Roster:
i += 1 i += 1
txt = contact[Constant.TXT] txt = contact[Constant.TXT]
self._data[jid]={} self._data[jid] = {}
self._data[jid]['ask'] = 'none' self._data[jid]['ask'] = 'none'
self._data[jid]['subscription'] = 'both' self._data[jid]['subscription'] = 'both'
self._data[jid]['groups'] = [] self._data[jid]['groups'] = []

View File

@ -77,7 +77,7 @@ class Zeroconf:
return return
# synchronous resolving # synchronous resolving
self.server.ResolveService( int(interface), int(protocol), name, stype, self.server.ResolveService(int(interface), int(protocol), name, stype,
domain, Protocol.UNSPEC, dbus.UInt32(0), domain, Protocol.UNSPEC, dbus.UInt32(0),
reply_handler=self.service_resolved_callback, reply_handler=self.service_resolved_callback,
error_handler=self.error_callback1) error_handler=self.error_callback1)
@ -474,7 +474,7 @@ class Zeroconf:
return None return None
return self.contacts[jid] return self.contacts[jid]
def update_txt(self, show = None): def update_txt(self, show=None):
if show: if show:
self.txt['status'] = self.replace_show(show) self.txt['status'] = self.replace_show(show)

View File

@ -58,7 +58,7 @@ class DomainBrowser(IntEnum):
class Protocol(IntEnum): class Protocol(IntEnum):
UNSPEC = -1 UNSPEC = -1
INET = 0 INET = 0
INET6 = 1 INET6 = 1
class Interface(IntEnum): class Interface(IntEnum):

View File

@ -199,7 +199,7 @@ class ManageProxiesWindow:
else: else:
proxytype = app.config.get_per('proxies', proxy, 'type') proxytype = app.config.get_per('proxies', proxy, 'type')
self.show_bosh_fields(proxytype=='bosh') self.show_bosh_fields(proxytype == 'bosh')
self.proxyname_entry.set_editable(True) self.proxyname_entry.set_editable(True)
self.xml.get_object('remove_proxy_button').set_sensitive(True) self.xml.get_object('remove_proxy_button').set_sensitive(True)
@ -254,7 +254,7 @@ class ManageProxiesWindow:
return return
types = ['http', 'socks5', 'bosh'] types = ['http', 'socks5', 'bosh']
type_ = self.proxytype_combobox.get_active() type_ = self.proxytype_combobox.get_active()
self.show_bosh_fields(types[type_]=='bosh') self.show_bosh_fields(types[type_] == 'bosh')
proxy = self.proxyname_entry.get_text() proxy = self.proxyname_entry.get_text()
app.config.set_per('proxies', proxy, 'type', types[type_]) app.config.set_per('proxies', proxy, 'type', types[type_])
@ -314,7 +314,7 @@ class FakeDataForm(Gtk.Table):
nbrow = 0 nbrow = 0
if 'instructions' in self.infos: if 'instructions' in self.infos:
nbrow = 1 nbrow = 1
self.resize(rows = nbrow, columns = 2) self.resize(rows=nbrow, columns=2)
label = Gtk.Label(label=self.infos['instructions']) label = Gtk.Label(label=self.infos['instructions'])
if self.selectable: if self.selectable:
label.set_selectable(True) label.set_selectable(True)
@ -326,7 +326,7 @@ class FakeDataForm(Gtk.Table):
continue continue
nbrow = nbrow + 1 nbrow = nbrow + 1
self.resize(rows = nbrow, columns = 2) self.resize(rows=nbrow, columns=2)
label = Gtk.Label(label=name.capitalize() + ':') label = Gtk.Label(label=name.capitalize() + ':')
self.attach(label, 0, 1, nbrow - 1, nbrow, 0, 0, 0, 0) self.attach(label, 0, 1, nbrow - 1, nbrow, 0, 0, 0, 0)
entry = Gtk.Entry() entry = Gtk.Entry()

View File

@ -153,14 +153,13 @@ class ConversationTextview(GObject.GObject):
Class for the conversation textview (where user reads already said messages) Class for the conversation textview (where user reads already said messages)
for chat/groupchat windows for chat/groupchat windows
""" """
__gsignals__ = dict( __gsignals__ = dict(quote=(
quote = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION,
None, # return value None, # return value
(str, ) # arguments (str, ) # arguments
) ))
)
def __init__(self, account, used_in_history_window = False): def __init__(self, account, used_in_history_window=False):
""" """
If used_in_history_window is True, then we do not show Clear menuitem in If used_in_history_window is True, then we do not show Clear menuitem in
context menu context menu
@ -287,7 +286,7 @@ class ConversationTextview(GObject.GObject):
tag = buffer_.create_tag('underline') tag = buffer_.create_tag('underline')
tag.set_property('underline', Pango.Underline.SINGLE) tag.set_property('underline', Pango.Underline.SINGLE)
buffer_.create_tag('focus-out-line', justification = Gtk.Justification.CENTER) buffer_.create_tag('focus-out-line', justification=Gtk.Justification.CENTER)
self.displaymarking_tags = {} self.displaymarking_tags = {}
tag = buffer_.create_tag('xep0184-received') tag = buffer_.create_tag('xep0184-received')
@ -494,7 +493,7 @@ class ConversationTextview(GObject.GObject):
buffer_.end_user_action() buffer_.end_user_action()
self.scroll_to_end() self.scroll_to_end()
def clear(self, tv = None): def clear(self, tv=None):
""" """
Clear text in the textview Clear text in the textview
""" """
@ -599,7 +598,7 @@ class ConversationTextview(GObject.GObject):
item.set_property('sensitive', False) item.set_property('sensitive', False)
else: else:
item = Gtk.MenuItem.new_with_mnemonic(_('Web _Search for it')) item = Gtk.MenuItem.new_with_mnemonic(_('Web _Search for it'))
link = search_link % phrase_for_url link = search_link % phrase_for_url
id_ = item.connect('activate', self.visit_url_from_menuitem, link) id_ = item.connect('activate', self.visit_url_from_menuitem, link)
self.handlers[id_] = item self.handlers[id_] = item
submenu.append(item) submenu.append(item)

View File

@ -21,20 +21,20 @@ Words single and multiple refers here to types of data forms:
single means these with one record of data (without <reported/> element), single means these with one record of data (without <reported/> element),
multiple - these which may contain more data (with <reported/> element).''' multiple - these which may contain more data (with <reported/> element).'''
import itertools
import base64
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GdkPixbuf from gi.repository import GdkPixbuf
from gi.repository import GObject from gi.repository import GObject
from gi.repository import GLib from gi.repository import GLib
import base64
from gajim import gtkgui_helpers from gajim import gtkgui_helpers
from gajim.common.modules import dataforms from gajim.common.modules import dataforms
from gajim.common import helpers from gajim.common import helpers
from gajim.common import app from gajim.common import app
import itertools
class DataFormWidget(Gtk.Alignment): class DataFormWidget(Gtk.Alignment):
# "public" interface # "public" interface
@ -42,9 +42,8 @@ class DataFormWidget(Gtk.Alignment):
Data Form widget. Use like any other widget Data Form widget. Use like any other widget
""" """
__gsignals__ = dict( __gsignals__ = dict(validated=(
validated = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ()) GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ()))
)
def __init__(self, dataformnode=None): def __init__(self, dataformnode=None):
''' Create a widget. ''' ''' Create a widget. '''
@ -313,8 +312,8 @@ class SingleForm(Gtk.Table):
forms, it is in another class forms, it is in another class
""" """
__gsignals__ = dict( __gsignals__ = dict(validated=(
validated = (GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ()) GObject.SignalFlags.RUN_LAST | GObject.SignalFlags.ACTION, None, ())
) )
def __init__(self, dataform, selectable=False): def __init__(self, dataform, selectable=False):
@ -376,7 +375,7 @@ class SingleForm(Gtk.Table):
widget.set_property('selectable', selectable) widget.set_property('selectable', selectable)
widget.set_line_wrap(True) widget.set_line_wrap(True)
self.attach(widget, leftattach, rightattach, linecounter, self.attach(widget, leftattach, rightattach, linecounter,
linecounter+1, xoptions=Gtk.AttachOptions.FILL, linecounter + 1, xoptions=Gtk.AttachOptions.FILL,
yoptions=Gtk.AttachOptions.FILL) yoptions=Gtk.AttachOptions.FILL)
elif field.type_ == 'list-single': elif field.type_ == 'list-single':
@ -476,16 +475,16 @@ class SingleForm(Gtk.Table):
decorate_with_tooltip(treeview, field) decorate_with_tooltip(treeview, field)
add_button=xml.get_object('add_button') add_button = xml.get_object('add_button')
add_button.connect('clicked', add_button.connect('clicked',
self.on_jid_multi_add_button_clicked, treeview, listmodel, field) self.on_jid_multi_add_button_clicked, treeview, listmodel, field)
edit_button=xml.get_object('edit_button') edit_button = xml.get_object('edit_button')
edit_button.connect('clicked', edit_button.connect('clicked',
self.on_jid_multi_edit_button_clicked, treeview) self.on_jid_multi_edit_button_clicked, treeview)
remove_button=xml.get_object('remove_button') remove_button = xml.get_object('remove_button')
remove_button.connect('clicked', remove_button.connect('clicked',
self.on_jid_multi_remove_button_clicked, treeview, field) self.on_jid_multi_remove_button_clicked, treeview, field)
clear_button=xml.get_object('clear_button') clear_button = xml.get_object('clear_button')
clear_button.connect('clicked', clear_button.connect('clicked',
self.on_jid_multi_clean_button_clicked, listmodel, field) self.on_jid_multi_clean_button_clicked, listmodel, field)
if not readwrite: if not readwrite:
@ -526,7 +525,7 @@ class SingleForm(Gtk.Table):
widget = Gtk.ScrolledWindow() widget = Gtk.ScrolledWindow()
widget.add(textwidget) widget.add(textwidget)
widget=decorate_with_tooltip(widget, field) widget = decorate_with_tooltip(widget, field)
self.attach(widget, 1, 2, linecounter, linecounter+1) self.attach(widget, 1, 2, linecounter, linecounter+1)
else: else:
@ -548,13 +547,13 @@ class SingleForm(Gtk.Table):
field.value = '' field.value = ''
widget.set_text(field.value) widget.set_text(field.value)
else: else:
commonwidget=False commonwidget = False
widget = Gtk.Label(label=field.value) widget = Gtk.Label(label=field.value)
widget.set_property('selectable', selectable) widget.set_property('selectable', selectable)
widget.set_sensitive(True) widget.set_sensitive(True)
widget.set_halign(Gtk.Align.START) widget.set_halign(Gtk.Align.START)
widget.set_valign(Gtk.Align.CENTER) widget.set_valign(Gtk.Align.CENTER)
widget=decorate_with_tooltip(widget, field) widget = decorate_with_tooltip(widget, field)
self.attach(widget, 1, 2, linecounter, linecounter+1, self.attach(widget, 1, 2, linecounter, linecounter+1,
yoptions=Gtk.AttachOptions.FILL) yoptions=Gtk.AttachOptions.FILL)
@ -602,7 +601,7 @@ class SingleForm(Gtk.Table):
self.attach(label, 2, 3, linecounter, linecounter+1, xoptions=0, self.attach(label, 2, 3, linecounter, linecounter+1, xoptions=0,
yoptions=0) yoptions=0)
linecounter+=1 linecounter += 1
if self.get_property('visible'): if self.get_property('visible'):
self.show_all() self.show_all()
@ -621,7 +620,7 @@ class SingleForm(Gtk.Table):
if widget.get_active() and value not in field.values: if widget.get_active() and value not in field.values:
field.values += [value] field.values += [value]
elif not widget.get_active() and value in field.values: elif not widget.get_active() and value in field.values:
field.values = [v for v in field.values if v!=value] field.values = [v for v in field.values if v != value]
def on_text_single_entry_changed(self, widget, field): def on_text_single_entry_changed(self, widget, field):
field.value = widget.get_text() field.value = widget.get_text()
@ -644,10 +643,10 @@ class SingleForm(Gtk.Table):
app.interface.raise_dialog('jid-in-list') app.interface.raise_dialog('jid-in-list')
GLib.idle_add(treeview.set_cursor, path) GLib.idle_add(treeview.set_cursor, path)
return return
model[path][0]=newtext model[path][0] = newtext
values = field.values values = field.values
values[values.index(old)]=newtext values[values.index(old)] = newtext
field.values = values field.values = values
def on_jid_multi_add_button_clicked(self, widget, treeview, model, field): def on_jid_multi_add_button_clicked(self, widget, treeview, model, field):
@ -673,7 +672,7 @@ class SingleForm(Gtk.Table):
deleted = [] deleted = []
def remove(model, path, iter_, deleted): def remove(model, path, iter_, deleted):
deleted+=model[iter_] deleted += model[iter_]
model.remove(iter_) model.remove(iter_)
selection.selected_foreach(remove, deleted) selection.selected_foreach(remove, deleted)

View File

@ -235,7 +235,7 @@ class PassphraseDialog:
self.window.show_all() self.window.show_all()
self.check = bool(checkbuttontext) self.check = bool(checkbuttontext)
checkbutton = self.xml.get_object('save_passphrase_checkbutton') checkbutton = self.xml.get_object('save_passphrase_checkbutton')
if self.check: if self.check:
checkbutton.set_label(checkbuttontext) checkbutton.set_label(checkbuttontext)
else: else:
@ -321,7 +321,7 @@ class ChooseGPGKeyDialog:
selection = self.keys_treeview.get_selection() selection = self.keys_treeview.get_selection()
(model, iter_) = selection.get_selected() (model, iter_) = selection.get_selected()
if iter_ and response == Gtk.ResponseType.OK: if iter_ and response == Gtk.ResponseType.OK:
keyID = [ model[iter_][0], model[iter_][1] ] keyID = [model[iter_][0], model[iter_][1]]
else: else:
keyID = None keyID = None
self.on_response(keyID) self.on_response(keyID)
@ -1048,8 +1048,8 @@ class SynchroniseSelectContactsDialog:
self.remote_account, remote_jid) self.remote_account, remote_jid)
# keep same groups and same nickname # keep same groups and same nickname
app.interface.roster.req_sub(self, remote_jid, message, app.interface.roster.req_sub(self, remote_jid, message,
self.local_account, groups = remote_contact.groups, self.local_account, groups=remote_contact.groups,
nickname = remote_contact.name, auto_auth = True) nickname=remote_contact.name, auto_auth=True)
iter_ = model.iter_next(iter_) iter_ = model.iter_next(iter_)
self.dialog.destroy() self.dialog.destroy()
@ -1219,7 +1219,7 @@ class RosterItemExchangeWindow:
a = 0 a = 0
while iter_: while iter_:
if model[iter_][0]: if model[iter_][0]:
a+=1 a += 1
# it is selected # it is selected
#remote_jid = model[iter_][1] #remote_jid = model[iter_][1]
message = _('%s suggested me to add you in my roster.' message = _('%s suggested me to add you in my roster.'
@ -1242,7 +1242,7 @@ class RosterItemExchangeWindow:
a = 0 a = 0
while iter_: while iter_:
if model[iter_][0]: if model[iter_][0]:
a+=1 a += 1
# it is selected # it is selected
jid = model[iter_][1] jid = model[iter_][1]
# keep same groups and same nickname # keep same groups and same nickname
@ -1267,7 +1267,7 @@ class RosterItemExchangeWindow:
a = 0 a = 0
while iter_: while iter_:
if model[iter_][0]: if model[iter_][0]:
a+=1 a += 1
# it is selected # it is selected
jid = model[iter_][1] jid = model[iter_][1]
app.connections[self.account].get_module('Presence').unsubscribe(jid) app.connections[self.account].get_module('Presence').unsubscribe(jid)

View File

@ -132,7 +132,7 @@ class CacheDictionary:
accessed instead of set as well accessed instead of set as well
""" """
def __init__(self, lifetime, getrefresh = True): def __init__(self, lifetime, getrefresh=True):
self.lifetime = lifetime * 1000 * 60 self.lifetime = lifetime * 1000 * 60
self.getrefresh = getrefresh self.getrefresh = getrefresh
self.cache = {} self.cache = {}
@ -215,7 +215,7 @@ class Closure:
Userargs and removeargs must be tuples. Userargs and removeargs must be tuples.
""" """
def __init__(self, cb, userargs = (), remove = None, removeargs = ()): def __init__(self, cb, userargs=(), remove=None, removeargs=()):
self.userargs = userargs self.userargs = userargs
self.remove = remove self.remove = remove
self.removeargs = removeargs self.removeargs = removeargs
@ -250,8 +250,8 @@ class ServicesCache:
def __init__(self, account): def __init__(self, account):
self.account = account self.account = account
self._items = CacheDictionary(0, getrefresh = False) self._items = CacheDictionary(0, getrefresh=False)
self._info = CacheDictionary(0, getrefresh = False) self._info = CacheDictionary(0, getrefresh=False)
self._subscriptions = CacheDictionary(5, getrefresh=False) self._subscriptions = CacheDictionary(5, getrefresh=False)
self._cbs = {} self._cbs = {}
@ -597,7 +597,7 @@ _('Without a connection, you can not browse available services'))
markup += '\n<span size="x-small">%s</span>' % text_after markup += '\n<span size="x-small">%s</span>' % text_after
self.banner.set_markup(markup) self.banner.set_markup(markup)
def destroy(self, chain = False): def destroy(self, chain=False):
""" """
Close the browser. This can optionally close its children and propagate Close the browser. This can optionally close its children and propagate
to the parent. This should happen on actions like register, or join to to the parent. This should happen on actions like register, or join to
@ -621,13 +621,13 @@ _('Without a connection, you can not browse available services'))
for child in self.children[:]: for child in self.children[:]:
child.parent = None child.parent = None
if chain: if chain:
child.destroy(chain = chain) child.destroy(chain=chain)
self.children.remove(child) self.children.remove(child)
if self.parent: if self.parent:
if self in self.parent.children: if self in self.parent.children:
self.parent.children.remove(self) self.parent.children.remove(self)
if chain and not self.parent.children: if chain and not self.parent.children:
self.parent.destroy(chain = chain) self.parent.destroy(chain=chain)
self.parent = None self.parent = None
else: else:
self.cache.cleanup() self.cache.cleanup()
@ -746,7 +746,7 @@ _('Without a connection, you can not browse available services'))
' '.join(self.latest_addresses)) ' '.join(self.latest_addresses))
self.travel(jid, '') self.travel(jid, '')
def on_services_treeview_row_activated(self, widget, path, col = 0): def on_services_treeview_row_activated(self, widget, path, col=0):
if self.browser: if self.browser:
self.browser.default_action() self.browser.default_action()
@ -915,7 +915,7 @@ class AgentBrowser:
""" """
pass pass
def on_browse_button_clicked(self, widget = None): def on_browse_button_clicked(self, widget=None):
""" """
When we want to browse an agent: open a new services window with a When we want to browse an agent: open a new services window with a
browser for the agent type browser for the agent type
@ -940,7 +940,7 @@ class AgentBrowser:
jid = model[iter_][0] jid = model[iter_][0]
node = model[iter_][1] node = model[iter_][1]
if jid: if jid:
self.cache.get_info(jid, node, self._update_actions, nofetch = True) self.cache.get_info(jid, node, self._update_actions, nofetch=True)
def _update_actions(self, jid, node, identities, features, data): def _update_actions(self, jid, node, identities, features, data):
""" """
@ -963,7 +963,7 @@ class AgentBrowser:
jid = model[iter_][0] jid = model[iter_][0]
node = model[iter_][1] node = model[iter_][1]
if jid: if jid:
self.cache.get_info(jid, node, self._default_action, nofetch = True) self.cache.get_info(jid, node, self._default_action, nofetch=True)
def _default_action(self, jid, node, identities, features, data): def _default_action(self, jid, node, identities, features, data):
""" """
@ -1079,7 +1079,7 @@ class AgentBrowser:
""" """
self.model.append((jid, node, item.get('name', ''), self.model.append((jid, node, item.get('name', ''),
get_agent_address(jid, node))) get_agent_address(jid, node)))
self.cache.get_info(jid, node, self._agent_info, force = force) self.cache.get_info(jid, node, self._agent_info, force=force)
def _update_item(self, iter_, jid, node, item): def _update_item(self, iter_, jid, node, item):
""" """
@ -1281,7 +1281,7 @@ class ToplevelAgentBrowser(AgentBrowser):
self.search_button = None self.search_button = None
AgentBrowser._clean_actions(self) AgentBrowser._clean_actions(self)
def on_search_button_clicked(self, widget = None): def on_search_button_clicked(self, widget=None):
""" """
When we want to search something: open search window When we want to search something: open search window
""" """
@ -1316,7 +1316,7 @@ class ToplevelAgentBrowser(AgentBrowser):
node = model[iter_][1] node = model[iter_][1]
adhoc_commands.CommandWindow(self.account, service, commandnode=node) adhoc_commands.CommandWindow(self.account, service, commandnode=node)
def on_register_button_clicked(self, widget = None): def on_register_button_clicked(self, widget=None):
""" """
When we want to register an agent: request information about registering When we want to register an agent: request information about registering
with the agent and close the window with the agent and close the window
@ -1366,8 +1366,8 @@ class ToplevelAgentBrowser(AgentBrowser):
# Guess what kind of service we're dealing with # Guess what kind of service we're dealing with
if self.browse_button: if self.browse_button:
jid = model[iter_][0] jid = model[iter_][0]
type_ = app.get_transport_name_from_jid(jid, type_ = app.get_transport_name_from_jid(
use_config_setting = False) jid, use_config_setting=False)
if type_: if type_:
identity = {'category': '_jid', 'type': type_} identity = {'category': '_jid', 'type': type_}
klass = self.cache.get_browser([identity]) klass = self.cache.get_browser([identity])
@ -1417,7 +1417,7 @@ class ToplevelAgentBrowser(AgentBrowser):
def browse(self, force=False): def browse(self, force=False):
self._progress = 0 self._progress = 0
AgentBrowser.browse(self, force = force) AgentBrowser.browse(self, force=force)
def _expand_all(self): def _expand_all(self):
""" """
@ -1533,8 +1533,8 @@ class ToplevelAgentBrowser(AgentBrowser):
descr = "<b>%s</b>" % addr descr = "<b>%s</b>" % addr
# Guess which kind of service this is # Guess which kind of service this is
identities = [] identities = []
type_ = app.get_transport_name_from_jid(jid, type_ = app.get_transport_name_from_jid(
use_config_setting = False) jid, use_config_setting=False)
if type_: if type_:
identity = {'category': '_jid', 'type': type_} identity = {'category': '_jid', 'type': type_}
identities.append(identity) identities.append(identity)
@ -1801,7 +1801,7 @@ class MucBrowser(AgentBrowser):
iter_ = self.model.iter_next(iter_) iter_ = self.model.iter_next(iter_)
self._fetch_source = None self._fetch_source = None
def _channel_altinfo(self, jid, node, items, name = None): def _channel_altinfo(self, jid, node, items, name=None):
""" """
Callback for the alternate disco#items query. We try to at least get the Callback for the alternate disco#items query. We try to at least get the
amount of users in the room if the service does not support MUC dataforms amount of users in the room if the service does not support MUC dataforms
@ -1857,7 +1857,7 @@ class MucBrowser(AgentBrowser):
break break
else: else:
# We didn't find a form, switch to alternate query mode # We didn't find a form, switch to alternate query mode
self.cache.get_items(jid, node, self._channel_altinfo, args = (name,)) self.cache.get_items(jid, node, self._channel_altinfo, args=(name,))
return return
# Continue with the next # Continue with the next
self._fetch_source = None self._fetch_source = None
@ -1975,8 +1975,8 @@ class DiscussionGroupsBrowser(AgentBrowser):
parent_iter = None parent_iter = None
if not node or not self._in_list(node): if not node or not self._in_list(node):
self.model.append(parent_iter, (jid, node, name, dunno, subscribed)) self.model.append(parent_iter, (jid, node, name, dunno, subscribed))
self.cache.get_items(jid, node, self._add_items, force = force, self.cache.get_items(
args = (force,)) jid, node, self._add_items, force=force, args=(force,))
def _get_child_iter(self, parent_iter, node): def _get_child_iter(self, parent_iter, node):
child_iter = self.model.iter_children(parent_iter) child_iter = self.model.iter_children(parent_iter)
@ -2141,7 +2141,7 @@ class DiscussionGroupsBrowser(AgentBrowser):
model = self.window.services_treeview.get_model() model = self.window.services_treeview.get_model()
for row in model: for row in model:
if row[1] == groupnode: # 1 = groupnode if row[1] == groupnode: # 1 = groupnode
row[4]=False row[4] = False
break break
self.update_actions() self.update_actions()

View File

@ -459,7 +459,7 @@ class FileTransfersWindow:
return self.images.setdefault(ident, return self.images.setdefault(ident,
gtkgui_helpers.get_icon_pixmap(self.icons[ident], 24)) gtkgui_helpers.get_icon_pixmap(self.icons[ident], 24))
def set_status(self,file_props, status): def set_status(self, file_props, status):
""" """
Change the status of a transfer to state 'status' Change the status of a transfer to state 'status'
""" """
@ -519,7 +519,7 @@ class FileTransfersWindow:
return _str return _str
def _format_time(self, _time): def _format_time(self, _time):
times = { 'hours': 0, 'minutes': 0, 'seconds': 0 } times = {'hours': 0, 'minutes': 0, 'seconds': 0}
_time = int(_time) _time = int(_time)
times['seconds'] = _time % 60 times['seconds'] = _time % 60
if _time >= 60: if _time >= 60:

View File

@ -173,7 +173,7 @@ class GajimRemote:
], ],
'prefs_list': [ 'prefs_list': [
_('Lists all preferences and their values'), _('Lists all preferences and their values'),
[ ] []
], ],
'prefs_put': [ 'prefs_put': [
_('Sets value of \'key\' to \'value\'.'), _('Sets value of \'key\' to \'value\'.'),
@ -191,7 +191,7 @@ class GajimRemote:
'prefs_store': [ 'prefs_store': [
_('Writes the current state of Gajim preferences to the .config ' _('Writes the current state of Gajim preferences to the .config '
'file'), 'file'),
[ ] []
], ],
'remove_contact': [ 'remove_contact': [
_('Removes contact from roster'), _('Removes contact from roster'),
@ -219,7 +219,7 @@ class GajimRemote:
'get_unread_msgs_number': [ 'get_unread_msgs_number': [
_('Returns number of unread messages'), _('Returns number of unread messages'),
[ ] []
], ],
'send_xml': [ 'send_xml': [
@ -380,7 +380,7 @@ class GajimRemote:
""" """
Print usage, and list available commands Print usage, and list available commands
""" """
s = _('Usage:\n %s command [arguments]\n\nCommand is one of:\n' ) % ( s = _('Usage:\n %s command [arguments]\n\nCommand is one of:\n') % (
BASENAME) BASENAME)
for command in sorted(self.commands): for command in sorted(self.commands):
s += ' ' + command s += ' ' + command
@ -392,7 +392,7 @@ class GajimRemote:
s += '\n' s += '\n'
return s return s
def print_info(self, level, prop_dict, encode_return = False): def print_info(self, level, prop_dict, encode_return=False):
""" """
Return formatted string from data structure Return formatted string from data structure
""" """
@ -404,11 +404,11 @@ class GajimRemote:
spacing = ' ' * level * 4 spacing = ' ' * level * 4
for val in prop_dict: for val in prop_dict:
if val is None: if val is None:
ret_str +='\t' ret_str += '\t'
elif isinstance(val, int): elif isinstance(val, int):
ret_str +='\t' + str(val) ret_str += '\t' + str(val)
elif isinstance(val, str): elif isinstance(val, str):
ret_str +='\t' + val ret_str += '\t' + val
elif isinstance(val, (list, tuple)): elif isinstance(val, (list, tuple)):
res = '' res = ''
for items in val: for items in val:

View File

@ -1306,7 +1306,7 @@ class GroupchatControl(ChatControlBase):
except KeyError: except KeyError:
return None return None
def print_old_conversation(self, text, contact='', tim=None, xhtml = None, def print_old_conversation(self, text, contact='', tim=None, xhtml=None,
displaymarking=None, msg_stanza_id=None, encrypted=None, additional_data=None): displaymarking=None, msg_stanza_id=None, encrypted=None, additional_data=None):
if additional_data is None: if additional_data is None:
additional_data = {} additional_data = {}
@ -1893,19 +1893,19 @@ class GroupchatControl(ChatControlBase):
self.print_conversation(s, 'info', graphics=False) self.print_conversation(s, 'info', graphics=False)
elif '321' in obj.status_code: elif '321' in obj.status_code:
s = _('%(nick)s has been removed from the room ' s = _('%(nick)s has been removed from the room '
'(%(reason)s)') % { 'nick': nick, '(%(reason)s)') % {'nick': nick,
'reason': _('affiliation changed') } 'reason': _('affiliation changed')}
self.print_conversation(s, 'info', graphics=False) self.print_conversation(s, 'info', graphics=False)
elif '322' in obj.status_code: elif '322' in obj.status_code:
s = _('%(nick)s has been removed from the room ' s = _('%(nick)s has been removed from the room '
'(%(reason)s)') % { 'nick': nick, '(%(reason)s)') % {'nick': nick,
'reason': _('room configuration changed to ' 'reason': _('room configuration changed to '
'members-only') } 'members-only')}
self.print_conversation(s, 'info', graphics=False) self.print_conversation(s, 'info', graphics=False)
elif '332' in obj.status_code: elif '332' in obj.status_code:
s = _('%(nick)s has been removed from the room ' s = _('%(nick)s has been removed from the room '
'(%(reason)s)') % {'nick': nick, '(%(reason)s)') % {'nick': nick,
'reason': _('system shutdown') } 'reason': _('system shutdown')}
self.print_conversation(s, 'info', graphics=False) self.print_conversation(s, 'info', graphics=False)
# Room has been destroyed. # Room has been destroyed.
elif 'destroyed' in obj.status_code: elif 'destroyed' in obj.status_code:
@ -2640,7 +2640,7 @@ class GroupchatControl(ChatControlBase):
item.set_active(target_role != 'visitor') item.set_active(target_role != 'visitor')
if user_role != 'moderator' or \ if user_role != 'moderator' or \
user_affiliation == 'none' or \ user_affiliation == 'none' or \
(user_affiliation=='member' and target_affiliation!='none') or \ (user_affiliation == 'member' and target_affiliation != 'none') or \
target_affiliation in ('admin', 'owner'): target_affiliation in ('admin', 'owner'):
item.set_sensitive(False) item.set_sensitive(False)
id_ = item.connect('activate', self.on_voice_checkmenuitem_activate, id_ = item.connect('activate', self.on_voice_checkmenuitem_activate,
@ -2695,7 +2695,7 @@ class GroupchatControl(ChatControlBase):
bookmarked = False bookmarked = False
contact = app.contacts.get_contact(self.account, jid, c.resource) contact = app.contacts.get_contact(self.account, jid, c.resource)
if contact and contact.supports(nbxmpp.NS_CONFERENCE): if contact and contact.supports(nbxmpp.NS_CONFERENCE):
bookmarked=True bookmarked = True
gui_menu_builder.build_invite_submenu(item, ((c, self.account),), gui_menu_builder.build_invite_submenu(item, ((c, self.account),),
ignore_rooms=[self.room_jid], show_bookmarked=bookmarked) ignore_rooms=[self.room_jid], show_bookmarked=bookmarked)
else: else:

View File

@ -567,7 +567,7 @@ class HistoryWindow:
else: else:
message = _('%(nick)s is now %(status)s') % { message = _('%(nick)s is now %(status)s') % {
'nick': contact_name, 'nick': contact_name,
'status': helpers.get_uf_show(show) } 'status': helpers.get_uf_show(show)}
tag_msg = 'status' tag_msg = 'status'
else: # 'status' else: # 'status'
# message here (if not None) is status message # message here (if not None) is status message

View File

@ -88,7 +88,7 @@ class Preferences(Gtk.ApplicationWindow):
# Display status msg under contact name in roster # Display status msg under contact name in roster
st = app.config.get('show_status_msgs_in_roster') st = app.config.get('show_status_msgs_in_roster')
self.xml.get_object('show_status_msgs_in_roster_checkbutton'). \ self.xml.get_object('show_status_msgs_in_roster_checkbutton'). \
set_active( st) set_active(st)
# Display PEP in roster # Display PEP in roster
st1 = app.config.get('show_mood_in_roster') st1 = app.config.get('show_mood_in_roster')

View File

@ -96,7 +96,7 @@ class SingleMessageWindow:
self.close_button = self.xml.get_object('close_button') self.close_button = self.xml.get_object('close_button')
self.message_tv_buffer.connect('changed', self.update_char_counter) self.message_tv_buffer.connect('changed', self.update_char_counter)
if isinstance(to, list): if isinstance(to, list):
jid = ', '.join( [i[0].get_full_jid() for i in to]) jid = ', '.join([i[0].get_full_jid() for i in to])
self.to_entry.set_text(jid) self.to_entry.set_text(jid)
self.to_entry.set_sensitive(False) self.to_entry.set_sensitive(False)
else: else:

View File

@ -491,7 +491,7 @@ def on_avatar_save_as_menuitem_activate(widget, avatar, default_name=''):
_('Image cannot be saved in %(type)s format. Save as ' _('Image cannot be saved in %(type)s format. Save as '
'%(new_filename)s?') % {'type': image_format, '%(new_filename)s?') % {'type': image_format,
'new_filename': new_file_path}, 'new_filename': new_file_path},
on_response_ok = (on_ok, new_file_path, pixbuf)) on_response_ok=(on_ok, new_file_path, pixbuf))
def on_ok(file_path): def on_ok(file_path):
if os.path.exists(file_path): if os.path.exists(file_path):
@ -522,7 +522,7 @@ def on_avatar_save_as_menuitem_activate(widget, avatar, default_name=''):
file_name='%s.png' % default_name, file_name='%s.png' % default_name,
transient_for=transient) transient_for=transient)
def create_combobox(value_list, selected_value = None): def create_combobox(value_list, selected_value=None):
""" """
Value_list is [(label1, value1)] Value_list is [(label1, value1)]
""" """
@ -588,7 +588,7 @@ def load_mood_icon(icon_name):
icon_list = _load_icon_list([icon_name], path) icon_list = _load_icon_list([icon_name], path)
return icon_list[icon_name] return icon_list[icon_name]
def load_activity_icon(category, activity = None): def load_activity_icon(category, activity=None):
""" """
Load an icon from the activity iconset in 16x16 Load an icon from the activity iconset in 16x16
""" """
@ -672,7 +672,7 @@ def load_icons_meta():
pixc = None pixc = None
return pixo, pixc return pixo, pixc
def _load_icon_list(icons_list, path, pixbuf2 = None): def _load_icon_list(icons_list, path, pixbuf2=None):
""" """
Load icons in icons_list from the given path, and add pixbuf2 on top left of Load icons in icons_list from the given path, and add pixbuf2 on top left of
each static images each static images
@ -764,9 +764,9 @@ def label_set_autowrap(widget):
Make labels automatically re-wrap if their containers are resized. Make labels automatically re-wrap if their containers are resized.
Accepts label or container widgets Accepts label or container widgets
""" """
if isinstance (widget, Gtk.Container): if isinstance(widget, Gtk.Container):
children = widget.get_children() children = widget.get_children()
for i in list(range (len (children))): for i in list(range(len(children))):
label_set_autowrap(children[i]) label_set_autowrap(children[i])
elif isinstance(widget, Gtk.Label): elif isinstance(widget, Gtk.Label):
widget.set_line_wrap(True) widget.set_line_wrap(True)
@ -785,11 +785,11 @@ def __label_size_allocate(widget, allocation):
# set wrap width to the Pango.Layout of the labels ### # set wrap width to the Pango.Layout of the labels ###
widget.set_alignment(0.0, 0.0) widget.set_alignment(0.0, 0.0)
layout.set_width (allocation.width * Pango.SCALE) layout.set_width(allocation.width * Pango.SCALE)
lh = layout.get_size()[1] lh = layout.get_size()[1]
if lh_old != lh: if lh_old != lh:
widget.set_size_request (-1, lh / Pango.SCALE) widget.set_size_request(-1, lh / Pango.SCALE)
def get_action(action): def get_action(action):
return app.app.lookup_action(action) return app.app.lookup_action(action)

View File

@ -210,7 +210,7 @@ class Interface:
if len(obj.id_) > 3 and obj.id_[2] == '_': if len(obj.id_) > 3 and obj.id_[2] == '_':
sid = obj.id_[3:] sid = obj.id_[3:]
file_props = FilesProp.getFileProp(obj.conn.name, sid) file_props = FilesProp.getFileProp(obj.conn.name, sid)
if file_props : if file_props:
if str(obj.errcode) == '400': if str(obj.errcode) == '400':
file_props.error = -3 file_props.error = -3
else: else:
@ -1011,7 +1011,7 @@ class Interface:
event_class = events.FileStoppedEvent event_class = events.FileStoppedEvent
msg_type = 'file-stopped' msg_type = 'file-stopped'
event_type = _('File Transfer Stopped') event_type = _('File Transfer Stopped')
elif file_props.error == -10: elif file_props.error == -10:
event_class = events.FileHashErrorEvent event_class = events.FileHashErrorEvent
msg_type = 'file-hash-error' msg_type = 'file-hash-error'
event_type = _('File Transfer Failed') event_type = _('File Transfer Failed')

View File

@ -375,7 +375,7 @@ control=None, gc_contact=None, is_anonymous=True):
c_ = app.contacts.get_contact(account, gc_contact.jid, c_ = app.contacts.get_contact(account, gc_contact.jid,
gc_contact.resource) gc_contact.resource)
if c_ and c_.supports(NS_CONFERENCE): if c_ and c_.supports(NS_CONFERENCE):
bookmarked=True bookmarked = True
build_invite_submenu(invite_menuitem, [(gc_contact, account)], build_invite_submenu(invite_menuitem, [(gc_contact, account)],
show_bookmarked=bookmarked) show_bookmarked=bookmarked)
else: else:

View File

@ -93,9 +93,9 @@ _element_styles = {
_element_styles['dfn'] = _element_styles['em'] _element_styles['dfn'] = _element_styles['em']
_element_styles['var'] = _element_styles['em'] _element_styles['var'] = _element_styles['em']
# deprecated, legacy, presentational # deprecated, legacy, presentational
_element_styles['tt'] = _element_styles['kbd'] _element_styles['tt'] = _element_styles['kbd']
_element_styles['i'] = _element_styles['em'] _element_styles['i'] = _element_styles['em']
_element_styles['b'] = _element_styles['strong'] _element_styles['b'] = _element_styles['strong']
# ========== # ==========
# XEP-0071 # XEP-0071
@ -168,11 +168,11 @@ _element_styles['b'] = _element_styles['strong']
# Param/Legacy param, font, basefont, center, s, strike, u, dir, menu, # Param/Legacy param, font, basefont, center, s, strike, u, dir, menu,
# isindex # isindex
BLOCK_HEAD = set(( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', )) BLOCK_HEAD = set(('h1', 'h2', 'h3', 'h4', 'h5', 'h6',))
BLOCK_PHRASAL = set(( 'address', 'blockquote', 'pre', )) BLOCK_PHRASAL = set(('address', 'blockquote', 'pre',))
BLOCK_PRES = set(( 'hr', )) #not in xhtml-im BLOCK_PRES = set(('hr', )) #not in xhtml-im
BLOCK_STRUCT = set(( 'div', 'p', )) BLOCK_STRUCT = set(('div', 'p', ))
BLOCK_HACKS = set(( 'table', 'tr' )) # at the very least, they will start line ;) BLOCK_HACKS = set(('table', 'tr')) # at the very least, they will start line ;)
BLOCK = BLOCK_HEAD.union(BLOCK_PHRASAL).union(BLOCK_STRUCT).union(BLOCK_PRES).union(BLOCK_HACKS) BLOCK = BLOCK_HEAD.union(BLOCK_PHRASAL).union(BLOCK_STRUCT).union(BLOCK_PRES).union(BLOCK_HACKS)
INLINE_PHRASAL = set('abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var'.split(', ')) INLINE_PHRASAL = set('abbr, acronym, cite, code, dfn, em, kbd, q, samp, strong, var'.split(', '))
@ -180,13 +180,13 @@ INLINE_PRES = set('b, i, u, tt'.split(', ')) #not in xhtml-im
INLINE_STRUCT = set('br, span'.split(', ')) INLINE_STRUCT = set('br, span'.split(', '))
INLINE = INLINE_PHRASAL.union(INLINE_PRES).union(INLINE_STRUCT) INLINE = INLINE_PHRASAL.union(INLINE_PRES).union(INLINE_STRUCT)
LIST_ELEMS = set( 'dl, ol, ul'.split(', ')) LIST_ELEMS = set('dl, ol, ul'.split(', '))
for _name in BLOCK_HEAD: for _name in BLOCK_HEAD:
_num = eval(_name[1]) _num = eval(_name[1])
_header_size = (_num - 1) // 2 _header_size = (_num - 1) // 2
_weight = (_num - 1) % 2 _weight = (_num - 1) % 2
_element_styles[_name] = '; font-size: %s; %s' % ( ('large', 'medium', 'small')[_header_size], _element_styles[_name] = '; font-size: %s; %s' % (('large', 'medium', 'small')[_header_size],
('font-weight: bold', 'font-style: oblique')[_weight],) ('font-weight: bold', 'font-style: oblique')[_weight],)
def _parse_css_color(color): def _parse_css_color(color):
@ -214,7 +214,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
self.iter = startiter self.iter = startiter
self.conv_textview = conv_textview self.conv_textview = conv_textview
self.text = '' self.text = ''
self.starting=True self.starting = True
self.preserve = False self.preserve = False
self.styles = [] # a Gtk.TextTag or None, for each span level self.styles = [] # a Gtk.TextTag or None, for each span level
self.list_counters = [] # stack (top at head) of list self.list_counters = [] # stack (top at head) of list
@ -359,12 +359,12 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
'large': 1.2, 'large': 1.2,
'x-large': 1.4399999999999, 'x-large': 1.4399999999999,
'xx-large': 1.728, 'xx-large': 1.728,
} [value] }[value]
except KeyError: except KeyError:
pass pass
else: else:
attrs = self._get_current_attributes() attrs = self._get_current_attributes()
if attrs.font_scale ==0: if attrs.font_scale == 0:
tag.set_property('scale', scale) tag.set_property('scale', scale)
return return
if value == 'smaller': if value == 'smaller':
@ -383,7 +383,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
'normal': Pango.Style.NORMAL, 'normal': Pango.Style.NORMAL,
'italic': Pango.Style.ITALIC, 'italic': Pango.Style.ITALIC,
'oblique': Pango.Style.OBLIQUE, 'oblique': Pango.Style.OBLIQUE,
} [value] }[value]
except KeyError: except KeyError:
log.warning('unknown font-style %s', value) log.warning('unknown font-style %s', value)
else: else:
@ -420,7 +420,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
'900': Pango.Weight.HEAVY, '900': Pango.Weight.HEAVY,
'normal': Pango.Weight.NORMAL, 'normal': Pango.Weight.NORMAL,
'bold': Pango.Weight.BOLD, 'bold': Pango.Weight.BOLD,
} [value] }[value]
except KeyError: except KeyError:
log.warning('unknown font-style %s', value) log.warning('unknown font-style %s', value)
else: else:
@ -436,7 +436,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
'right': Gtk.Justification.RIGHT, 'right': Gtk.Justification.RIGHT,
'center': Gtk.Justification.CENTER, 'center': Gtk.Justification.CENTER,
'justify': Gtk.Justification.FILL, 'justify': Gtk.Justification.FILL,
} [value] }[value]
except KeyError: except KeyError:
log.warning('Invalid text-align: %s requested', value) log.warning('Invalid text-align: %s requested', value)
else: else:
@ -1065,11 +1065,11 @@ class HtmlTextView(Gtk.TextView):
if anchor: if anchor:
text = anchor.plaintext text = anchor.plaintext
if text: if text:
selection+=text selection += text
else: else:
selection+=character selection += character
else: else:
selection+=character selection += character
search_iter.forward_char() search_iter.forward_char()
return selection return selection

View File

@ -396,7 +396,7 @@ class MessageTextView(Gtk.TextView):
def destroy(self): def destroy(self):
GLib.idle_add(gc.collect) GLib.idle_add(gc.collect)
def clear(self, widget = None): def clear(self, widget=None):
""" """
Clear text in the textview Clear text in the textview
""" """

View File

@ -109,7 +109,7 @@ class MessageWindow:
id_ = self.window.connect('focus-in-event', self._on_window_focus) id_ = self.window.connect('focus-in-event', self._on_window_focus)
self.handlers[id_] = self.window self.handlers[id_] = self.window
keys=['<Control>f', '<Control>g', '<Control>h', '<Control>i', keys = ['<Control>f', '<Control>g', '<Control>h', '<Control>i',
'<Control>l', '<Control>L', '<Control><Shift>n', '<Control>u', '<Control>l', '<Control>L', '<Control><Shift>n', '<Control>u',
'<Control>b', '<Control>F4', '<Control>b', '<Control>F4',
'<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right', '<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right',
@ -546,7 +546,7 @@ class MessageWindow:
self.window.present() self.window.present()
GLib.idle_add(ctrl.msg_textview.grab_focus) GLib.idle_add(ctrl.msg_textview.grab_focus)
def remove_tab(self, ctrl, method, reason = None, force = False): def remove_tab(self, ctrl, method, reason=None, force=False):
""" """
Reason is only for gc (offline status message) if force is True, do not Reason is only for gc (offline status message) if force is True, do not
ask any confirmation ask any confirmation
@ -557,8 +557,9 @@ class MessageWindow:
else: # We are leaving gc without status message or it's a chat else: # We are leaving gc without status message or it's a chat
ctrl.shutdown() ctrl.shutdown()
# Update external state # Update external state
app.events.remove_events(ctrl.account, ctrl.get_full_jid, app.events.remove_events(
types = ['printed_msg', 'chat', 'gc_msg']) ctrl.account, ctrl.get_full_jid,
types=['printed_msg', 'chat', 'gc_msg'])
fjid = ctrl.get_full_jid() fjid = ctrl.get_full_jid()
jid = app.get_jid_without_resource(fjid) jid = app.get_jid_without_resource(fjid)
@ -821,7 +822,7 @@ class MessageWindow:
new_ctrl = self._widget_to_control(notebook.get_nth_page(page_num)) new_ctrl = self._widget_to_control(notebook.get_nth_page(page_num))
new_ctrl.set_control_active(True) new_ctrl.set_control_active(True)
self.show_title(control = new_ctrl) self.show_title(control=new_ctrl)
control = self.get_active_control() control = self.get_active_control()
if isinstance(control, ChatControlBase): if isinstance(control, ChatControlBase):
@ -1044,7 +1045,7 @@ class MessageWindowMgr(GObject.GObject):
gtkgui_helpers.move_window(win.window, pos[0], pos[1]) gtkgui_helpers.move_window(win.window, pos[0], pos[1])
def _mode_to_key(self, contact, acct, type_, resource = None): def _mode_to_key(self, contact, acct, type_, resource=None):
if self.mode == self.ONE_MSG_WINDOW_NEVER: if self.mode == self.ONE_MSG_WINDOW_NEVER:
key = acct + contact.jid key = acct + contact.jid
if resource: if resource:
@ -1063,7 +1064,7 @@ class MessageWindowMgr(GObject.GObject):
if self.mode == self.ONE_MSG_WINDOW_PERTYPE: if self.mode == self.ONE_MSG_WINDOW_PERTYPE:
return type_ return type_
def create_window(self, contact, acct, type_, resource = None): def create_window(self, contact, acct, type_, resource=None):
win_acct = None win_acct = None
win_type = None win_type = None
win_role = None # X11 window role win_role = None # X11 window role

View File

@ -316,7 +316,7 @@ class GajimPluginConfigDialog(Gtk.Dialog):
self.on_run() self.on_run()
self.show_all() self.show_all()
self.connect('delete-event', self.on_close_dialog) self.connect('delete-event', self.on_close_dialog)
result = super(GajimPluginConfigDialog, self) result = super(GajimPluginConfigDialog, self)
return result return result
def init(self): def init(self):

View File

@ -117,11 +117,11 @@ class Singleton(type):
''' '''
def __init__(cls, name, bases, dic): def __init__(cls, name, bases, dic):
super(Singleton, cls).__init__(name, bases, dic) super(Singleton, cls).__init__(name, bases, dic)
cls.instance=None cls.instance = None
def __call__(cls,*args,**kw): def __call__(cls, *args, **kwargs):
if cls.instance is None: if cls.instance is None:
cls.instance=super(Singleton, cls).__call__(*args,**kw) cls.instance = super(Singleton, cls).__call__(*args, **kwargs)
#log.debug('%(classname)s - new instance created'%{ #log.debug('%(classname)s - new instance created'%{
#'classname' : cls.__name__}) #'classname' : cls.__name__})
else: else:

View File

@ -302,7 +302,7 @@ class PluginManager(metaclass=Singleton):
''' '''
if ((gui_extpoint_name not in self.gui_extension_points) if ((gui_extpoint_name not in self.gui_extension_points)
or (args not in self.gui_extension_points[gui_extpoint_name])): or (args not in self.gui_extension_points[gui_extpoint_name])):
self.gui_extension_points.setdefault(gui_extpoint_name,[]).append( self.gui_extension_points.setdefault(gui_extpoint_name, []).append(
args) args)
@log_calls('PluginManager') @log_calls('PluginManager')

View File

@ -552,8 +552,8 @@ class RosterWindow:
_contact, self.model), \ _contact, self.model), \
"%s already in roster.\n Family: %s" % (_jid, nearby_family) "%s already in roster.\n Family: %s" % (_jid, nearby_family)
self._add_entity(_contact, _account, self._add_entity(_contact, _account,
big_brother_contact = big_brother_contact, big_brother_contact=big_brother_contact,
big_brother_account = big_brother_account) big_brother_account=big_brother_account)
brothers.append((_contact, _account)) brothers.append((_contact, _account))
brothers.insert(0, (big_brother_contact, big_brother_account)) brothers.insert(0, (big_brother_contact, big_brother_account))
@ -1079,7 +1079,7 @@ class RosterWindow:
app.get_number_of_connected_accounts())) and app.config.get( app.get_number_of_connected_accounts())) and app.config.get(
'show_contacts_number'): 'show_contacts_number'):
nbr_on, nbr_total = app.contacts.get_nb_online_total_contacts( nbr_on, nbr_total = app.contacts.get_nb_online_total_contacts(
accounts = accounts) accounts=accounts)
account_name += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total)) account_name += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
self.model[child_iter][Column.NAME] = GLib.markup_escape_text(account_name) self.model[child_iter][Column.NAME] = GLib.markup_escape_text(account_name)
@ -1139,7 +1139,7 @@ class RosterWindow:
text = '<span strikethrough="true">%s</span>' % text text = '<span strikethrough="true">%s</span>' % text
if app.config.get('show_contacts_number'): if app.config.get('show_contacts_number'):
nbr_on, nbr_total = app.contacts.get_nb_online_total_contacts( nbr_on, nbr_total = app.contacts.get_nb_online_total_contacts(
accounts = accounts, groups = [group]) accounts=accounts, groups=[group])
text += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total)) text += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
self.model[child_iter][Column.NAME] = text self.model[child_iter][Column.NAME] = text
@ -1254,7 +1254,7 @@ class RosterWindow:
status = contact.status.strip() status = contact.status.strip()
if status != '': if status != '':
status = helpers.reduce_chars_newlines(status, status = helpers.reduce_chars_newlines(status,
max_lines = 1) max_lines=1)
# escape markup entities and make them small # escape markup entities and make them small
# italic # italic
@ -1304,12 +1304,12 @@ class RosterWindow:
if self.tree.row_expanded(path): if self.tree.row_expanded(path):
state_images = self.get_appropriate_state_images( state_images = self.get_appropriate_state_images(
jid, size = 'opened', jid, size='opened',
icon_name = icon_name) icon_name=icon_name)
else: else:
state_images = self.get_appropriate_state_images( state_images = self.get_appropriate_state_images(
jid, size = 'closed', jid, size='closed',
icon_name = icon_name) icon_name=icon_name)
# Expand/collapse icon might differ per iter # Expand/collapse icon might differ per iter
# (group) # (group)
@ -1322,7 +1322,7 @@ class RosterWindow:
else: else:
# A normal contact or little brother # A normal contact or little brother
state_images = self.get_appropriate_state_images(jid, state_images = self.get_appropriate_state_images(jid,
icon_name = icon_name) icon_name=icon_name)
visible = self.contact_is_visible(contact, account) visible = self.contact_is_visible(contact, account)
# All iters have the same icon (no expand/collapse) # All iters have the same icon (no expand/collapse)
@ -2326,7 +2326,7 @@ class RosterWindow:
_('You are participating in one or more group chats'), _('You are participating in one or more group chats'),
_('Changing your status to invisible will result in ' _('Changing your status to invisible will result in '
'disconnection from those group chats. Are you sure you want ' 'disconnection from those group chats. Are you sure you want '
'to go invisible?'), on_response_ok = (change, account, status)) 'to go invisible?'), on_response_ok=(change, account, status))
else: else:
change(account, status) change(account, status)
@ -2838,7 +2838,7 @@ class RosterWindow:
sectext = _('You will no longer be able to send and receive ' sectext = _('You will no longer be able to send and receive '
'messages to contacts from these transports: %s') % jids 'messages to contacts from these transports: %s') % jids
ConfirmationDialog(pritext, sectext, ConfirmationDialog(pritext, sectext,
on_response_ok = (remove, list_), transient_for=self.window) on_response_ok=(remove, list_), transient_for=self.window)
def _nec_blocking(self, obj): def _nec_blocking(self, obj):
for jid in obj.changed: for jid in obj.changed:
@ -3918,7 +3918,7 @@ class RosterWindow:
self._toggeling_row = True self._toggeling_row = True
model = widget.get_model() model = widget.get_model()
child_model = model.get_model() child_model = model.get_model()
child_iter = model.convert_iter_to_child_iter(titer) child_iter = model.convert_iter_to_child_iter(titer)
if self.regroup: # merged accounts if self.regroup: # merged accounts
accounts = list(app.connections.keys()) accounts = list(app.connections.keys())
@ -3954,7 +3954,7 @@ class RosterWindow:
if account + group + jid not in self.collapsed_rows: if account + group + jid not in self.collapsed_rows:
self.collapsed_rows.append(account + group + jid) self.collapsed_rows.append(account + group + jid)
family = app.contacts.get_metacontacts_family(account, jid) family = app.contacts.get_metacontacts_family(account, jid)
nearby_family = \ nearby_family = \
self._get_nearby_family_and_big_brother(family, account)[0] self._get_nearby_family_and_big_brother(family, account)[0]
# Redraw all brothers to show pending events # Redraw all brothers to show pending events
for data in nearby_family: for data in nearby_family:
@ -4285,7 +4285,7 @@ class RosterWindow:
dlg.checkbutton.set_active(True) dlg.checkbutton.set_active(True)
def on_drop_in_group(self, widget, account, c_source, grp_dest, def on_drop_in_group(self, widget, account, c_source, grp_dest,
is_big_brother, context, etime, grp_source = None): is_big_brother, context, etime, grp_source=None):
if is_big_brother: if is_big_brother:
# add whole metacontact to new group # add whole metacontact to new group
self.add_contact_to_groups(c_source.jid, account, [grp_dest, ]) self.add_contact_to_groups(c_source.jid, account, [grp_dest, ])
@ -4516,7 +4516,7 @@ class RosterWindow:
return return
# we may not add contacts from special_groups # we may not add contacts from special_groups
if grp_source in helpers.special_groups : if grp_source in helpers.special_groups:
return return
# Is the contact we drag a meta contact? # Is the contact we drag a meta contact?
@ -5759,7 +5759,7 @@ class RosterWindow:
# (name, renderer_object, expand?, attribute_name, attribute_value, # (name, renderer_object, expand?, attribute_name, attribute_value,
# cell_data_func, func_arg) # cell_data_func, func_arg)
self.renderers_list = [] self.renderers_list = []
self.renderers_propertys ={} self.renderers_propertys = {}
self._pep_type_to_model_column = {'mood': Column.MOOD_PIXBUF, self._pep_type_to_model_column = {'mood': Column.MOOD_PIXBUF,
'activity': Column.ACTIVITY_PIXBUF, 'tune': Column.TUNE_PIXBUF, 'activity': Column.ACTIVITY_PIXBUF, 'tune': Column.TUNE_PIXBUF,
'geoloc': Column.LOCATION_PIXBUF} 'geoloc': Column.LOCATION_PIXBUF}

View File

@ -49,7 +49,7 @@ class VcardWindow:
Class for contact's information window Class for contact's information window
""" """
def __init__(self, contact, account, gc_contact = None): def __init__(self, contact, account, gc_contact=None):
# the contact variable is the jid if vcard is true # the contact variable is the jid if vcard is true
self.xml = gtkgui_helpers.get_gtk_builder('vcard_information_window.ui') self.xml = gtkgui_helpers.get_gtk_builder('vcard_information_window.ui')
self.window = self.xml.get_object('vcard_information_window') self.window = self.xml.get_object('vcard_information_window')
@ -173,7 +173,7 @@ class VcardWindow:
menuitem.connect('activate', menuitem.connect('activate',
gtkgui_helpers.on_avatar_save_as_menuitem_activate, sha, name) gtkgui_helpers.on_avatar_save_as_menuitem_activate, sha, name)
menu.append(menuitem) menu.append(menuitem)
menu.connect('selection-done', lambda w:w.destroy()) menu.connect('selection-done', lambda w: w.destroy())
# show the menu # show the menu
menu.show_all() menu.show_all()
menu.attach_to_widget(widget, None) menu.attach_to_widget(widget, None)
@ -484,7 +484,7 @@ class VcardWindow:
class ZeroconfVcardWindow: class ZeroconfVcardWindow:
def __init__(self, contact, account, is_fake = False): def __init__(self, contact, account, is_fake=False):
# the contact variable is the jid if vcard is true # the contact variable is the jid if vcard is true
self.xml = gtkgui_helpers.get_gtk_builder('zeroconf_information_window.ui') self.xml = gtkgui_helpers.get_gtk_builder('zeroconf_information_window.ui')
self.window = self.xml.get_object('zeroconf_information_window') self.window = self.xml.get_object('zeroconf_information_window')
@ -517,7 +517,7 @@ class ZeroconfVcardWindow:
gtkgui_helpers.on_avatar_save_as_menuitem_activate, gtkgui_helpers.on_avatar_save_as_menuitem_activate,
self.contact.avatar_sha, self.contact.get_shown_name()) self.contact.avatar_sha, self.contact.get_shown_name())
menu.append(menuitem) menu.append(menuitem)
menu.connect('selection-done', lambda w:w.destroy()) menu.connect('selection-done', lambda w: w.destroy())
# show the menu # show the menu
menu.show_all() menu.show_all()
menu.attach_to_widget(widget, None) menu.attach_to_widget(widget, None)