| 1 | ##Â Â Â common/config.py |
|---|
| 2 | ## |
|---|
| 3 | ## Contributors for this file: |
|---|
| 4 | ##Â Â Â - Yann Le Boulanger <asterix@lagaule.org> |
|---|
| 5 | ##Â Â Â - Nikos Kouremenos <nkour@jabber.org> |
|---|
| 6 | ##Â Â Â - Dimitur Kirov <dkirov@gmail.com> |
|---|
| 7 | ##Â Â Â - Travis Shirk <travis@pobox.com> |
|---|
| 8 | ## |
|---|
| 9 | ## Copyright (C) 2003-2004 Yann Le Boulanger <asterix@lagaule.org> |
|---|
| 10 | ##Â Â Â Â Â Â Â Â Â Â Â Â Â Vincent Hanquez <tab@snarc.org> |
|---|
| 11 | ## Copyright (C) 2005 Yann Le Boulanger <asterix@lagaule.org> |
|---|
| 12 | ##Â Â Â Â Â Â Â Â Â Â Vincent Hanquez <tab@snarc.org> |
|---|
| 13 | ##Â Â Â Â Â Â Â Â Â Â Nikos Kouremenos <nkour@jabber.org> |
|---|
| 14 | ##Â Â Â Â Â Â Â Â Â Â Dimitur Kirov <dkirov@gmail.com> |
|---|
| 15 | ##Â Â Â Â Â Â Â Â Â Â Travis Shirk <travis@pobox.com> |
|---|
| 16 | ##Â Â Â Â Â Â Â Â Â Â Norman Rasmussen <norman@rasmussen.co.za> |
|---|
| 17 | ## |
|---|
| 18 | ## This program is free software; you can redistribute it and/or modify |
|---|
| 19 | ## it under the terms of the GNU General Public License as published |
|---|
| 20 | ## by the Free Software Foundation; version 2 only. |
|---|
| 21 | ## |
|---|
| 22 | ## This program is distributed in the hope that it will be useful, |
|---|
| 23 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 24 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 25 | ## GNU General Public License for more details. |
|---|
| 26 | ## |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | import sre |
|---|
| 30 | import copy |
|---|
| 31 | import i18n |
|---|
| 32 | _ =Â i18n._ |
|---|
| 33 | |
|---|
| 34 | OPT_TYPE =Â 0 |
|---|
| 35 | OPT_VAL =Â 1 |
|---|
| 36 | OPT_DESC =Â 2 |
|---|
| 37 | |
|---|
| 38 | opt_int = [ 'integer', 0 ] |
|---|
| 39 | opt_str = [ 'string', 0 ] |
|---|
| 40 | opt_bool = [ 'boolean', 0 ] |
|---|
| 41 | opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ] |
|---|
| 42 | |
|---|
| 43 | class Config: |
|---|
| 44 | |
|---|
| 45 | Â Â Â Â __options =Â { |
|---|
| 46 | Â Â Â Â Â Â Â Â # name: [ type, value ] |
|---|
| 47 |         'verbose': [ opt_bool, False ], |
|---|
| 48 |         'alwaysauth': [ opt_bool, False ], |
|---|
| 49 |         'autopopup': [ opt_bool, False ], |
|---|
| 50 |         'notify_on_signin': [ opt_bool, True ], |
|---|
| 51 |         'notify_on_signout': [ opt_bool, False ], |
|---|
| 52 |         'notify_on_new_message': [ opt_bool, True ], |
|---|
| 53 |         'autopopupaway': [ opt_bool, False ], |
|---|
| 54 |         'use_notif_daemon': [ opt_bool, True , _('Use DBus and Notification-Daemon to show notifications') ], |
|---|
| 55 |         'ignore_unknown_contacts': [ opt_bool, False ], |
|---|
| 56 |         'showoffline': [ opt_bool, False ], |
|---|
| 57 |         'autoaway': [ opt_bool, True ], |
|---|
| 58 |         'autoawaytime': [ opt_int, 5, _('Time in minutes, after which your status changes to away.') ], |
|---|
| 59 |         'autoaway_message': [ opt_str, _('Away as a result of being idle') ], |
|---|
| 60 |         'autoxa': [ opt_bool, True ], |
|---|
| 61 |         'autoxatime': [ opt_int, 15, _('Time in minutes, after which your status changes to not available.') ], |
|---|
| 62 |         'autoxa_message': [ opt_str, _('Not available as a result of being idle') ], |
|---|
| 63 |         'ask_online_status': [ opt_bool, False ], |
|---|
| 64 |         'ask_offline_status': [ opt_bool, False ], |
|---|
| 65 |         'last_status_msg_online': [ opt_str, '' ], |
|---|
| 66 |         'last_status_msg_chat': [ opt_str, '' ], |
|---|
| 67 |         'last_status_msg_away': [ opt_str, '' ], |
|---|
| 68 |         'last_status_msg_xa': [ opt_str, '' ], |
|---|
| 69 |         'last_status_msg_dnd': [ opt_str, '' ], |
|---|
| 70 |         'last_status_msg_invisible': [ opt_str, '' ], |
|---|
| 71 |         'last_status_msg_offline': [ opt_str, '' ], |
|---|
| 72 |         'trayicon': [ opt_bool, True ], |
|---|
| 73 |         'iconset': [ opt_str, 'dcraven' ], |
|---|
| 74 |         'use_transports_iconsets': [ opt_bool, True ], |
|---|
| 75 |         'inmsgcolor': [ opt_color, '#a34526' ], |
|---|
| 76 |         'outmsgcolor': [ opt_color, '#164e6f' ], |
|---|
| 77 |         'statusmsgcolor': [ opt_color, '#1eaa1e' ], |
|---|
| 78 |         'markedmsgcolor': [ opt_color, '#ff8080' ], |
|---|
| 79 |         'urlmsgcolor': [ opt_color, '#0000ff' ], |
|---|
| 80 |         'collapsed_rows': [ opt_str, '' ], |
|---|
| 81 |         'roster_theme': [ opt_str, 'green' ], |
|---|
| 82 |         'saveposition': [ opt_bool, True ], |
|---|
| 83 |         'mergeaccounts': [ opt_bool, False ], |
|---|
| 84 |         'sort_by_show': [ opt_bool, True ], |
|---|
| 85 |         'usetabbedchat': [ opt_bool, True ], |
|---|
| 86 |         'use_speller': [ opt_bool, False ], |
|---|
| 87 |         'print_time': [ opt_str, 'always' ], |
|---|
| 88 |         'useemoticons': [ opt_bool, True ], |
|---|
| 89 |         'show_ascii_formatting_chars': [ opt_bool, False , _('If True, do not remove */_ . So *abc* will be bold but with * * not removed.')], |
|---|
| 90 |         'sounds_on': [ opt_bool, True ], |
|---|
| 91 | Â Â Â Â Â Â Â Â # 'aplay', 'play', 'esdplay', 'artsplay' detected first time only |
|---|
| 92 |         'soundplayer': [ opt_str, '' ], |
|---|
| 93 |         'openwith': [ opt_str, 'gnome-open' ], |
|---|
| 94 |         'custombrowser': [ opt_str, 'firefox' ], |
|---|
| 95 |         'custommailapp': [ opt_str, 'mozilla-thunderbird -compose' ], |
|---|
| 96 |         'custom_file_manager': [ opt_str, 'xffm' ], |
|---|
| 97 |         'gc-x-position': [opt_int, 0], |
|---|
| 98 |         'gc-y-position': [opt_int, 0], |
|---|
| 99 |         'gc-width': [opt_int, 675], |
|---|
| 100 |         'gc-height': [opt_int, 400], |
|---|
| 101 |         'gc-hpaned-position': [opt_int, 540], |
|---|
| 102 |         'gc_refer_to_nick_char': [opt_str, ','], |
|---|
| 103 |         'gc_proposed_nick_char': [opt_str, '_'], |
|---|
| 104 |         'chat-x-position': [opt_int, 0], |
|---|
| 105 |         'chat-y-position': [opt_int, 0], |
|---|
| 106 |         'chat-width': [opt_int, 480], |
|---|
| 107 |         'chat-height': [opt_int, 440], |
|---|
| 108 |         'single_msg-x-position': [opt_int, 0], |
|---|
| 109 |         'single_msg-y-position': [opt_int, 0], |
|---|
| 110 |         'single_msg-width': [opt_int, 400], |
|---|
| 111 |         'single_msg-height': [opt_int, 280], |
|---|
| 112 |         'roster_x-position': [ opt_int, 0 ], |
|---|
| 113 |         'roster_y-position': [ opt_int, 0 ], |
|---|
| 114 |         'roster_width': [ opt_int, 150 ], |
|---|
| 115 |         'roster_height': [ opt_int, 400 ], |
|---|
| 116 |         'latest_disco_addresses': [ opt_str, '' ], |
|---|
| 117 |         'recently_groupchat': [ opt_str, '' ], |
|---|
| 118 |         'before_time': [ opt_str, '[' ], |
|---|
| 119 |         'after_time': [ opt_str, ']' ], |
|---|
| 120 |         'before_nickname': [ opt_str, '' ], |
|---|
| 121 |         'after_nickname': [ opt_str, ':' ], |
|---|
| 122 |         'send_os_info': [ opt_bool, True ], |
|---|
| 123 |         'usegpg': [ opt_bool, False ], |
|---|
| 124 |         'use_gpg_agent': [ opt_bool, False ], |
|---|
| 125 |         'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')], |
|---|
| 126 |         'restore_lines': [opt_int, 4, _('How many lines to remember from previous conversation when a chat tab/window is reopened.')], |
|---|
| 127 |         'restore_timeout': [opt_int, 60, _('How many minutes should last lines from previous conversation last.')], |
|---|
| 128 |         'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')], |
|---|
| 129 |         'show_roster_on_startup': [opt_bool, True], |
|---|
| 130 |         'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')], |
|---|
| 131 |         'version': [ opt_str, '0.9' ], # which version created the config |
|---|
| 132 |         'always_compact_view_chat': [opt_bool, False, _('Use compact view when you open a chat window')], |
|---|
| 133 |         'always_compact_view_gc': [opt_bool, False, _('Use compact view when you open a group chat window')], |
|---|
| 134 |         'search_engine': [opt_str, 'http://www.google.com/search?&q=%s&sourceid=gajim'], |
|---|
| 135 |         'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")], |
|---|
| 136 |         'always_english_wikipedia': [opt_bool, False], |
|---|
| 137 |         'always_english_wiktionary': [opt_bool, True], |
|---|
| 138 |         'remote_control': [opt_bool, True, _('If checked, Gajim can be controlled remotely using gajim-remote.')], |
|---|
| 139 |         'chat_state_notifications': [opt_str, 'all'], # 'all', 'composing_only', 'disabled' |
|---|
| 140 |         'autodetect_browser_mailer': [opt_bool, True], |
|---|
| 141 |         'print_ichat_every_foo_minutes': [opt_int, 5], |
|---|
| 142 |         'confirm_close_muc': [opt_bool, True, _('Ask before closing a group chat tab/window.')], |
|---|
| 143 |         'notify_on_file_complete': [opt_bool, True], # notif. on file complete |
|---|
| 144 |         'file_transfers_port': [opt_int, 28011], # port, used for file transfers |
|---|
| 145 |         'ft_override_host_to_send': [opt_str, '', _('Overrides the host we send for File Transfer in case of address translation/port forwarding.')], |
|---|
| 146 |         'conversation_font': [opt_str, ''], |
|---|
| 147 |         'use_kib_mib': [opt_bool, False, _('IEC standard says KiB = 1024 bytes, KB = 1000 bytes.')], |
|---|
| 148 |         'notify_on_all_muc_messages': [opt_bool, False], |
|---|
| 149 |         'trayicon_notification_on_new_messages': [opt_bool, True], |
|---|
| 150 |         'last_save_dir': [opt_str, ''], |
|---|
| 151 |         'last_send_dir': [opt_str, ''], |
|---|
| 152 |         'last_emoticons_dir': [opt_str, ''], |
|---|
| 153 |         'last_sounds_dir': [opt_str, ''], |
|---|
| 154 |         'tabs_position': [opt_str, 'top'], |
|---|
| 155 |         'tabs_always_visible': [opt_bool, False, _('Show tab when only one conversation?')], |
|---|
| 156 |         'tabs_border': [opt_bool, False, _('Show tab border if one conversation?')], |
|---|
| 157 |         'tabs_close_button': [opt_bool, True, _('Show close button in tab?')], |
|---|
| 158 |         'chat_avatar_width': [opt_int, 52], |
|---|
| 159 |         'chat_avatar_height': [opt_int, 52], |
|---|
| 160 |         'roster_avatar_width': [opt_int, 32], |
|---|
| 161 |         'roster_avatar_height': [opt_int, 32], |
|---|
| 162 |         'muc_highlight_words': [opt_str, '', _('A semicolon-separated list of words that will be highlighted in multi-user chat.')], |
|---|
| 163 |         '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.')], |
|---|
| 164 |         'set_xmpp://_handler_everytime': [opt_bool, False, _('If True, Gajim registers for xmpp:// on each startup.')], |
|---|
| 165 |         '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.')], |
|---|
| 166 |         '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')], |
|---|
| 167 |         'show_avatars_in_roster': [opt_bool, True], |
|---|
| 168 |         '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.')], |
|---|
| 169 | Â Â Â Â Â Â Â Â #FIXME: remvoe you and make it Gajim will not; and/or his or *her* status messages |
|---|
| 170 |         'print_status_in_chats': [opt_bool, True, _('If False, you will no longer see status line in chats when a contact changes his or her status and/or his status message.')], |
|---|
| 171 |         'log_contact_status_changes': [opt_bool, False], |
|---|
| 172 |         'restored_messages_color': [opt_str, 'grey'], |
|---|
| 173 |         'hide_avatar_of_transport': [opt_bool, False], |
|---|
| 174 | Â Â Â Â } |
|---|
| 175 | |
|---|
| 176 | Â Â Â Â __options_per_key =Â { |
|---|
| 177 | Â Â Â Â Â Â Â Â 'accounts':Â ({ |
|---|
| 178 |             'name': [ opt_str, '' ], |
|---|
| 179 |             'hostname': [ opt_str, '' ], |
|---|
| 180 |             'savepass': [ opt_bool, False ], |
|---|
| 181 |             'password': [ opt_str, '' ], |
|---|
| 182 |             'resource': [ opt_str, 'gajim' ], |
|---|
| 183 |             'priority': [ opt_int, 5 ], |
|---|
| 184 |             'autoconnect': [ opt_bool, False ], |
|---|
| 185 |             'autoreconnect': [ opt_bool, True ], |
|---|
| 186 |             'active': [ opt_bool, True], |
|---|
| 187 |             'proxy': [ opt_str, '' ], |
|---|
| 188 |             'keyid': [ opt_str, '' ], |
|---|
| 189 |             'keyname': [ opt_str, '' ], |
|---|
| 190 |             'usessl': [ opt_bool, False ], |
|---|
| 191 |             'use_srv': [ opt_bool, True ], |
|---|
| 192 |             'use_custom_host': [ opt_bool, False ], |
|---|
| 193 |             'custom_port': [ opt_int, 5222 ], |
|---|
| 194 |             'custom_host': [ opt_str, '' ], |
|---|
| 195 |             'savegpgpass': [ opt_bool, False ], |
|---|
| 196 |             'gpgpassword': [ opt_str, '' ], |
|---|
| 197 |             'sync_with_global_status': [ opt_bool, False ], |
|---|
| 198 |             'no_log_for': [ opt_str, '' ], |
|---|
| 199 |             'attached_gpg_keys': [ opt_str, '' ], |
|---|
| 200 |             'keep_alives_enabled': [ opt_bool, True], |
|---|
| 201 | Â Â Â Â Â Â Â Â Â Â Â Â # send keepalive every N seconds of inactivity |
|---|
| 202 |             'keep_alive_every_foo_secs': [ opt_int, 55 ], |
|---|
| 203 | Â Â Â Â Â Â Â Â Â Â Â Â # try for 2 minutes before giving up (aka. timeout after those seconds) |
|---|
| 204 |             'try_connecting_for_foo_secs': [ opt_int, 60 ], |
|---|
| 205 |             'max_stanza_per_sec': [ opt_int, 5], |
|---|
| 206 |             'http_auth': [opt_str, 'ask'], # yes, no, ask |
|---|
| 207 | Â Â Â Â Â Â Â Â Â Â Â Â # proxy65 for FT |
|---|
| 208 |             'file_transfer_proxies': [opt_str, |
|---|
| 209 | Â Â Â Â Â Â Â Â Â Â Â Â 'proxy.jabber.org, proxy65.jabber.autocom.pl, proxy.jabber.cd.chalmers.se, proxy.netlab.cz, proxy65.jabber.ccc.de, proxy65.unstable.nl']Â |
|---|
| 210 |         }, {}), |
|---|
| 211 | Â Â Â Â Â Â Â Â 'statusmsg':Â ({ |
|---|
| 212 |             'message': [ opt_str, '' ], |
|---|
| 213 |         }, {}), |
|---|
| 214 | Â Â Â Â Â Â Â Â 'emoticons':Â ({ |
|---|
| 215 |             'path': [ opt_str, '' ], |
|---|
| 216 |         }, {}), |
|---|
| 217 | Â Â Â Â Â Â Â Â 'soundevents':Â ({ |
|---|
| 218 |             'enabled': [ opt_bool, True ], |
|---|
| 219 |             'path': [ opt_str, '' ], |
|---|
| 220 |         }, {}), |
|---|
| 221 | Â Â Â Â Â Â Â Â 'proxies':Â ({ |
|---|
| 222 |             'type': [ opt_str, 'http' ], |
|---|
| 223 |             'host': [ opt_str, '' ], |
|---|
| 224 |             'port': [ opt_int, 3128 ], |
|---|
| 225 |             'user': [ opt_str, '' ], |
|---|
| 226 |             'pass': [ opt_str, '' ], |
|---|
| 227 |         }, {}), |
|---|
| 228 | Â Â Â Â Â Â Â Â 'ft_proxies65_cache':Â ({ |
|---|
| 229 |             'host': [ opt_str, ''], |
|---|
| 230 |             'port': [ opt_str, '7777'], |
|---|
| 231 |             'jid': [ opt_str, ''], |
|---|
| 232 |         }, {}), |
|---|
| 233 | Â Â Â Â Â Â Â Â 'themes':Â ({ |
|---|
| 234 |             'accounttextcolor': [ opt_color, 'black' ], |
|---|
| 235 |             'accountbgcolor': [ opt_color, 'white' ], |
|---|
| 236 |             'accountfont': [ opt_str, '' ], |
|---|
| 237 |             'accountfontattrs': [ opt_str, 'B' ], |
|---|
| 238 |             'grouptextcolor': [ opt_color, 'black' ], |
|---|
| 239 |             'groupbgcolor': [ opt_color, 'white' ], |
|---|
| 240 |             'groupfont': [ opt_str, '' ], |
|---|
| 241 |             'groupfontattrs': [ opt_str, 'I' ], |
|---|
| 242 |             'contacttextcolor': [ opt_color, 'black' ], |
|---|
| 243 |             'contactbgcolor': [ opt_color, 'white' ], |
|---|
| 244 |             'contactfont': [ opt_str, '' ], |
|---|
| 245 |             'contactfontattrs': [ opt_str, '' ], |
|---|
| 246 |             'bannertextcolor': [ opt_color, 'black' ], |
|---|
| 247 |             'bannerbgcolor': [ opt_color, '' ], |
|---|
| 248 | |
|---|
| 249 | Â Â Â Â Â Â Â Â Â Â Â Â # http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html |
|---|
| 250 | Â Â Â Â Â Â Â Â Â Â Â Â # FIXME: not black but the default color from gtk+ theme |
|---|
| 251 |             'state_active_color': [ opt_color, 'black' ], |
|---|
| 252 |             'state_inactive_color': [ opt_color, 'grey62' ], |
|---|
| 253 |             'state_composing_color': [ opt_color, 'green4' ], |
|---|
| 254 |             'state_paused_color': [ opt_color, 'mediumblue' ], |
|---|
| 255 |             'state_gone_color': [ opt_color, 'grey' ], |
|---|
| 256 | |
|---|
| 257 | Â Â Â Â Â Â Â Â Â Â Â Â # MUC chat states |
|---|
| 258 |             'state_muc_msg': [ opt_color, 'mediumblue' ], |
|---|
| 259 |             'state_muc_directed_msg': [ opt_color, 'red2' ], |
|---|
| 260 |         }, {}), |
|---|
| 261 | Â Â Â Â } |
|---|
| 262 | |
|---|
| 263 | Â Â Â Â emoticons_default =Â { |
|---|
| 264 | Â Â Â Â Â Â Â Â ':-)':Â '../data/emoticons/smile.png', |
|---|
| 265 | Â Â Â Â Â Â Â Â '(@)':Â '../data/emoticons/pussy.png', |
|---|
| 266 | Â Â Â Â Â Â Â Â '8)':Â '../data/emoticons/coolglasses.png', |
|---|
| 267 | Â Â Â Â Â Â Â Â ':(':Â '../data/emoticons/unhappy.png', |
|---|
| 268 | Â Â Â Â Â Â Â Â ':)':Â '../data/emoticons/smile.png', |
|---|
| 269 | Â Â Â Â Â Â Â Â ':/':Â '../data/emoticons/frowning.png', |
|---|
| 270 | Â Â Â Â Â Â Â Â '(})':Â '../data/emoticons/hugleft.png', |
|---|
| 271 | Â Â Â Â Â Â Â Â ':$':Â '../data/emoticons/blush.png', |
|---|
| 272 | Â Â Â Â Â Â Â Â '(Y)':Â '../data/emoticons/yes.png', |
|---|
| 273 | Â Â Â Â Â Â Â Â ':-@':Â '../data/emoticons/angry.png', |
|---|
| 274 | Â Â Â Â Â Â Â Â ':-D':Â '../data/emoticons/biggrin.png', |
|---|
| 275 | Â Â Â Â Â Â Â Â '(U)':Â '../data/emoticons/brheart.png', |
|---|
| 276 | Â Â Â Â Â Â Â Â '(F)':Â '../data/emoticons/flower.png', |
|---|
| 277 | Â Â Â Â Â Â Â Â ':-[':Â '../data/emoticons/bat.png', |
|---|
| 278 | Â Â Â Â Â Â Â Â ':>':Â '../data/emoticons/biggrin.png', |
|---|
| 279 | Â Â Â Â Â Â Â Â '(T)':Â '../data/emoticons/phone.png', |
|---|
| 280 | Â Â Â Â Â Â Â Â ':-S':Â '../data/emoticons/frowning.png', |
|---|
| 281 | Â Â Â Â Â Â Â Â ':-P':Â '../data/emoticons/tongue.png', |
|---|
| 282 | Â Â Â Â Â Â Â Â '(H)':Â '../data/emoticons/coolglasses.png', |
|---|
| 283 | Â Â Â Â Â Â Â Â '(D)':Â '../data/emoticons/drink.png', |
|---|
| 284 | Â Â Â Â Â Â Â Â ':-O':Â '../data/emoticons/oh.png', |
|---|
| 285 | Â Â Â Â Â Â Â Â '(C)':Â '../data/emoticons/coffee.png', |
|---|
| 286 | Â Â Â Â Â Â Â Â '({)':Â '../data/emoticons/hugright.png', |
|---|
| 287 | Â Â Â Â Â Â Â Â '(*)':Â '../data/emoticons/star.png', |
|---|
| 288 | Â Â Â Â Â Â Â Â 'B-)':Â '../data/emoticons/coolglasses.png', |
|---|
| 289 | Â Â Â Â Â Â Â Â '(Z)':Â '../data/emoticons/boy.png', |
|---|
| 290 | Â Â Â Â Â Â Â Â '(E)':Â '../data/emoticons/mail.png', |
|---|
| 291 | Â Â Â Â Â Â Â Â '(N)':Â '../data/emoticons/no.png', |
|---|
| 292 | Â Â Â Â Â Â Â Â '(P)':Â '../data/emoticons/photo.png', |
|---|
| 293 | Â Â Â Â Â Â Â Â '(K)':Â '../data/emoticons/kiss.png', |
|---|
| 294 | Â Â Â Â Â Â Â Â ':-*':Â '../data/emoticons/kiss.png', |
|---|
| 295 | Â Â Â Â Â Â Â Â ':*':Â '../data/emoticons/kiss.png', |
|---|
| 296 | Â Â Â Â Â Â Â Â '(R)':Â '../data/emoticons/rainbow.png', |
|---|
| 297 | Â Â Â Â Â Â Â Â ':-|':Â '../data/emoticons/stare.png', |
|---|
| 298 | Â Â Â Â Â Â Â Â ';-)':Â '../data/emoticons/wink.png', |
|---|
| 299 | Â Â Â Â Â Â Â Â ';-(':Â '../data/emoticons/cry.png', |
|---|
| 300 | Â Â Â Â Â Â Â Â '(6)':Â '../data/emoticons/devil.png', |
|---|
| 301 | Â Â Â Â Â Â Â Â '>:)':Â '../data/emoticons/devil.png', |
|---|
| 302 | Â Â Â Â Â Â Â Â '>:-)':Â '../data/emoticons/devil.png', |
|---|
| 303 | Â Â Â Â Â Â Â Â '(L)':Â '../data/emoticons/heart.png', |
|---|
| 304 | Â Â Â Â Â Â Â Â '<3':Â '../data/emoticons/heart.png', |
|---|
| 305 | Â Â Â Â Â Â Â Â '(W)':Â '../data/emoticons/brflower.png', |
|---|
| 306 | Â Â Â Â Â Â Â Â ':|':Â '../data/emoticons/stare.png', |
|---|
| 307 | Â Â Â Â Â Â Â Â ':O':Â '../data/emoticons/oh.png', |
|---|
| 308 | Â Â Â Â Â Â Â Â ';)':Â '../data/emoticons/wink.png', |
|---|
| 309 | Â Â Â Â Â Â Â Â ';(':Â '../data/emoticons/cry.png', |
|---|
| 310 | Â Â Â Â Â Â Â Â ':S':Â '../data/emoticons/frowning.png', |
|---|
| 311 | Â Â Â Â Â Â Â Â ';\'-(':Â '../data/emoticons/cry.png', |
|---|
| 312 | Â Â Â Â Â Â Â Â ':-(':Â '../data/emoticons/unhappy.png', |
|---|
| 313 | Â Â Â Â Â Â Â Â '8-)':Â '../data/emoticons/coolglasses.png', |
|---|
| 314 | Â Â Â Â Â Â Â Â '(B)':Â '../data/emoticons/beer.png', |
|---|
| 315 | Â Â Â Â Â Â Â Â ':D':Â '../data/emoticons/biggrin.png', |
|---|
| 316 | Â Â Â Â Â Â Â Â '(8)':Â '../data/emoticons/music.png', |
|---|
| 317 | Â Â Â Â Â Â Â Â ':@':Â '../data/emoticons/angry.png', |
|---|
| 318 | Â Â Â Â Â Â Â Â 'B)':Â '../data/emoticons/coolglasses.png', |
|---|
| 319 | Â Â Â Â Â Â Â Â ':-$':Â '../data/emoticons/blush.png', |
|---|
| 320 | Â Â Â Â Â Â Â Â ':\'(':Â '../data/emoticons/cry.png', |
|---|
| 321 | Â Â Â Â Â Â Â Â ':->':Â '../data/emoticons/biggrin.png', |
|---|
| 322 | Â Â Â Â Â Â Â Â ':[':Â '../data/emoticons/bat.png', |
|---|
| 323 | Â Â Â Â Â Â Â Â '(I)':Â '../data/emoticons/lamp.png', |
|---|
| 324 | Â Â Â Â Â Â Â Â ':P':Â '../data/emoticons/tongue.png', |
|---|
| 325 | Â Â Â Â Â Â Â Â '(%)':Â '../data/emoticons/cuffs.png', |
|---|
| 326 | Â Â Â Â Â Â Â Â '(S)':Â '../data/emoticons/moon.png', |
|---|
| 327 | Â Â Â Â } |
|---|
| 328 | |
|---|
| 329 | Â Â Â Â statusmsg_default =Â { |
|---|
| 330 | Â Â Â Â Â Â Â Â _('Sleeping'):Â 'ZZZZzzzzzZZZZZ', |
|---|
| 331 | Â Â Â Â Â Â Â Â _('Back soon'):Â _('Back in some minutes.'), |
|---|
| 332 | Â Â Â Â Â Â Â Â _('Eating'):Â _("I'm eating, so leave me a message."), |
|---|
| 333 | Â Â Â Â Â Â Â Â _('Movie'):Â _("I'm watching a movie."), |
|---|
| 334 | Â Â Â Â Â Â Â Â _('Working'):Â _("I'm working."), |
|---|
| 335 | Â Â Â Â Â Â Â Â _('Phone'):Â _("I'm on the phone."), |
|---|
| 336 | Â Â Â Â Â Â Â Â _('Out'):Â _("I'm out enjoying life"), |
|---|
| 337 | Â Â Â Â } |
|---|
| 338 | |
|---|
| 339 | Â Â Â Â soundevents_default =Â { |
|---|
| 340 |         'first_message_received': [ True, '../data/sounds/message1.wav' ], |
|---|
| 341 |         'next_message_received': [ True, '../data/sounds/message2.wav' ], |
|---|
| 342 |         'contact_connected': [ True, '../data/sounds/connected.wav' ], |
|---|
| 343 |         'contact_disconnected': [ True, '../data/sounds/disconnected.wav' ], |
|---|
| 344 |         'message_sent': [ True, '../data/sounds/sent.wav' ], |
|---|
| 345 |         'muc_message_highlight': [ True, '../data/sounds/gc_message1.wav', _('Sound to play when a MUC message contains one of the words in muc_highlight_words, or when a MUC message contains your nickname.')], |
|---|
| 346 |         'muc_message_received': [ True, '../data/sounds/gc_message2.wav', _('Sound to play when any MUC message arrives. (This setting is taken into account only if notify_on_all_muc_messages is True)') ], |
|---|
| 347 | Â Â Â Â } |
|---|
| 348 | |
|---|
| 349 | Â Â Â Â themes_default =Â { |
|---|
| 350 | Â Â Â Â Â Â Â Â # sorted alphanum |
|---|
| 351 |         _('green'): [ '#ffffff', '#94aa8c', '', 'B', '#0000ff', '#eff3e7', |
|---|
| 352 |                     '', 'I', '#000000', '#ffffff', '', '', '#ffffff', |
|---|
| 353 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â '#94aa8c'Â ], |
|---|
| 354 | Â Â Â Â Â Â Â Â |
|---|
| 355 |         _('grocery'): [ '#ffffff', '#6bbe18', '', 'B', '#12125a', '#ceefad', |
|---|
| 356 |                     '', 'I', '#000000', '#efb26b', '', '', '#ffffff', |
|---|
| 357 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â '#108abd'Â ], |
|---|
| 358 | Â Â Â Â Â Â Â Â |
|---|
| 359 |         _('human'): [ '#ffffff', '#996442', '', 'B', '#ab5920', '#e3ca94', |
|---|
| 360 |                     '', 'I', '#000000', '#ffffff', '', '', '#ffffff', |
|---|
| 361 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â '#996442'Â ], |
|---|
| 362 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â |
|---|
| 363 |         _('marine'): [ '#ffffff', '#918caa', '', 'B', '#0000ff', '#e9e7f3', |
|---|
| 364 |                     '', 'I', '#000000', '#ffffff', '', '', '#ffffff', |
|---|
| 365 | Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â '#918caa'Â ], |
|---|
| 366 | Â Â Â Â Â Â Â Â |
|---|
| 367 |         _('plain'): [ '', '', '', 'B', '', '','', 'I', '', '', '', '', '','' ], |
|---|
| 368 | Â Â Â Â Â Â Â Â |
|---|
| 369 | Â Â Â Â } |
|---|
| 370 | Â Â Â Â |
|---|
| 371 | Â Â Â Â ft_proxies65_default =Â { |
|---|
| 372 |         'proxy.jabber.org': [ '208.245.212.98', '7777', 'proxy.jabber.org' ], |
|---|
| 373 |         'proxy65.jabber.autocom.pl': ['213.134.161.52', '7777', 'proxy65.jabber.autocom.pl'], |
|---|
| 374 |         'proxy.jabber.cd.chalmers.se': ['129.16.79.37', '7777', 'proxy.jabber.cd.chalmers.se'], |
|---|
| 375 |         'proxy.netlab.cz': ['82.119.241.3', '7777', 'proxy.netlab.cz'], |
|---|
| 376 |         'proxy65.jabber.ccc.de': ['217.10.10.196', '7777', 'proxy65.jabber.ccc.de'], |
|---|
| 377 |         'proxy65.unstable.nl': ['84.107.143.192', '7777', 'proxy65.unstable.nl'], |
|---|
| 378 | Â Â Â Â } |
|---|
| 379 | |
|---|
| 380 |     def foreach(self, cb, data = None): |
|---|
| 381 |         for opt in self.__options: |
|---|
| 382 |             cb(data, opt, None, self.__options[opt]) |
|---|
| 383 |         for opt in self.__options_per_key: |
|---|
| 384 |             cb(data, opt, None, None) |
|---|
| 385 |             dict = self.__options_per_key[opt][1] |
|---|
| 386 |             for opt2 in dict.keys(): |
|---|
| 387 |                 cb(data, opt2, [opt], None) |
|---|
| 388 |                 for opt3 in dict[opt2]: |
|---|
| 389 |                     cb(data, opt3, [opt, opt2], dict[opt2][opt3]) |
|---|
| 390 | |
|---|
| 391 |     def is_valid_int(self, val): |
|---|
| 392 | Â Â Â Â Â Â Â Â try: |
|---|
| 393 | Â Â Â Â Â Â Â Â Â Â Â Â ival =Â int(val) |
|---|
| 394 | Â Â Â Â Â Â Â Â except: |
|---|
| 395 |             return None |
|---|
| 396 |         return ival |
|---|
| 397 | |
|---|
| 398 |     def is_valid_bool(self, val): |
|---|
| 399 |         if val == 'True': |
|---|
| 400 |             return True |
|---|
| 401 |         elif val == 'False': |
|---|
| 402 |             return False |
|---|
| 403 | Â Â Â Â Â Â Â Â else: |
|---|
| 404 | Â Â Â Â Â Â Â Â Â Â Â Â ival =Â self.is_valid_int(val) |
|---|
| 405 |             if ival: |
|---|
| 406 |                 return True |
|---|
| 407 |             elif ival is None: |
|---|
| 408 |                 return None |
|---|
| 409 |             return False |
|---|
| 410 |         return None |
|---|
| 411 | |
|---|
| 412 |     def is_valid_string(self, val): |
|---|
| 413 |         return val |
|---|
| 414 | |
|---|
| 415 |     def is_valid(self, type, val): |
|---|
| 416 |         if not type: |
|---|
| 417 |             return None |
|---|
| 418 |         if type[0] == 'boolean': |
|---|
| 419 |             return self.is_valid_bool(val) |
|---|
| 420 |         elif type[0] == 'integer': |
|---|
| 421 |             return self.is_valid_int(val) |
|---|
| 422 |         elif type[0] == 'string': |
|---|
| 423 |             return self.is_valid_string(val) |
|---|
| 424 | Â Â Â Â Â Â Â Â else: |
|---|
| 425 |             if sre.match(type[1], val): |
|---|
| 426 |                 return val |
|---|
| 427 | Â Â Â Â Â Â Â Â Â Â Â Â else: |
|---|
| 428 |                 return None |
|---|
| 429 | |
|---|
| 430 |     def set(self, optname, value): |
|---|
| 431 |         if not self.__options.has_key(optname): |
|---|
| 432 | #Â Â Â Â Â Â Â Â Â Â Â Â raise RuntimeError, 'option %s does not exist' % optname |
|---|
| 433 | Â Â Â Â Â Â Â Â Â Â Â Â return |
|---|
| 434 | Â Â Â Â Â Â Â Â opt =Â self.__options[optname] |
|---|
| 435 |         value = self.is_valid(opt[OPT_TYPE], value) |
|---|
| 436 |         if value is None: |
|---|
| 437 | #Â Â Â Â Â Â Â Â Â Â Â Â raise RuntimeError, 'value of %s cannot be None' % optname |
|---|
| 438 | Â Â Â Â Â Â Â Â Â Â Â Â return |
|---|
| 439 | |
|---|
| 440 | Â Â Â Â Â Â Â Â opt[OPT_VAL]Â =Â value |
|---|
| 441 | |
|---|
| 442 |     def get(self, optname = None): |
|---|
| 443 |         if not optname: |
|---|
| 444 |             return self.__options.keys() |
|---|
| 445 |         if not self.__options.has_key(optname): |
|---|
| 446 |             return None |
|---|
| 447 |         return self.__options[optname][OPT_VAL] |
|---|
| 448 | Â Â Â Â Â Â Â Â |
|---|
| 449 |     def get_desc(self, optname): |
|---|
| 450 |         if not self.__options.has_key(optname): |
|---|
| 451 |             return None |
|---|
| 452 |         if len(self.__options[optname]) > OPT_DESC: |
|---|
| 453 |             return self.__options[optname][OPT_DESC] |
|---|
| 454 | |
|---|
| 455 |     def add_per(self, typename, name): # per_group_of_option |
|---|
| 456 |         if not self.__options_per_key.has_key(typename): |
|---|
| 457 | #Â Â Â Â Â Â Â Â Â Â Â Â raise RuntimeError, 'option %s does not exist' % typename |
|---|
| 458 | Â Â Â Â Â Â Â Â Â Â Â Â return |
|---|
| 459 | Â Â Â Â Â Â Â Â |
|---|
| 460 | Â Â Â Â Â Â Â Â opt =Â self.__options_per_key[typename] |
|---|
| 461 |         if opt[1].has_key(name): |
|---|
| 462 | Â Â Â Â Â Â Â Â Â Â Â Â # we already have added group name before |
|---|
| 463 |             return 'you already have added %s before' % name |
|---|
| 464 | Â Â Â Â Â Â Â Â opt[1][name]Â =Â copy.deepcopy(opt[0]) |
|---|
| 465 | |
|---|
| 466 |     def del_per(self, typename, name, subname = None): # per_group_of_option |
|---|
| 467 |         if not self.__options_per_key.has_key(typename): |
|---|
| 468 | #Â Â Â Â Â Â Â Â Â Â Â Â raise RuntimeError, 'option %s does not exist' % typename |
|---|
| 469 | Â Â Â Â Â Â Â Â Â Â Â Â return |
|---|
| 470 | |
|---|
| 471 | Â Â Â Â Â Â Â Â opt =Â self.__options_per_key[typename] |
|---|
| 472 |         if subname is None: |
|---|
| 473 |             del opt[1][name] |
|---|
| 474 |         # if subname is specified, delete the item in the group.    |
|---|
| 475 |         elif opt[1][name].has_key(subname): |
|---|
| 476 |             del opt[1][name][subname] |
|---|
| 477 | |
|---|
| 478 |     def set_per(self, optname, key, subname, value): # per_group_of_option |
|---|
| 479 |         if not self.__options_per_key.has_key(optname): |
|---|
| 480 | #Â Â Â Â Â Â Â Â Â Â Â Â raise RuntimeError, 'option %s does not exist' % optname |
|---|
| 481 | Â Â Â Â Â Â Â Â Â Â Â Â return |
|---|
| 482 |         dict = self.__options_per_key[optname][1] |
|---|
| 483 |         if not dict.has_key(key): |
|---|
| 484 | #Â Â Â Â Â Â Â Â Â Â Â Â raise RuntimeError, '%s is not a key of %s' % (key, dict) |
|---|
| 485 | Â Â Â Â Â Â Â Â Â Â Â Â return |
|---|
| 486 | Â Â Â Â Â Â Â Â obj =Â dict[key] |
|---|
| 487 |         if not obj.has_key(subname): |
|---|
| 488 | #Â Â Â Â Â Â Â Â Â Â Â Â raise RuntimeError, '%s is not a key of %s' % (subname, obj) |
|---|
| 489 | Â Â Â Â Â Â Â Â Â Â Â Â return |
|---|
| 490 | Â Â Â Â Â Â Â Â subobj =Â obj[subname] |
|---|
| 491 |         value = self.is_valid(subobj[OPT_TYPE], value) |
|---|
| 492 |         if value is None: |
|---|
| 493 | #Â Â Â Â Â Â Â Â Â Â Â Â raise RuntimeError, '%s of %s cannot be None' % optname |
|---|
| 494 | Â Â Â Â Â Â Â Â Â Â Â Â return |
|---|
| 495 | Â Â Â Â Â Â Â Â subobj[OPT_VAL]Â =Â value |
|---|
| 496 | |
|---|
| 497 |     def get_per(self, optname, key = None, subname = None): # per_group_of_option |
|---|
| 498 |         if not self.__options_per_key.has_key(optname): |
|---|
| 499 |             return None |
|---|
| 500 |         dict = self.__options_per_key[optname][1] |
|---|
| 501 |         if not key: |
|---|
| 502 |             return dict.keys() |
|---|
| 503 |         if not dict.has_key(key): |
|---|
| 504 |             return None |
|---|
| 505 | Â Â Â Â Â Â Â Â obj =Â dict[key] |
|---|
| 506 |         if not subname: |
|---|
| 507 |             return obj |
|---|
| 508 |         if not obj.has_key(subname): |
|---|
| 509 |             return None |
|---|
| 510 |         return obj[subname][OPT_VAL] |
|---|
| 511 | |
|---|
| 512 |     def __init__(self): |
|---|
| 513 | Â Â Â Â Â Â Â Â #init default values |
|---|
| 514 |         for event in self.soundevents_default: |
|---|
| 515 | Â Â Â Â Â Â Â Â Â Â Â Â default =Â self.soundevents_default[event] |
|---|
| 516 |             self.add_per('soundevents', event) |
|---|
| 517 |             self.set_per('soundevents', event, 'enabled', default[0]) |
|---|
| 518 |             self.set_per('soundevents', event, 'path', default[1]) |
|---|
| 519 | |
|---|
| 520 | Â Â Â Â Â Â Â Â # set initial cache values for proxie65 hosts |
|---|
| 521 |         for proxy in self.ft_proxies65_default: |
|---|
| 522 | Â Â Â Â Â Â Â Â Â Â Â Â default =Â self.ft_proxies65_default[proxy] |
|---|
| 523 |             self.add_per('ft_proxies65_cache', proxy) |
|---|
| 524 | Â Â Â Â Â Â Â Â Â Â |
|---|