| 1 | ## common/config.py |
|---|
| 2 | ## |
|---|
| 3 | ## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org> |
|---|
| 4 | ## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com> |
|---|
| 5 | ## Copyright (C) 2004-2005 Vincent Hanquez <tab@snarc.org> |
|---|
| 6 | ## Copyright (C) 2005 Dimitur Kirov <dkirov@gmail.com> |
|---|
| 7 | ## Copyright (C) 2005 Travis Shirk <travis@pobox.com> |
|---|
| 8 | ## Copyright (C) 2005 Norman Rasmussen <norman@rasmussen.co.za> |
|---|
| 9 | ## Copyright (C) 2006 Stefan Bethge <stefan@lanpartei.de> |
|---|
| 10 | ## |
|---|
| 11 | ## This program is free software; you can redistribute it and/or modify |
|---|
| 12 | ## it under the terms of the GNU General Public License as published |
|---|
| 13 | ## by the Free Software Foundation; version 2 only. |
|---|
| 14 | ## |
|---|
| 15 | ## This program is distributed in the hope that it will be useful, |
|---|
| 16 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 18 | ## GNU General Public License for more details. |
|---|
| 19 | ## |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | import re |
|---|
| 23 | import copy |
|---|
| 24 | import defs |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | ( |
|---|
| 28 | OPT_TYPE, |
|---|
| 29 | OPT_VAL, |
|---|
| 30 | OPT_DESC, |
|---|
| 31 | # If OPT_RESTART is True - we need restart to use our changed option |
|---|
| 32 | # OPT_DESC also should be there |
|---|
| 33 | OPT_RESTART, |
|---|
| 34 | ) = range(4) |
|---|
| 35 | |
|---|
| 36 | opt_int = [ 'integer', 0 ] |
|---|
| 37 | opt_str = [ 'string', 0 ] |
|---|
| 38 | opt_bool = [ 'boolean', 0 ] |
|---|
| 39 | opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ] |
|---|
| 40 | opt_one_window_types = ['never', 'always', 'peracct', 'pertype'] |
|---|
| 41 | opt_treat_incoming_messages = ['', 'chat', 'normal'] |
|---|
| 42 | |
|---|
| 43 | class Config: |
|---|
| 44 | |
|---|
| 45 | DEFAULT_ICONSET = 'dcraven' |
|---|
| 46 | |
|---|
| 47 | __options = { |
|---|
| 48 | # name: [ type, default_value, help_string ] |
|---|
| 49 | 'verbose': [ opt_bool, False, '', True ], |
|---|
| 50 | 'alwaysauth': [ opt_bool, False ], |
|---|
| 51 | 'autopopup': [ opt_bool, False ], |
|---|
| 52 | 'notify_on_signin': [ opt_bool, True ], |
|---|
| 53 | 'notify_on_signout': [ opt_bool, False ], |
|---|
| 54 | 'notify_on_new_message': [ opt_bool, True ], |
|---|
| 55 | 'autopopupaway': [ opt_bool, False ], |
|---|
| 56 | 'use_notif_daemon': [ opt_bool, True , _('Use D-Bus and Notification-Daemon to show notifications') ], |
|---|
| 57 | 'ignore_unknown_contacts': [ opt_bool, False ], |
|---|
| 58 | 'showoffline': [ opt_bool, False ], |
|---|
| 59 | 'show_transports_group': [ opt_bool, True ], |
|---|
| 60 | 'autoaway': [ opt_bool, True ], |
|---|
| 61 | 'autoawaytime': [ opt_int, 5, _('Time in minutes, after which your status changes to away.') ], |
|---|
| 62 | 'autoaway_message': [ opt_str, _('Away as a result of being idle') ], |
|---|
| 63 | 'autoxa': [ opt_bool, True ], |
|---|
| 64 | 'autoxatime': [ opt_int, 15, _('Time in minutes, after which your status changes to not available.') ], |
|---|
| 65 | 'autoxa_message': [ opt_str, _('Not available as a result of being idle') ], |
|---|
| 66 | 'ask_online_status': [ opt_bool, False ], |
|---|
| 67 | 'ask_offline_status': [ opt_bool, False ], |
|---|
| 68 | 'last_status_msg_online': [ opt_str, '' ], |
|---|
| 69 | 'last_status_msg_chat': [ opt_str, '' ], |
|---|
| 70 | 'last_status_msg_away': [ opt_str, '' ], |
|---|
| 71 | 'last_status_msg_xa': [ opt_str, '' ], |
|---|
| 72 | 'last_status_msg_dnd': [ opt_str, '' ], |
|---|
| 73 | 'last_status_msg_invisible': [ opt_str, '' ], |
|---|
| 74 | 'last_status_msg_offline': [ opt_str, '' ], |
|---|
| 75 | 'trayicon': [ opt_bool, True, '', True ], |
|---|
| 76 | 'iconset': [ opt_str, DEFAULT_ICONSET, '', True ], |
|---|
| 77 | 'use_transports_iconsets': [ opt_bool, True, '', True ], |
|---|
| 78 | 'inmsgcolor': [ opt_color, '#a34526', '', True ], |
|---|
| 79 | 'outmsgcolor': [ opt_color, '#164e6f', '', True ], |
|---|
| 80 | 'statusmsgcolor': [ opt_color, '#1eaa1e', '', True ], |
|---|
| 81 | 'markedmsgcolor': [ opt_color, '#ff8080', '', True ], |
|---|
| 82 | 'urlmsgcolor': [ opt_color, '#0000ff', '', True ], |
|---|
| 83 | 'collapsed_rows': [ opt_str, '', _('List (space separated) of rows (accounts and groups) that are collapsed.'), True ], |
|---|
| 84 | 'roster_theme': [ opt_str, _('default'), '', True ], |
|---|
| 85 | 'saveposition': [ opt_bool, True ], |
|---|
| 86 | 'mergeaccounts': [ opt_bool, False, '', True ], |
|---|
| 87 | 'sort_by_show': [ opt_bool, True, '', True ], |
|---|
| 88 | 'enable_zeroconf': [opt_bool, False, _('Enable link-local/zeroconf messaging')], |
|---|
| 89 | 'use_speller': [ opt_bool, False, ], |
|---|
| 90 | 'ignore_incoming_xhtml': [ opt_bool, False, ], |
|---|
| 91 | 'speller_language': [ opt_str, '', _('Language used by speller')], |
|---|
| 92 | '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.')], |
|---|
| 93 | '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\'.') ], |
|---|
| 94 | 'emoticons_theme': [opt_str, 'static', '', True ], |
|---|
| 95 | 'ascii_formatting': [ opt_bool, True, |
|---|
| 96 | _('Treat * / _ pairs as possible formatting characters.'), True], |
|---|
| 97 | 'show_ascii_formatting_chars': [ opt_bool, True , _('If True, do not ' |
|---|
| 98 | 'remove */_ . So *abc* will be bold but with * * not removed.')], |
|---|
| 99 | 'rst_formatting_outgoing_messages': [ opt_bool, False, |
|---|
| 100 | _('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)')], |
|---|
| 101 | 'sounds_on': [ opt_bool, True ], |
|---|
| 102 | # 'aplay', 'play', 'esdplay', 'artsplay' detected first time only |
|---|
| 103 | 'soundplayer': [ opt_str, '' ], |
|---|
| 104 | 'openwith': [ opt_str, 'gnome-open' ], |
|---|
| 105 | 'custombrowser': [ opt_str, 'firefox' ], |
|---|
| 106 | 'custommailapp': [ opt_str, 'mozilla-thunderbird -compose' ], |
|---|
| 107 | 'custom_file_manager': [ opt_str, 'xffm' ], |
|---|
| 108 | 'gc-hpaned-position': [opt_int, 430], |
|---|
| 109 | 'gc_refer_to_nick_char': [opt_str, ',', _('Character to add after nickname when using nick completion (tab) in group chat.')], |
|---|
| 110 | '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.')], |
|---|
| 111 | 'msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide |
|---|
| 112 | 'msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide |
|---|
| 113 | 'msgwin-width': [opt_int, 500], |
|---|
| 114 | 'msgwin-height': [opt_int, 440], |
|---|
| 115 | 'chat-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide |
|---|
| 116 | 'chat-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide |
|---|
| 117 | 'chat-msgwin-width': [opt_int, 480], |
|---|
| 118 | 'chat-msgwin-height': [opt_int, 440], |
|---|
| 119 | 'gc-msgwin-x-position': [opt_int, -1], # Default is to let the window manager decide |
|---|
| 120 | 'gc-msgwin-y-position': [opt_int, -1], # Default is to let the window manager decide |
|---|
| 121 | 'gc-msgwin-width': [opt_int, 600], |
|---|
| 122 | 'gc-msgwin-height': [opt_int, 440], |
|---|
| 123 | 'single-msg-x-position': [opt_int, 0], |
|---|
| 124 | 'single-msg-y-position': [opt_int, 0], |
|---|
| 125 | 'single-msg-width': [opt_int, 400], |
|---|
| 126 | 'single-msg-height': [opt_int, 280], |
|---|
| 127 | 'roster_x-position': [ opt_int, 0 ], |
|---|
| 128 | 'roster_y-position': [ opt_int, 0 ], |
|---|
| 129 | 'roster_width': [ opt_int, 200 ], |
|---|
| 130 | 'roster_height': [ opt_int, 400 ], |
|---|
| 131 | 'latest_disco_addresses': [ opt_str, '' ], |
|---|
| 132 | 'recently_groupchat': [ opt_str, '' ], |
|---|
| 133 | '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') ], |
|---|
| 134 | 'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ], |
|---|
| 135 | 'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ], |
|---|
| 136 | 'send_os_info': [ opt_bool, True ], |
|---|
| 137 | 'set_status_msg_from_current_music_track': [ opt_bool, False ], |
|---|
| 138 | 'notify_on_new_gmail_email': [ opt_bool, True ], |
|---|
| 139 | 'notify_on_new_gmail_email_extra': [ opt_bool, False ], |
|---|
| 140 | 'usegpg': [ opt_bool, False, '', True ], |
|---|
| 141 | 'use_gpg_agent': [ opt_bool, False ], |
|---|
| 142 | 'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')], |
|---|
| 143 | 'restore_lines': [opt_int, 4, _('How many lines to remember from previous conversation when a chat tab/window is reopened.')], |
|---|
| 144 | 'restore_timeout': [opt_int, 60, _('How many minutes should last lines from previous conversation last.')], |
|---|
| 145 | 'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')], |
|---|
| 146 | 'show_roster_on_startup': [opt_bool, True], |
|---|
| 147 | 'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')], |
|---|
| 148 | 'version': [ opt_str, defs.version ], # which version created the config |
|---|
| 149 | 'search_engine': [opt_str, 'http://www.google.com/search?&q=%s&sourceid=gajim'], |
|---|
| 150 | 'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")], |
|---|
| 151 | 'always_english_wikipedia': [opt_bool, False], |
|---|
| 152 | 'always_english_wiktionary': [opt_bool, True], |
|---|
| 153 | 'remote_control': [opt_bool, True, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True], |
|---|
| 154 | 'networkmanager_support': [opt_bool, True, _('If True, listen to D-Bus signals from NetworkManager and change the status of accounts (provided they do not have listen_to_network_manager set to False and they sync with global status) based upon the status of the network connection.'), True], |
|---|
| 155 | 'outgoing_chat_state_notifications': [opt_str, 'all', _('Sent chat state notifications. Can be one of all, composing_only, disabled.')], |
|---|
| 156 | 'displayed_chat_state_notifications': [opt_str, 'all', _('Displayed chat state notifications in chat windows. Can be one of all, composing_only, disabled.')], |
|---|
| 157 | 'autodetect_browser_mailer': [opt_bool, False, '', True], |
|---|
| 158 | 'print_ichat_every_foo_minutes': [opt_int, 5, _('When not printing time for every message (print_time==sometimes), print it every x minutes.')], |
|---|
| 159 | 'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')], |
|---|
| 160 | 'confirm_close_muc_rooms': [opt_str, '', _('Always ask before closing group chat tab/window in this space separated list of group chat jids.')], |
|---|
| 161 | 'noconfirm_close_muc_rooms': [opt_str, '', _('Never ask before closing group chat tab/window in this space separated list of group chat jids.')], |
|---|
| 162 | 'notify_on_file_complete': [opt_bool, True], |
|---|
| 163 | 'file_transfers_port': [opt_int, 28011], |
|---|
| 164 | 'ft_override_host_to_send': [opt_str, '', _('Overrides the host we send for File Transfer in case of address translation/port forwarding.')], |
|---|
| 165 | 'conversation_font': [opt_str, ''], |
|---|
| 166 | 'use_kib_mib': [opt_bool, False, _('IEC standard says KiB = 1024 bytes, KB = 1000 bytes.')], |
|---|
| 167 | 'notify_on_all_muc_messages': [opt_bool, False], |
|---|
| 168 | 'trayicon_notification_on_events': [opt_bool, True, _('Notify of events in the system trayicon.')], |
|---|
| 169 | 'last_save_dir': [opt_str, ''], |
|---|
| 170 | 'last_send_dir': [opt_str, ''], |
|---|
| 171 | 'last_emoticons_dir': [opt_str, ''], |
|---|
| 172 | 'last_sounds_dir': [opt_str, ''], |
|---|
| 173 | 'tabs_position': [opt_str, 'top'], |
|---|
| 174 | 'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')], |
|---|
| 175 | 'tabs_border': [opt_bool, False, _('Show tabbed notebook border in chat windows?')], |
|---|
| 176 | 'tabs_close_button': [opt_bool, True, _('Show close button in tab?')], |
|---|
| 177 | 'chat_avatar_width': [opt_int, 52], |
|---|
| 178 | 'chat_avatar_height': [opt_int, 52], |
|---|
| 179 | 'roster_avatar_width': [opt_int, 32], |
|---|
| 180 | 'roster_avatar_height': [opt_int, 32], |
|---|
| 181 | 'tooltip_avatar_width': [opt_int, 125], |
|---|
| 182 | 'tooltip_avatar_height': [opt_int, 125], |
|---|
| 183 | 'vcard_avatar_width': [opt_int, 200], |
|---|
| 184 | 'vcard_avatar_height': [opt_int, 200], |
|---|
| 185 | 'notification_position_x': [opt_int, -1], |
|---|
| 186 | 'notification_position_y': [opt_int, -1], |
|---|
| 187 | 'notification_avatar_width': [opt_int, 48], |
|---|
| 188 | 'notification_avatar_height': [opt_int, 48], |
|---|
| 189 | 'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in group chats.')], |
|---|
| 190 | '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 trayicon is used.')], |
|---|
| 191 | 'check_if_gajim_is_default': [opt_bool, True, _('If True, Gajim will check if it\'s the default jabber client on each startup.')], |
|---|
| 192 | '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.')], |
|---|
| 193 | '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], |
|---|
| 194 | 'show_avatars_in_roster': [opt_bool, True, '', True], |
|---|
| 195 | 'ask_avatars_on_startup': [opt_bool, True, _('If True, Gajim will ask for avatar each contact that did not have an avatar last time or has one cached that is too old.')], |
|---|
| 196 | 'print_status_in_chats': [opt_bool, True, _('If False, Gajim will no longer print status line in chats when a contact changes his or her status and/or his or her status message.')], |
|---|
| 197 | 'print_status_in_muc': [opt_str, 'in_and_out', _('can be "none", "all" or "in_and_out". If "none", Gajim will no longer print status line in groupchats when a member changes his or her status and/or his or her status message. If "all" Gajim will print all status messages. If "in_and_out", Gajim will only print FOO enters/leaves group chat.')], |
|---|
| 198 | 'log_contact_status_changes': [opt_bool, False], |
|---|
| 199 | 'just_connected_bg_color': [opt_str, '#adc3c6', _('Background color of contacts when they just signed in.')], |
|---|
| 200 | 'just_disconnected_bg_color': [opt_str, '#ab6161', _('Background color of contacts when they just signed out.')], |
|---|
| 201 | 'restored_messages_color': [opt_str, 'grey'], |
|---|
| 202 | 'restored_messages_small': [opt_bool, True, _('If True, restored messages will use a smaller font than the default one.')], |
|---|
| 203 | 'hide_avatar_of_transport': [opt_bool, False, _('Don\'t show avatar for the transport itself.')], |
|---|
| 204 | 'roster_window_skip_taskbar': [opt_bool, False, _('Don\'t show roster in the system taskbar.')], |
|---|
| 205 | 'use_urgency_hint': [opt_bool, True, _('If True and installed GTK+ and PyGTK versions are at least 2.8, make the window flash (the default behaviour in most Window Managers) when holding pending events.')], |
|---|
| 206 | 'notification_timeout': [opt_int, 5], |
|---|
| 207 | 'send_sha_in_gc_presence': [opt_bool, True, _('Jabberd1.4 does not like sha info when one join a password protected group chat. Turn this option to False to stop sending sha info in group chat presences.')], |
|---|
| 208 | 'one_message_window': [opt_str, 'always', |
|---|
| 209 | #always, never, peracct, pertype should not be translated |
|---|
| 210 | _('Controls the window where new messages are placed.\n\'always\' - All messages are sent to a single window.\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) are sent to a specific window. Note, changing this option requires restarting Gajim before the changes will take effect.')], |
|---|
| 211 | 'show_avatar_in_chat': [opt_bool, True, _('If False, you will no longer see the avatar in the chat window.')], |
|---|
| 212 | 'escape_key_closes': [opt_bool, True, _('If True, pressing the escape key closes a tab/window.')], |
|---|
| 213 | 'always_hide_groupchat_buttons': [opt_bool, False, _('Hides the buttons in group chat window.')], |
|---|
| 214 | 'always_hide_chat_buttons': [opt_bool, False, _('Hides the buttons in two persons chat window.')], |
|---|
| 215 | 'hide_groupchat_banner': [opt_bool, False, _('Hides the banner in a group chat window')], |
|---|
| 216 | 'hide_chat_banner': [opt_bool, False, _('Hides the banner in two persons chat window')], |
|---|
| 217 | 'hide_groupchat_occupants_list': [opt_bool, False, _('Hides the group chat occupants list in group chat window.')], |
|---|
| 218 | '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.')], |
|---|
| 219 | 'chat_merge_consecutive_nickname_indent': [opt_str, ' ', _('Indentation when using merge consecutive nickname.')], |
|---|
| 220 | 'gc_nicknames_colors': [ opt_str, '#a34526:#c000ff:#0012ff:#388a99:#045723:#7c7c7c:#ff8a00:#94452d:#244b5a:#32645a', _('List of colors that will be used to color nicknames in group chats.'), True ], |
|---|
| 221 | 'ctrl_tab_go_to_next_composing': [opt_bool, True, _('Ctrl-Tab go to next composing tab when none is unread.')], |
|---|
| 222 | 'confirm_metacontacts': [ opt_str, '', _('Should we show the confirm metacontacts creation dialog or not? Empty string means we never show the dialog.')], |
|---|
| 223 | '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.')], |
|---|
| 224 | 'use_gnomekeyring': [opt_bool, True, _('If True, Gajim will use Gnome Keyring (if available) to store account passwords.')], |
|---|
| 225 | 'show_contacts_number': [opt_bool, True, _('If True, Gajim will show number of online and total contacts in account and group rows.')], |
|---|
| 226 | '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')], |
|---|
| 227 | } |
|---|
| 228 | |
|---|
| 229 | __options_per_key = { |
|---|
| 230 | 'accounts': ({ |
|---|
| 231 | 'name': [ opt_str, '', '', True ], |
|---|
| 232 | 'hostname': [ opt_str, '', '', True ], |
|---|
| 233 | 'savepass': [ opt_bool, False ], |
|---|
| 234 | 'password': [ opt_str, '' ], |
|---|
| 235 | 'resource': [ opt_str, 'gajim', '', True ], |
|---|
| 236 | 'priority': [ opt_int, 5, '', True ], |
|---|
| 237 | 'adjust_priority_with_status': [ opt_bool, True, _('Priority will change automatically according to your status. Priorities are defined in autopriority_* options.') ], |
|---|
| 238 | 'autopriority_online': [ opt_int, 50], |
|---|
| 239 | 'autopriority_chat': [ opt_int, 50], |
|---|
| 240 | 'autopriority_away': [ opt_int, 40], |
|---|
| 241 | 'autopriority_xa': [ opt_int, 30], |
|---|
| 242 | 'autopriority_dnd': [ opt_int, 20], |
|---|
| 243 | 'autopriority_invisible': [ opt_int, 10], |
|---|
| 244 | 'autoconnect': [ opt_bool, False, '', True ], |
|---|
| 245 | 'autoreconnect': [ opt_bool, True ], |
|---|
| 246 | 'active': [ opt_bool, True], |
|---|
| 247 | 'proxy': [ opt_str, '', '', True ], |
|---|
| 248 | 'keyid': [ opt_str, '', '', True ], |
|---|
| 249 | 'keyname': [ opt_str, '', '', True ], |
|---|
| 250 | 'usessl': [ opt_bool, False, '', True ], |
|---|
| 251 | 'use_srv': [ opt_bool, True, '', True ], |
|---|
| 252 | 'use_custom_host': [ opt_bool, False, '', True ], |
|---|
| 253 | 'custom_port': [ opt_int, 5222, '', True ], |
|---|
| 254 | 'custom_host': [ opt_str, '', '', True ], |
|---|
| 255 | 'savegpgpass': [ opt_bool, False, '', True ], |
|---|
| 256 | 'gpgpassword': [ opt_str, '' ], |
|---|
| 257 | 'sync_with_global_status': [ opt_bool, False, ], |
|---|
| 258 | 'no_log_for': [ opt_str, '' ], |
|---|
| 259 | 'attached_gpg_keys': [ opt_str, '' ], |
|---|
| 260 | 'keep_alives_enabled': [ opt_bool, True], |
|---|
| 261 | # send keepalive every N seconds of inactivity |
|---|
| 262 | 'keep_alive_every_foo_secs': [ opt_int, 55 ], |
|---|
| 263 | # try for 2 minutes before giving up (aka. timeout after those seconds) |
|---|
| 264 | 'try_connecting_for_foo_secs': [ opt_int, 60 ], |
|---|
| 265 | 'http_auth': [opt_str, 'ask'], # yes, no, ask |
|---|
| 266 | 'dont_ack_subscription': [opt_bool, False, _('Jabberd2 workaround')], |
|---|
| 267 | # proxy65 for FT |
|---|
| 268 | 'file_transfer_proxies': [opt_str, |
|---|
| 269 | 'proxy.jabber.org, proxy.netlab.cz, transfer.jabber.freenet.de, proxy.jabber.cd.chalmers.se'], |
|---|
| 270 | 'use_ft_proxies': [opt_bool, True, _('If checked, Gajim will use your IP and proxies defined in file_transfer_proxies option for file transfer.'), True], |
|---|
| 271 | 'msgwin-x-position': [opt_int, -1], # Default is to let the wm decide |
|---|
| 272 | 'msgwin-y-position': [opt_int, -1], # Default is to let the wm decide |
|---|
| 273 | 'msgwin-width': [opt_int, 480], |
|---|
| 274 | 'msgwin-height': [opt_int, 440], |
|---|
| 275 | 'listen_to_network_manager' : [opt_bool, True], |
|---|
| 276 | 'is_zeroconf': [opt_bool, False], |
|---|
| 277 | 'zeroconf_first_name': [ opt_str, '', '', True ], |
|---|
| 278 | 'zeroconf_last_name': [ opt_str, '', '', True ], |
|---|
| 279 | 'zeroconf_jabber_id': [ opt_str, '', '', True ], |
|---|
| 280 | 'zeroconf_email': [ opt_str, '', '', True ], |
|---|
| 281 | }, {}), |
|---|
| 282 | 'statusmsg': ({ |
|---|
| 283 | 'message': [ opt_str, '' ], |
|---|
| 284 | }, {}), |
|---|
| 285 | 'defaultstatusmsg': ({ |
|---|
| 286 | 'enabled': [ opt_bool, False ], |
|---|
| 287 | 'message': [ opt_str, '' ], |
|---|
| 288 | }, {}), |
|---|
| 289 | 'soundevents': ({ |
|---|
| 290 | 'enabled': [ opt_bool, True ], |
|---|
| 291 | 'path': [ opt_str, '' ], |
|---|
| 292 | }, {}), |
|---|
| 293 | 'proxies': ({ |
|---|
| 294 | 'type': [ opt_str, 'http' ], |
|---|
| 295 | 'host': [ opt_str, '' ], |
|---|
| 296 | 'port': [ opt_int, 3128 ], |
|---|
| 297 | 'user': [ opt_str, '' ], |
|---|
| 298 | 'pass': [ opt_str, '' ], |
|---|
| 299 | }, {}), |
|---|
| 300 | 'themes': ({ |
|---|
| 301 | 'accounttextcolor': [ opt_color, 'black', '', True ], |
|---|
| 302 | 'accountbgcolor': [ opt_color, 'white', '', True ], |
|---|
| 303 | 'accountfont': [ opt_str, '', '', True ], |
|---|
| 304 | 'accountfontattrs': [ opt_str, 'B', '', True ], |
|---|
| 305 | 'grouptextcolor': [ opt_color, 'black', '', True ], |
|---|
| 306 | 'groupbgcolor': [ opt_color, 'white', '', True ], |
|---|
| 307 | 'groupfont': [ opt_str, '', '', True ], |
|---|
| 308 | 'groupfontattrs': [ opt_str, 'I', '', True ], |
|---|
| 309 | 'contacttextcolor': [ opt_color, 'black', '', True ], |
|---|
| 310 | 'contactbgcolor': [ opt_color, 'white', '', True ], |
|---|
| 311 | 'contactfont': [ opt_str, '', '', True ], |
|---|
| 312 | 'contactfontattrs': [ opt_str, '', '', True ], |
|---|
| 313 | 'bannertextcolor': [ opt_color, 'black', '', True ], |
|---|
| 314 | 'bannerbgcolor': [ opt_color, '', '', True ], |
|---|
| 315 | 'bannerfont': [ opt_str, '', '', True ], |
|---|
| 316 | 'bannerfontattrs': [ opt_str, 'B', '', True ], |
|---|
| 317 | |
|---|
| 318 | # http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html |
|---|
| 319 | 'state_inactive_color': [ opt_color, 'grey62' ], |
|---|
| 320 | 'state_composing_color': [ opt_color, 'green4' ], |
|---|
| 321 | 'state_paused_color': [ opt_color, 'mediumblue' ], |
|---|
| 322 | 'state_gone_color': [ opt_color, 'grey' ], |
|---|
| 323 | |
|---|
| 324 | # MUC chat states |
|---|
| 325 | 'state_muc_msg_color': [ opt_color, 'mediumblue' ], |
|---|
| 326 | 'state_muc_directed_msg_color': [ opt_color, 'red2' ], |
|---|
| 327 | }, {}), |
|---|
| 328 | 'contacts': ({ |
|---|
| 329 | 'gpg_enabled': [ opt_bool, True, _('Is OpenPGP enabled for this contact?')], |
|---|
| 330 | 'speller_language': [ opt_str, '', _('Language for which we want to check misspelled words')], |
|---|
| 331 | }, {}), |
|---|
| 332 | 'rooms': ({ |
|---|
| 333 | 'speller_language': [ opt_str, '', _('Language for which we want to check misspelled words')], |
|---|
| 334 | }, {}), |
|---|
| 335 | 'notifications': ({ |
|---|
| 336 | 'event': [opt_str, ''], |
|---|
| 337 | 'recipient_type': [opt_str, 'all'], |
|---|
| 338 | 'recipients': [opt_str, ''], |
|---|
| 339 | 'status': [opt_str, 'all', _('all or space separated status')], |
|---|
| 340 | 'tab_opened': [opt_str, 'both', _("'yes', 'no', or 'both'")], |
|---|
| 341 | 'sound': [opt_str, '', _("'yes', 'no' or ''")], |
|---|
| 342 | 'sound_file': [opt_str, ''], |
|---|
| 343 | 'popup': [opt_str, '', _("'yes', 'no' or ''")], |
|---|
| 344 | 'auto_open': [opt_str, '', _("'yes', 'no' or ''")], |
|---|
| 345 | 'run_command': [opt_bool, False], |
|---|
| 346 | 'command': [opt_str, ''], |
|---|
| 347 | 'systray': [opt_str, '', _("'yes', 'no' or ''")], |
|---|
| 348 | 'roster': [opt_str, '', _("'yes', 'no' or ''")], |
|---|
| 349 | 'urgency_hint': [opt_bool, False], |
|---|
| 350 | }, {}), |
|---|
| 351 | } |
|---|
| 352 | |
|---|
| 353 | statusmsg_default = { |
|---|
| 354 | _('Sleeping'): 'ZZZZzzzzzZZZZZ', |
|---|
| 355 | _('Back soon'): _('Back in some minutes.'), |
|---|
| 356 | _('Eating'): _("I'm eating, so leave me a message."), |
|---|
| 357 | _('Movie'): _("I'm watching a movie."), |
|---|
| 358 | _('Working'): _("I'm working."), |
|---|
| 359 | _('Phone'): _("I'm on the phone."), |
|---|
| 360 | _('Out'): _("I'm out enjoying life."), |
|---|
| 361 | } |
|---|
| 362 | |
|---|
| 363 | defaultstatusmsg_default = { |
|---|
| 364 | 'online': [ False, _("I'm available.") ], |
|---|
| 365 | 'chat': [ False, _("I'm free for chat.") ], |
|---|
| 366 | 'away': [ False, _('Be right back.') ], |
|---|
| 367 | 'xa': [ False, _("I'm not available.") ], |
|---|
| 368 | 'dnd': [ False, _('Do not disturb.') ], |
|---|
| 369 | 'invisible': [ False, _('Bye!') ], |
|---|
| 370 | 'offline': [ False, _('Bye!') ], |
|---|
| 371 | } |
|---|
| 372 | |
|---|
| 373 | soundevents_default = { |
|---|
| 374 | 'first_message_received': [ True, '../data/sounds/message1.wav' ], |
|---|
| 375 | 'next_message_received': [ True, '../data/sounds/message2.wav' ], |
|---|
| 376 | 'contact_connected': [ True, '../data/sounds/connected.wav' ], |
|---|
| 377 | 'contact_disconnected': [ True, '../data/sounds/disconnected.wav' ], |
|---|
| 378 | 'message_sent': [ True, '../data/sounds/sent.wav' ], |
|---|
| 379 | 'muc_message_highlight': [ True, '../data/sounds/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.')], |
|---|
| 380 | 'muc_message_received': [ False, '../data/sounds/gc_message2.wav', _('Sound to play when any MUC message arrives.') ], |
|---|
| 381 | 'gmail_received': [ False, '../data/sounds/message1.wav' ], |
|---|
| 382 | } |
|---|
| 383 | |
|---|
| 384 | themes_default = { |
|---|
| 385 | # sorted alphanum |
|---|
| 386 | _('default'): [ '', '', '', 'B', '', '','', 'I', '', '', '', '', '','', |
|---|
| 387 | '', 'B' ], |
|---|
| 388 | |
|---|
| 389 | _('green'): [ '', '#94aa8c', '', 'B', '#0000ff', '#eff3e7', |
|---|
| 390 | '', 'I', '#000000', '', '', '', '', |
|---|
| 391 | '#94aa8c', '', 'B' ], |
|---|
| 392 | |
|---|
| 393 | _('grocery'): [ '', '#6bbe18', '', 'B', '#12125a', '#ceefad', |
|---|
| 394 | '', 'I', '#000000', '#efb26b', '', '', '', |
|---|
| 395 | '#108abd', '', 'B' ], |
|---|
| 396 | |
|---|
| 397 | _('human'): [ '', '#996442', '', 'B', '#ab5920', '#e3ca94', |
|---|
| 398 | '', 'I', '#000000', '', '', '', '', |
|---|
| 399 | '#996442', '', 'B' ], |
|---|
| 400 | |
|---|
| 401 | _('marine'): [ '', '#918caa', '', 'B', '', '#e9e7f3', |
|---|
| 402 | '', 'I', '#000000', '', '', '', '', |
|---|
| 403 | '#918caa', '', 'B' ], |
|---|
| 404 | |
|---|
| 405 | } |
|---|
| 406 | |
|---|
| 407 | def foreach(self, cb, data = None): |
|---|
| 408 | for opt in self.__options: |
|---|
| 409 | cb(data, opt, None, self.__options[opt]) |
|---|
| 410 | for opt in self.__options_per_key: |
|---|
| 411 | cb(data, opt, None, None) |
|---|
| 412 | dict = self.__options_per_key[opt][1] |
|---|
| 413 | for opt2 in dict.keys(): |
|---|
| 414 | cb(data, opt2, [opt], None) |
|---|
| 415 | for opt3 in dict[opt2]: |
|---|
| 416 | cb(data, opt3, [opt, opt2], dict[opt2][opt3]) |
|---|
| 417 | |
|---|
| 418 | def is_val |
|---|