2005-04-14 07:28:59 +00:00
## common/config.py
##
2007-12-12 08:44:46 +00:00
## Copyright (C) 2003-2007 Yann Leboulanger <asterix@lagaule.org>
2006-04-04 17:10:12 +00:00
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
2006-02-24 21:53:05 +00:00
## Copyright (C) 2004-2005 Vincent Hanquez <tab@snarc.org>
## Copyright (C) 2005 Dimitur Kirov <dkirov@gmail.com>
2007-12-12 08:44:46 +00:00
## Travis Shirk <travis@pobox.com>
## Norman Rasmussen <norman@rasmussen.co.za>
2006-10-02 12:14:56 +00:00
## Copyright (C) 2006 Stefan Bethge <stefan@lanpartei.de>
2007-08-09 15:39:18 +00:00
## Copyright (C) 2007 Julien Pivotto <roidelapluie@gmail.com>
2007-12-12 08:44:46 +00:00
## Stephan Erb <steve-e@h3c.de>
2006-10-02 12:14:56 +00:00
##
2007-12-12 08:44:46 +00:00
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
2005-04-14 07:28:59 +00:00
## it under the terms of the GNU General Public License as published
2007-12-12 08:44:46 +00:00
## by the Free Software Foundation; version 3 only.
2005-04-14 07:28:59 +00:00
##
2007-12-12 08:44:46 +00:00
## Gajim is distributed in the hope that it will be useful,
2005-04-14 07:28:59 +00:00
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
2007-12-12 08:44:46 +00:00
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
2005-04-14 07:28:59 +00:00
2007-12-12 08:44:46 +00:00
import sys
2006-11-18 23:21:59 +00:00
import re
2005-04-14 07:28:59 +00:00
import copy
2006-10-12 15:10:17 +00:00
import defs
2005-04-14 07:28:59 +00:00
2006-03-26 19:34:31 +00:00
(
OPT_TYPE ,
OPT_VAL ,
OPT_DESC ,
2006-03-04 00:25:36 +00:00
# If OPT_RESTART is True - we need restart to use our changed option
# OPT_DESC also should be there
2006-03-26 19:34:31 +00:00
OPT_RESTART ,
) = range ( 4 )
2005-04-14 07:28:59 +00:00
opt_int = [ ' integer ' , 0 ]
opt_str = [ ' string ' , 0 ]
opt_bool = [ ' boolean ' , 0 ]
2005-09-16 21:32:57 +00:00
opt_color = [ ' color ' , ' ^(#[0-9a-fA-F] {6} )|()$ ' ]
Merge one_window branch
Merged revisions 9143,9145-9155,9157-9162,9164-9169,9171-9177 via svnmerge from
svn://88.191.11.156/gajim/branches/one_window
........
r9145 | nicfit | 2007-12-13 21:49:09 -0700 (Thu, 13 Dec 2007) | 2 lines
Implemented the original Nikos patch with an HPaned instead of a HBox and only do this mode when one_message_window == 'always'
........
r9152 | nicfit | 2007-12-15 13:33:56 -0700 (Sat, 15 Dec 2007) | 2 lines
Added config and GUI for one_message_window_with_roster
........
r9153 | nicfit | 2007-12-15 13:41:46 -0700 (Sat, 15 Dec 2007) | 2 lines
Use one_message_window_with_roster and some whitespace cleanup
........
r9154 | nicfit | 2007-12-15 14:04:49 -0700 (Sat, 15 Dec 2007) | 2 lines
Scratch the chckbox for with roster mode, use one_message_window opt and combo
........
r9155 | nicfit | 2007-12-15 17:01:13 -0700 (Sat, 15 Dec 2007) | 2 lines
MessageWindowMgr knows about ONE_MESSAGE_WINDOW_ALWAYS_WITH_ROSTER and MessageWindow can reparent itself rather then the roster having to do so.
........
r9157 | nicfit | 2007-12-15 17:47:20 -0700 (Sat, 15 Dec 2007) | 2 lines
Resizing fixes and make the roster window shrink when last tab is removed
........
r9158 | nicfit | 2007-12-15 19:15:11 -0700 (Sat, 15 Dec 2007) | 2 lines
Added "Show roster" (CTRL+R) to view menu when using always_with_roster to quickly hide/show the roster.
........
r9159 | nicfit | 2007-12-15 19:49:30 -0700 (Sat, 15 Dec 2007) | 2 lines
Handle window title setting in always_with_roster mode.
........
r9160 | nicfit | 2007-12-15 20:13:57 -0700 (Sat, 15 Dec 2007) | 2 lines
Removed FIXME
........
r9167 | nicfit | 2007-12-17 18:40:59 -0700 (Mon, 17 Dec 2007) | 2 lines
When roster is hidden, show it when the number of MessageWindow controls == 0
........
r9168 | nicfit | 2007-12-17 19:07:49 -0700 (Mon, 17 Dec 2007) | 2 lines
Disable hiding roster when there are no message controls open
........
r9169 | nicfit | 2007-12-17 20:41:11 -0700 (Mon, 17 Dec 2007) | 2 lines
Bunch of saved size bugs fixed
........
2007-12-18 23:42:22 +00:00
opt_one_window_types = [ ' never ' , ' always ' , ' always_with_roster ' , ' peracct ' , ' pertype ' ]
2007-01-05 20:38:36 +00:00
opt_treat_incoming_messages = [ ' ' , ' chat ' , ' normal ' ]
2005-04-14 07:28:59 +00:00
class Config :
2006-12-01 20:01:37 +00:00
DEFAULT_ICONSET = ' dcraven '
2007-12-12 08:44:46 +00:00
if sys . platform == ' darwin ' :
DEFAULT_OPENWITH = ' open '
DEFAULT_BROWSER = ' open -a Safari '
DEFAULT_MAILAPP = ' open -a Mail '
DEFAULT_FILE_MANAGER = ' open -a Finder '
else :
DEFAULT_OPENWITH = ' gnome-open '
DEFAULT_BROWSER = ' firefox '
DEFAULT_MAILAPP = ' mozilla-thunderbird -compose '
DEFAULT_FILE_MANAGER = ' xffm '
2006-12-01 20:01:37 +00:00
2005-04-14 07:28:59 +00:00
__options = {
2006-02-08 02:26:54 +00:00
# name: [ type, default_value, help_string ]
2006-03-04 00:25:36 +00:00
' verbose ' : [ opt_bool , False , ' ' , True ] ,
2005-04-16 14:50:26 +00:00
' alwaysauth ' : [ opt_bool , False ] ,
' autopopup ' : [ opt_bool , False ] ,
2005-05-21 13:53:09 +00:00
' notify_on_signin ' : [ opt_bool , True ] ,
' notify_on_signout ' : [ opt_bool , False ] ,
2005-07-21 21:03:36 +00:00
' notify_on_new_message ' : [ opt_bool , True ] ,
2005-04-16 14:50:26 +00:00
' autopopupaway ' : [ opt_bool , False ] ,
2006-09-14 16:48:03 +00:00
' use_notif_daemon ' : [ opt_bool , True , _ ( ' Use D-Bus and Notification-Daemon to show notifications ' ) ] ,
2005-04-16 14:50:26 +00:00
' ignore_unknown_contacts ' : [ opt_bool , False ] ,
2006-10-04 00:10:49 +00:00
' showoffline ' : [ opt_bool , False ] ,
' show_transports_group ' : [ opt_bool , True ] ,
2005-04-16 14:50:26 +00:00
' autoaway ' : [ opt_bool , True ] ,
2005-09-04 18:56:06 +00:00
' autoawaytime ' : [ opt_int , 5 , _ ( ' Time in minutes, after which your status changes to away. ' ) ] ,
2008-03-24 21:59:39 +00:00
' 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 autoaway time. ' ) ] ,
2005-04-16 14:50:26 +00:00
' autoxa ' : [ opt_bool , True ] ,
2005-09-04 18:56:06 +00:00
' autoxatime ' : [ opt_int , 15 , _ ( ' Time in minutes, after which your status changes to not available. ' ) ] ,
2008-03-24 21:59:39 +00:00
' 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 autoxa time. ' ) ] ,
2005-04-16 14:50:26 +00:00
' ask_online_status ' : [ opt_bool , False ] ,
' ask_offline_status ' : [ opt_bool , False ] ,
2005-06-30 19:23:41 +00:00
' last_status_msg_online ' : [ opt_str , ' ' ] ,
' last_status_msg_chat ' : [ opt_str , ' ' ] ,
' last_status_msg_away ' : [ opt_str , ' ' ] ,
' last_status_msg_xa ' : [ opt_str , ' ' ] ,
' last_status_msg_dnd ' : [ opt_str , ' ' ] ,
' last_status_msg_invisible ' : [ opt_str , ' ' ] ,
' last_status_msg_offline ' : [ opt_str , ' ' ] ,
2006-03-04 00:25:36 +00:00
' trayicon ' : [ opt_bool , True , ' ' , True ] ,
2006-09-26 15:57:47 +00:00
' iconset ' : [ opt_str , DEFAULT_ICONSET , ' ' , True ] ,
2006-03-04 00:25:36 +00:00
' use_transports_iconsets ' : [ opt_bool , True , ' ' , True ] ,
' inmsgcolor ' : [ opt_color , ' #a34526 ' , ' ' , True ] ,
' outmsgcolor ' : [ opt_color , ' #164e6f ' , ' ' , True ] ,
' statusmsgcolor ' : [ opt_color , ' #1eaa1e ' , ' ' , True ] ,
' markedmsgcolor ' : [ opt_color , ' #ff8080 ' , ' ' , True ] ,
' urlmsgcolor ' : [ opt_color , ' #0000ff ' , ' ' , True ] ,
2006-09-14 16:48:03 +00:00
' collapsed_rows ' : [ opt_str , ' ' , _ ( ' List (space separated) of rows (accounts and groups) that are collapsed. ' ) , True ] ,
2007-08-09 15:39:18 +00:00
' roster_theme ' : [ opt_str , _ ( ' default ' ) , ' ' , True ] ,
2006-03-04 00:25:36 +00:00
' mergeaccounts ' : [ opt_bool , False , ' ' , True ] ,
' sort_by_show ' : [ opt_bool , True , ' ' , True ] ,
2006-09-17 15:49:47 +00:00
' enable_zeroconf ' : [ opt_bool , False , _ ( ' Enable link-local/zeroconf messaging ' ) ] ,
2006-03-04 00:25:36 +00:00
' use_speller ' : [ opt_bool , False , ] ,
2006-10-18 08:20:49 +00:00
' ignore_incoming_xhtml ' : [ opt_bool , False , ] ,
2006-09-14 16:48:03 +00:00
' speller_language ' : [ opt_str , ' ' , _ ( ' Language used by speller ' ) ] ,
2006-05-08 14:50:38 +00:00
' 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. ' ) ] ,
2007-01-02 13:36:54 +00:00
' 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 \' . ' ) ] ,
2006-03-16 23:37:06 +00:00
' emoticons_theme ' : [ opt_str , ' static ' , ' ' , True ] ,
2006-03-02 16:05:52 +00:00
' ascii_formatting ' : [ opt_bool , True ,
2006-03-04 00:25:36 +00:00
_ ( ' Treat * / _ pairs as possible formatting characters. ' ) , True ] ,
2006-09-14 16:48:03 +00:00
' show_ascii_formatting_chars ' : [ opt_bool , True , _ ( ' If True, do not '
2006-03-02 16:05:52 +00:00
' remove */_ . So *abc* will be bold but with * * not removed. ' ) ] ,
2006-10-04 00:10:49 +00:00
' rst_formatting_outgoing_messages ' : [ opt_bool , False ,
2007-01-15 22:28:26 +00:00
_ ( ' 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) ' ) ] ,
2005-04-16 14:50:26 +00:00
' sounds_on ' : [ opt_bool , True ] ,
2005-08-09 11:34:36 +00:00
# 'aplay', 'play', 'esdplay', 'artsplay' detected first time only
' soundplayer ' : [ opt_str , ' ' ] ,
2007-12-12 08:44:46 +00:00
' openwith ' : [ opt_str , DEFAULT_OPENWITH ] ,
' custombrowser ' : [ opt_str , DEFAULT_BROWSER ] ,
' custommailapp ' : [ opt_str , DEFAULT_MAILAPP ] ,
' custom_file_manager ' : [ opt_str , DEFAULT_FILE_MANAGER ] ,
2006-09-14 16:48:03 +00:00
' 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_proposed_nick_char ' : [ opt_str , ' _ ' , _ ( ' Character to propose to add after desired nickname when desired nickname is used by someone else in group chat. ' ) ] ,
2006-01-08 04:31:02 +00:00
' 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
2006-09-14 16:48:03 +00:00
' msgwin-width ' : [ opt_int , 500 ] ,
2006-01-25 13:34:02 +00:00
' msgwin-height ' : [ opt_int , 440 ] ,
2006-01-12 05:45:30 +00:00
' 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
2006-01-25 13:34:02 +00:00
' chat-msgwin-width ' : [ opt_int , 480 ] ,
' chat-msgwin-height ' : [ opt_int , 440 ] ,
2006-01-12 05:45:30 +00:00
' 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
2006-09-14 16:48:03 +00:00
' gc-msgwin-width ' : [ opt_int , 600 ] ,
2006-01-25 13:34:02 +00:00
' gc-msgwin-height ' : [ opt_int , 440 ] ,
2006-01-12 05:45:30 +00:00
' single-msg-x-position ' : [ opt_int , 0 ] ,
' single-msg-y-position ' : [ opt_int , 0 ] ,
' single-msg-width ' : [ opt_int , 400 ] ,
' single-msg-height ' : [ opt_int , 280 ] ,
2005-07-21 21:19:08 +00:00
' roster_x-position ' : [ opt_int , 0 ] ,
' roster_y-position ' : [ opt_int , 0 ] ,
2007-12-12 08:44:46 +00:00
' roster_width ' : [ opt_int , 200 ] ,
2005-07-21 21:19:08 +00:00
' roster_height ' : [ opt_int , 400 ] ,
2005-04-14 07:28:59 +00:00
' latest_disco_addresses ' : [ opt_str , ' ' ] ,
' recently_groupchat ' : [ opt_str , ' ' ] ,
2007-01-15 13:07:24 +00:00
' 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 ' ) ] ,
' after_nickname ' : [ opt_str , ' : ' , _ ( ' Characters that are printed after the nickname in conversations ' ) ] ,
2005-04-24 12:18:49 +00:00
' send_os_info ' : [ opt_bool , True ] ,
2007-12-12 08:44:46 +00:00
' lastfm_username ' : [ opt_str , ' ' , _ ( ' The username used to identify the Last.fm account. ' ) ] ,
Merged revisions 5017-5020,5022-5029 via svnmerge from
svn://svn.gajim.org/gajim/trunk
........
r5017 | asterix | 2006-01-06 01:55:51 -0700 (Fri, 06 Jan 2006) | 2 lines
use escape for pango markup
........
r5018 | asterix | 2006-01-06 02:21:39 -0700 (Fri, 06 Jan 2006) | 2 lines
missing new contacts function
........
r5019 | asterix | 2006-01-06 11:03:07 -0700 (Fri, 06 Jan 2006) | 2 lines
handle the click on toggle_gpg_encryption menuitem
........
r5020 | asterix | 2006-01-06 11:14:14 -0700 (Fri, 06 Jan 2006) | 2 lines
use the saved size even if a chat window is already opened
........
r5022 | asterix | 2006-01-07 03:43:47 -0700 (Sat, 07 Jan 2006) | 2 lines
we can now resume filetransfert
........
r5023 | asterix | 2006-01-07 03:56:31 -0700 (Sat, 07 Jan 2006) | 2 lines
[Knuckles] Google E-Mail Notification
........
r5024 | asterix | 2006-01-07 04:02:16 -0700 (Sat, 07 Jan 2006) | 2 lines
better string
........
r5025 | asterix | 2006-01-07 04:14:32 -0700 (Sat, 07 Jan 2006) | 2 lines
fix a TB
........
r5026 | asterix | 2006-01-07 05:36:55 -0700 (Sat, 07 Jan 2006) | 2 lines
we can now drag a file on a contact in the roster to send him a file
........
r5027 | asterix | 2006-01-07 06:26:28 -0700 (Sat, 07 Jan 2006) | 2 lines
contact.groups is always a list, even if emtpy
........
r5028 | asterix | 2006-01-07 06:54:30 -0700 (Sat, 07 Jan 2006) | 2 lines
make all buttons insensitive on a category row in disco
........
r5029 | asterix | 2006-01-07 07:19:25 -0700 (Sat, 07 Jan 2006) | 2 lines
auto open groupchat configuration window when we create a new room
........
2006-01-07 17:25:35 +00:00
' notify_on_new_gmail_email ' : [ opt_bool , True ] ,
2006-09-14 16:48:03 +00:00
' notify_on_new_gmail_email_extra ' : [ opt_bool , False ] ,
2005-08-30 21:10:14 +00:00
' use_gpg_agent ' : [ opt_bool , False ] ,
2005-09-04 18:51:16 +00:00
' change_roster_title ' : [ opt_bool , True , _ ( ' Add * and [n] in roster title? ' ) ] ,
' restore_lines ' : [ opt_int , 4 , _ ( ' How many lines to remember from previous conversation when a chat tab/window is reopened. ' ) ] ,
' restore_timeout ' : [ opt_int , 60 , _ ( ' How many minutes should last lines from previous conversation last. ' ) ] ,
2005-09-17 11:34:39 +00:00
' send_on_ctrl_enter ' : [ opt_bool , False , _ ( ' Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour). ' ) ] ,
2005-06-05 23:20:06 +00:00
' show_roster_on_startup ' : [ opt_bool , True ] ,
2005-11-21 16:50:28 +00:00
' key_up_lines ' : [ opt_int , 25 , _ ( ' How many lines to store for Ctrl+KeyUP. ' ) ] ,
2006-10-12 15:10:17 +00:00
' version ' : [ opt_str , defs . version ] , # which version created the config
2005-08-05 15:42:55 +00:00
' search_engine ' : [ opt_str , ' http://www.google.com/search?&q= %s &sourceid=gajim ' ] ,
2005-09-03 13:48:25 +00:00
' dictionary_url ' : [ opt_str , ' WIKTIONARY ' , _ ( " Either custom url with %s in it where %s is the word/phrase or ' WIKTIONARY ' which means use wiktionary. " ) ] ,
2005-07-17 20:26:43 +00:00
' always_english_wikipedia ' : [ opt_bool , False ] ,
2005-11-09 23:05:11 +00:00
' always_english_wiktionary ' : [ opt_bool , True ] ,
2006-03-04 00:25:36 +00:00
' remote_control ' : [ opt_bool , True , _ ( ' If checked, Gajim can be controlled remotely using gajim-remote. ' ) , True ] ,
2006-10-21 10:25:39 +00:00
' 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 ] ,
2006-11-26 09:06:47 +00:00
' 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. ' ) ] ,
2006-03-04 00:25:36 +00:00
' autodetect_browser_mailer ' : [ opt_bool , False , ' ' , True ] ,
2006-09-14 16:48:03 +00:00
' print_ichat_every_foo_minutes ' : [ opt_int , 5 , _ ( ' When not printing time for every message (print_time==sometimes), print it every x minutes. ' ) ] ,
2005-09-03 13:48:25 +00:00
' confirm_close_muc ' : [ opt_bool , True , _ ( ' Ask before closing a group chat tab/window. ' ) ] ,
2006-10-14 11:32:10 +00:00
' confirm_close_muc_rooms ' : [ opt_str , ' ' , _ ( ' Always ask before closing group chat tab/window in this space separated list of group chat jids. ' ) ] ,
' noconfirm_close_muc_rooms ' : [ opt_str , ' ' , _ ( ' Never ask before closing group chat tab/window in this space separated list of group chat jids. ' ) ] ,
2006-03-04 00:25:36 +00:00
' notify_on_file_complete ' : [ opt_bool , True ] ,
' file_transfers_port ' : [ opt_int , 28011 ] ,
2007-01-28 19:11:39 +00:00
' ft_add_hosts_to_send ' : [ opt_str , ' ' , _ ( ' Comma separated list of hosts that we send, in addition of local interfaces, for File Transfer in case of address translation/port forwarding. ' ) ] ,
2005-08-11 22:06:26 +00:00
' conversation_font ' : [ opt_str , ' ' ] ,
2005-09-03 13:48:25 +00:00
' use_kib_mib ' : [ opt_bool , False , _ ( ' IEC standard says KiB = 1024 bytes, KB = 1000 bytes. ' ) ] ,
2005-08-09 19:56:49 +00:00
' notify_on_all_muc_messages ' : [ opt_bool , False ] ,
2006-11-03 19:52:39 +00:00
' trayicon_notification_on_events ' : [ opt_bool , True , _ ( ' Notify of events in the system trayicon. ' ) ] ,
2005-08-23 13:22:14 +00:00
' last_save_dir ' : [ opt_str , ' ' ] ,
' last_send_dir ' : [ opt_str , ' ' ] ,
' last_emoticons_dir ' : [ opt_str , ' ' ] ,
' last_sounds_dir ' : [ opt_str , ' ' ] ,
2005-09-04 18:54:41 +00:00
' tabs_position ' : [ opt_str , ' top ' ] ,
2006-05-03 13:34:58 +00:00
' tabs_always_visible ' : [ opt_bool , False , _ ( ' Show tab when only one conversation? ' ) ] ,
2006-05-15 16:35:49 +00:00
' tabs_border ' : [ opt_bool , False , _ ( ' Show tabbed notebook border in chat windows? ' ) ] ,
2005-09-03 13:48:25 +00:00
' tabs_close_button ' : [ opt_bool , True , _ ( ' Show close button in tab? ' ) ] ,
2007-12-12 08:44:46 +00:00
' log_encrypted_sessions ' : [ opt_bool , False , _ ( ' When negotiating an encrypted session, should Gajim assume you want your messages to be logged? ' ) ] ,
' e2e_public_key ' : [ opt_bool , False , _ ( ' When negotiating an encrypted session, should Gajim prefer to use public keys for identification? ' ) ] ,
2005-11-08 13:04:59 +00:00
' chat_avatar_width ' : [ opt_int , 52 ] ,
' chat_avatar_height ' : [ opt_int , 52 ] ,
2005-11-16 23:10:48 +00:00
' roster_avatar_width ' : [ opt_int , 32 ] ,
' roster_avatar_height ' : [ opt_int , 32 ] ,
2006-02-06 13:42:23 +00:00
' tooltip_avatar_width ' : [ opt_int , 125 ] ,
' tooltip_avatar_height ' : [ opt_int , 125 ] ,
2006-03-08 16:01:01 +00:00
' vcard_avatar_width ' : [ opt_int , 200 ] ,
' vcard_avatar_height ' : [ opt_int , 200 ] ,
2007-08-09 15:39:18 +00:00
' notification_preview_message ' : [ opt_bool , True , _ ( ' Preview new messages in notification popup? ' ) ] ,
2006-01-21 21:11:29 +00:00
' notification_position_x ' : [ opt_int , - 1 ] ,
' notification_position_y ' : [ opt_int , - 1 ] ,
2006-01-17 09:01:59 +00:00
' notification_avatar_width ' : [ opt_int , 48 ] ,
' notification_avatar_height ' : [ opt_int , 48 ] ,
2006-10-12 02:12:10 +00:00
' muc_highlight_words ' : [ opt_str , ' ' , _ ( ' A semicolon-separated list of words that will be highlighted in group chats. ' ) ] ,
2005-10-04 12:43:32 +00:00
' 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. ' ) ] ,
2007-01-05 17:20:58 +00:00
' check_if_gajim_is_default ' : [ opt_bool , True , _ ( ' If True, Gajim will check if it \' s the default jabber client on each startup. ' ) ] ,
2005-09-08 02:08:31 +00:00
' 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. ' ) ] ,
2006-09-14 16:48:03 +00:00
' 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 ] ,
2006-03-04 00:25:36 +00:00
' show_avatars_in_roster ' : [ opt_bool , True , ' ' , True ] ,
2008-01-01 23:51:28 +00:00
' avatar_position_in_roster ' : [ opt_str , ' right ' , _ ( ' Define the position of the avatar in roster. Can be left or right ' ) , True ] ,
2005-12-02 19:59:39 +00:00
' 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. ' ) ] ,
2006-05-03 13:22:05 +00:00
' 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. ' ) ] ,
2007-01-02 12:49:18 +00:00
' 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. ' ) ] ,
2005-11-28 21:15:23 +00:00
' log_contact_status_changes ' : [ opt_bool , False ] ,
2006-11-20 08:03:05 +00:00
' just_connected_bg_color ' : [ opt_str , ' #adc3c6 ' , _ ( ' Background color of contacts when they just signed in. ' ) ] ,
' just_disconnected_bg_color ' : [ opt_str , ' #ab6161 ' , _ ( ' Background color of contacts when they just signed out. ' ) ] ,
2005-11-24 00:17:28 +00:00
' restored_messages_color ' : [ opt_str , ' grey ' ] ,
2006-09-14 16:48:03 +00:00
' restored_messages_small ' : [ opt_bool , True , _ ( ' If True, restored messages will use a smaller font than the default one. ' ) ] ,
2006-05-08 14:50:38 +00:00
' hide_avatar_of_transport ' : [ opt_bool , False , _ ( ' Don \' t show avatar for the transport itself. ' ) ] ,
2006-09-26 15:57:47 +00:00
' roster_window_skip_taskbar ' : [ opt_bool , False , _ ( ' Don \' t show roster in the system taskbar. ' ) ] ,
2005-12-30 21:37:36 +00:00
' 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. ' ) ] ,
' notification_timeout ' : [ opt_int , 5 ] ,
2006-10-12 02:12:10 +00:00
' 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. ' ) ] ,
2006-01-11 08:44:38 +00:00
' one_message_window ' : [ opt_str , ' always ' ,
2006-09-14 16:48:03 +00:00
#always, never, peracct, pertype should not be translated
Merge one_window branch
Merged revisions 9143,9145-9155,9157-9162,9164-9169,9171-9177 via svnmerge from
svn://88.191.11.156/gajim/branches/one_window
........
r9145 | nicfit | 2007-12-13 21:49:09 -0700 (Thu, 13 Dec 2007) | 2 lines
Implemented the original Nikos patch with an HPaned instead of a HBox and only do this mode when one_message_window == 'always'
........
r9152 | nicfit | 2007-12-15 13:33:56 -0700 (Sat, 15 Dec 2007) | 2 lines
Added config and GUI for one_message_window_with_roster
........
r9153 | nicfit | 2007-12-15 13:41:46 -0700 (Sat, 15 Dec 2007) | 2 lines
Use one_message_window_with_roster and some whitespace cleanup
........
r9154 | nicfit | 2007-12-15 14:04:49 -0700 (Sat, 15 Dec 2007) | 2 lines
Scratch the chckbox for with roster mode, use one_message_window opt and combo
........
r9155 | nicfit | 2007-12-15 17:01:13 -0700 (Sat, 15 Dec 2007) | 2 lines
MessageWindowMgr knows about ONE_MESSAGE_WINDOW_ALWAYS_WITH_ROSTER and MessageWindow can reparent itself rather then the roster having to do so.
........
r9157 | nicfit | 2007-12-15 17:47:20 -0700 (Sat, 15 Dec 2007) | 2 lines
Resizing fixes and make the roster window shrink when last tab is removed
........
r9158 | nicfit | 2007-12-15 19:15:11 -0700 (Sat, 15 Dec 2007) | 2 lines
Added "Show roster" (CTRL+R) to view menu when using always_with_roster to quickly hide/show the roster.
........
r9159 | nicfit | 2007-12-15 19:49:30 -0700 (Sat, 15 Dec 2007) | 2 lines
Handle window title setting in always_with_roster mode.
........
r9160 | nicfit | 2007-12-15 20:13:57 -0700 (Sat, 15 Dec 2007) | 2 lines
Removed FIXME
........
r9167 | nicfit | 2007-12-17 18:40:59 -0700 (Mon, 17 Dec 2007) | 2 lines
When roster is hidden, show it when the number of MessageWindow controls == 0
........
r9168 | nicfit | 2007-12-17 19:07:49 -0700 (Mon, 17 Dec 2007) | 2 lines
Disable hiding roster when there are no message controls open
........
r9169 | nicfit | 2007-12-17 20:41:11 -0700 (Mon, 17 Dec 2007) | 2 lines
Bunch of saved size bugs fixed
........
2007-12-18 23:42:22 +00:00
_ ( ' 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) are sent to a specific window. ' ) ] ,
2006-09-14 16:48:03 +00:00
' 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. ' ) ] ,
2007-08-09 15:39:18 +00:00
' compact_view ' : [ opt_bool , False , _ ( ' Hides the buttons in chat windows. ' ) ] ,
2006-04-10 12:16:29 +00:00
' 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 ' ) ] ,
2006-10-12 02:12:10 +00:00
' hide_groupchat_occupants_list ' : [ opt_bool , False , _ ( ' Hides the group chat occupants list in group chat window. ' ) ] ,
2006-10-17 22:26:25 +00:00
' 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. ' ) ] ,
2007-01-02 12:17:51 +00:00
' chat_merge_consecutive_nickname_indent ' : [ opt_str , ' ' , _ ( ' Indentation when using merge consecutive nickname. ' ) ] ,
2007-12-12 08:44:46 +00:00
' use_smooth_scrolling ' : [ opt_bool , True , _ ( ' Smooth scroll message in conversation window ' ) ] ,
2006-11-27 16:39:17 +00:00
' 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 ] ,
2006-09-14 16:48:03 +00:00
' ctrl_tab_go_to_next_composing ' : [ opt_bool , True , _ ( ' Ctrl-Tab go to next composing tab when none is unread. ' ) ] ,
2006-11-05 00:47:25 +00:00
' confirm_metacontacts ' : [ opt_str , ' ' , _ ( ' Should we show the confirm metacontacts creation dialog or not? Empty string means we never show the dialog. ' ) ] ,
2007-01-02 12:17:51 +00:00
' 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. ' ) ] ,
2006-12-29 18:30:18 +00:00
' use_gnomekeyring ' : [ opt_bool , True , _ ( ' If True, Gajim will use Gnome Keyring (if available) to store account passwords. ' ) ] ,
2006-12-29 18:39:33 +00:00
' show_contacts_number ' : [ opt_bool , True , _ ( ' If True, Gajim will show number of online and total contacts in account and group rows. ' ) ] ,
2007-01-05 20:38:36 +00:00
' 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 ' ) ] ,
2007-03-17 08:14:25 +00:00
' 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. ' ) ] ,
2007-06-03 10:04:20 +00:00
' use_latex ' : [ opt_bool , False , _ ( ' If True, Gajim will convert string between $$ and $$ to an image using dvips and convert before insterting it in chat window. ' ) ] ,
' change_status_window_timeout ' : [ opt_int , 15 , _ ( ' Time of inactivity needed before the change status window closes down. ' ) ] ,
2007-08-09 15:39:18 +00:00
' max_conversation_lines ' : [ opt_int , 500 , _ ( ' Maximum number of lines that are printed in conversations. Oldest lines are cleared. ' ) ] ,
2007-12-12 08:44:46 +00:00
' attach_notifications_to_systray ' : [ opt_bool , False , _ ( ' If True, notification windows from notification-daemon will be attached to systray icon. ' ) ] ,
2008-04-15 09:35:36 +00:00
' check_idle_every_foo_seconds ' : [ opt_int , 2 , _ ( ' Choose interval between 2 checks of idleness. ' ) ] ,
2005-04-14 07:28:59 +00:00
}
__options_per_key = {
' accounts ' : ( {
2006-03-04 00:25:36 +00:00
' name ' : [ opt_str , ' ' , ' ' , True ] ,
' hostname ' : [ opt_str , ' ' , ' ' , True ] ,
2005-04-16 14:50:26 +00:00
' savepass ' : [ opt_bool , False ] ,
2005-04-14 07:28:59 +00:00
' password ' : [ opt_str , ' ' ] ,
2006-03-04 00:25:36 +00:00
' resource ' : [ opt_str , ' gajim ' , ' ' , True ] ,
' priority ' : [ opt_int , 5 , ' ' , True ] ,
2006-10-04 00:10:49 +00:00
' 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_chat ' : [ opt_int , 50 ] ,
' autopriority_away ' : [ opt_int , 40 ] ,
' autopriority_xa ' : [ opt_int , 30 ] ,
' autopriority_dnd ' : [ opt_int , 20 ] ,
' autopriority_invisible ' : [ opt_int , 10 ] ,
2006-03-04 00:25:36 +00:00
' autoconnect ' : [ opt_bool , False , ' ' , True ] ,
2008-03-30 11:50:59 +00:00
' autoconnect_as ' : [ opt_str , ' online ' , _ ( ' Status used to autoconnect as. Can be online, chat, away, xa, dnd, invisible. ' ) , True ] ,
2005-09-06 06:18:35 +00:00
' autoreconnect ' : [ opt_bool , True ] ,
2005-09-07 23:55:40 +00:00
' active ' : [ opt_bool , True ] ,
2006-03-04 00:25:36 +00:00
' proxy ' : [ opt_str , ' ' , ' ' , True ] ,
' keyid ' : [ opt_str , ' ' , ' ' , True ] ,
2007-12-12 08:44:46 +00:00
' gpg_sign_presence ' : [ opt_bool , True , _ ( ' If disabled, don \' t sign presences with GPG key, even if GPG is configured. ' ) ] ,
2006-03-04 00:25:36 +00:00
' keyname ' : [ opt_str , ' ' , ' ' , True ] ,
2008-02-04 21:38:36 +00:00
' connection_types ' : [ opt_str , ' tls ssl plain ' , _ ( ' Ordered list (space separated) of connection type to try. Can contain tls, ssl or plain ' ) ] ,
' warn_when_insecure_connection ' : [ opt_bool , True , _ ( ' Show a warning dialog before sending password on an insecure connection. ' ) ] ,
2007-12-12 08:44:46 +00:00
' ssl_fingerprint_sha1 ' : [ opt_str , ' ' , ' ' , True ] ,
2008-02-15 10:11:17 +00:00
' ignore_ssl_errors ' : [ opt_str , ' ' , _ ( ' Space separated list of ssl errors to ignore. ' ) ] ,
2006-03-04 00:25:36 +00:00
' use_srv ' : [ opt_bool , True , ' ' , True ] ,
' use_custom_host ' : [ opt_bool , False , ' ' , True ] ,
' custom_port ' : [ opt_int , 5222 , ' ' , True ] ,
' custom_host ' : [ opt_str , ' ' , ' ' , True ] ,
' sync_with_global_status ' : [ opt_bool , False , ] ,
2005-04-14 07:28:59 +00:00
' no_log_for ' : [ opt_str , ' ' ] ,
2007-08-09 15:39:18 +00:00
' minimized_gc ' : [ opt_str , ' ' ] ,
2005-05-29 21:34:01 +00:00
' attached_gpg_keys ' : [ opt_str , ' ' ] ,
2005-06-25 23:25:17 +00:00
' keep_alives_enabled ' : [ opt_bool , True ] ,
2005-09-02 21:13:52 +00:00
# send keepalive every N seconds of inactivity
2005-07-25 00:32:02 +00:00
' keep_alive_every_foo_secs ' : [ opt_int , 55 ] ,
2008-02-08 07:47:35 +00:00
' time_for_keep_alive_answer ' : [ opt_int , 20 , _ ( ' How many seconds to wait for the answer of keepalive packet before we try to reconnect. ' ) ] ,
2005-06-25 23:25:17 +00:00
# try for 2 minutes before giving up (aka. timeout after those seconds)
2005-07-25 00:32:02 +00:00
' try_connecting_for_foo_secs ' : [ opt_int , 60 ] ,
2005-08-05 13:29:39 +00:00
' http_auth ' : [ opt_str , ' ask ' ] , # yes, no, ask
2006-03-31 18:40:10 +00:00
' dont_ack_subscription ' : [ opt_bool , False , _ ( ' Jabberd2 workaround ' ) ] ,
2005-08-11 20:27:23 +00:00
# proxy65 for FT
' file_transfer_proxies ' : [ opt_str ,
2006-04-12 09:13:38 +00:00
' proxy.jabber.org, proxy.netlab.cz, transfer.jabber.freenet.de, proxy.jabber.cd.chalmers.se ' ] ,
2006-03-27 08:28:05 +00:00
' 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 ] ,
2006-03-31 18:40:10 +00:00
' 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
2006-01-25 13:34:02 +00:00
' msgwin-width ' : [ opt_int , 480 ] ,
' msgwin-height ' : [ opt_int , 440 ] ,
2006-10-21 00:49:30 +00:00
' listen_to_network_manager ' : [ opt_bool , True ] ,
2006-09-20 22:58:43 +00:00
' is_zeroconf ' : [ opt_bool , False ] ,
' zeroconf_first_name ' : [ opt_str , ' ' , ' ' , True ] ,
' zeroconf_last_name ' : [ opt_str , ' ' , ' ' , True ] ,
' zeroconf_jabber_id ' : [ opt_str , ' ' , ' ' , True ] ,
' zeroconf_email ' : [ opt_str , ' ' , ' ' , True ] ,
2007-12-19 14:42:04 +00:00
' use_env_http_proxy ' : [ opt_bool , False ] ,
2008-05-11 17:18:44 +00:00
' otr_flags ' : [ opt_int , 58 ] ,
2008-05-30 21:43:53 +00:00
' publish_mood ' : [ opt_bool , True ] ,
' publish_activity ' : [ opt_bool , True ] ,
2008-05-31 08:28:33 +00:00
' publish_tune ' : [ opt_bool , False ] ,
2008-05-30 21:43:53 +00:00
' publish_nick ' : [ opt_bool , True ] ,
' subscribe_mood ' : [ opt_bool , True ] ,
' subscribe_activity ' : [ opt_bool , True ] ,
' subscribe_tune ' : [ opt_bool , True ] ,
' subscribe_nick ' : [ opt_bool , True ] ,
2005-04-15 11:37:56 +00:00
} , { } ) ,
' statusmsg ' : ( {
' message ' : [ opt_str , ' ' ] ,
} , { } ) ,
2006-09-14 16:48:03 +00:00
' defaultstatusmsg ' : ( {
' enabled ' : [ opt_bool , False ] ,
' message ' : [ opt_str , ' ' ] ,
} , { } ) ,
2005-04-16 14:50:26 +00:00
' soundevents ' : ( {
' enabled ' : [ opt_bool , True ] ,
' path ' : [ opt_str , ' ' ] ,
} , { } ) ,
2005-06-08 15:48:53 +00:00
' proxies ' : ( {
' type ' : [ opt_str , ' http ' ] ,
' host ' : [ opt_str , ' ' ] ,
' port ' : [ opt_int , 3128 ] ,
' user ' : [ opt_str , ' ' ] ,
2005-06-08 22:05:45 +00:00
' pass ' : [ opt_str , ' ' ] ,
2005-06-08 15:48:53 +00:00
} , { } ) ,
2005-06-13 22:11:09 +00:00
' themes ' : ( {
2006-03-04 00:25:36 +00:00
' accounttextcolor ' : [ opt_color , ' black ' , ' ' , True ] ,
' accountbgcolor ' : [ opt_color , ' white ' , ' ' , True ] ,
' accountfont ' : [ opt_str , ' ' , ' ' , True ] ,
' accountfontattrs ' : [ opt_str , ' B ' , ' ' , True ] ,
' grouptextcolor ' : [ opt_color , ' black ' , ' ' , True ] ,
' groupbgcolor ' : [ opt_color , ' white ' , ' ' , True ] ,
' groupfont ' : [ opt_str , ' ' , ' ' , True ] ,
' groupfontattrs ' : [ opt_str , ' I ' , ' ' , True ] ,
' contacttextcolor ' : [ opt_color , ' black ' , ' ' , True ] ,
' contactbgcolor ' : [ opt_color , ' white ' , ' ' , True ] ,
' contactfont ' : [ opt_str , ' ' , ' ' , True ] ,
' contactfontattrs ' : [ opt_str , ' ' , ' ' , True ] ,
' bannertextcolor ' : [ opt_color , ' black ' , ' ' , True ] ,
' bannerbgcolor ' : [ opt_color , ' ' , ' ' , True ] ,
' bannerfont ' : [ opt_str , ' ' , ' ' , True ] ,
' bannerfontattrs ' : [ opt_str , ' B ' , ' ' , True ] ,
2006-03-01 11:03:56 +00:00
2005-09-05 00:08:52 +00:00
# http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html
' state_inactive_color ' : [ opt_color , ' grey62 ' ] ,
' state_composing_color ' : [ opt_color , ' green4 ' ] ,
' state_paused_color ' : [ opt_color , ' mediumblue ' ] ,
' state_gone_color ' : [ opt_color , ' grey ' ] ,
2005-09-14 00:51:26 +00:00
# MUC chat states
2006-03-18 22:40:26 +00:00
' state_muc_msg_color ' : [ opt_color , ' mediumblue ' ] ,
' state_muc_directed_msg_color ' : [ opt_color , ' red2 ' ] ,
2005-06-13 22:11:09 +00:00
} , { } ) ,
2006-04-15 08:10:24 +00:00
' contacts ' : ( {
2008-01-10 22:45:53 +00:00
' gpg_enabled ' : [ opt_bool , False , _ ( ' Is OpenPGP enabled for this contact? ' ) ] ,
2006-09-14 16:48:03 +00:00
' speller_language ' : [ opt_str , ' ' , _ ( ' Language for which we want to check misspelled words ' ) ] ,
2008-05-09 12:35:25 +00:00
' otr_flags ' : [ opt_int , - 1 ] ,
2006-09-14 16:48:03 +00:00
} , { } ) ,
' rooms ' : ( {
' speller_language ' : [ opt_str , ' ' , _ ( ' Language for which we want to check misspelled words ' ) ] ,
} , { } ) ,
' notifications ' : ( {
' event ' : [ opt_str , ' ' ] ,
' recipient_type ' : [ opt_str , ' all ' ] ,
' recipients ' : [ opt_str , ' ' ] ,
' status ' : [ opt_str , ' all ' , _ ( ' all or space separated status ' ) ] ,
' tab_opened ' : [ opt_str , ' both ' , _ ( " ' yes ' , ' no ' , or ' both ' " ) ] ,
' sound ' : [ opt_str , ' ' , _ ( " ' yes ' , ' no ' or ' ' " ) ] ,
' sound_file ' : [ opt_str , ' ' ] ,
' popup ' : [ opt_str , ' ' , _ ( " ' yes ' , ' no ' or ' ' " ) ] ,
' auto_open ' : [ opt_str , ' ' , _ ( " ' yes ' , ' no ' or ' ' " ) ] ,
' run_command ' : [ opt_bool , False ] ,
' command ' : [ opt_str , ' ' ] ,
' systray ' : [ opt_str , ' ' , _ ( " ' yes ' , ' no ' or ' ' " ) ] ,
' roster ' : [ opt_str , ' ' , _ ( " ' yes ' , ' no ' or ' ' " ) ] ,
' urgency_hint ' : [ opt_bool , False ] ,
2006-04-15 08:10:24 +00:00
} , { } ) ,
2005-04-14 07:28:59 +00:00
}
2005-04-16 14:50:26 +00:00
statusmsg_default = {
2005-07-06 12:19:04 +00:00
_ ( ' Sleeping ' ) : ' ZZZZzzzzzZZZZZ ' ,
2005-06-06 10:51:24 +00:00
_ ( ' Back soon ' ) : _ ( ' Back in some minutes. ' ) ,
_ ( ' Eating ' ) : _ ( " I ' m eating, so leave me a message. " ) ,
_ ( ' Movie ' ) : _ ( " I ' m watching a movie. " ) ,
_ ( ' Working ' ) : _ ( " I ' m working. " ) ,
_ ( ' Phone ' ) : _ ( " I ' m on the phone. " ) ,
2006-10-04 00:10:49 +00:00
_ ( ' Out ' ) : _ ( " I ' m out enjoying life. " ) ,
2005-04-16 14:50:26 +00:00
}
2006-09-14 16:48:03 +00:00
defaultstatusmsg_default = {
2006-10-04 00:10:49 +00:00
' online ' : [ False , _ ( " I ' m available. " ) ] ,
' chat ' : [ False , _ ( " I ' m free for chat. " ) ] ,
' away ' : [ False , _ ( ' Be right back. ' ) ] ,
' xa ' : [ False , _ ( " I ' m not available. " ) ] ,
' dnd ' : [ False , _ ( ' Do not disturb. ' ) ] ,
2006-09-14 16:48:03 +00:00
' invisible ' : [ False , _ ( ' Bye! ' ) ] ,
' offline ' : [ False , _ ( ' Bye! ' ) ] ,
}
2005-04-16 14:50:26 +00:00
soundevents_default = {
2005-05-07 20:23:55 +00:00
' first_message_received ' : [ True , ' ../data/sounds/message1.wav ' ] ,
2008-01-27 20:15:17 +00:00
' next_message_received_focused ' : [ True , ' ../data/sounds/message2.wav ' ] ,
' next_message_received_unfocused ' : [ True , ' ../data/sounds/message2.wav ' ] ,
2005-05-07 20:23:55 +00:00
' contact_connected ' : [ True , ' ../data/sounds/connected.wav ' ] ,
' contact_disconnected ' : [ True , ' ../data/sounds/disconnected.wav ' ] ,
' message_sent ' : [ True , ' ../data/sounds/sent.wav ' ] ,
2006-10-12 02:12:10 +00:00
' 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. ' ) ] ,
2006-10-11 17:03:25 +00:00
' muc_message_received ' : [ False , ' ../data/sounds/gc_message2.wav ' , _ ( ' Sound to play when any MUC message arrives. ' ) ] ,
2006-11-26 09:28:12 +00:00
' gmail_received ' : [ False , ' ../data/sounds/message1.wav ' ] ,
2005-04-16 14:50:26 +00:00
}
2005-06-13 22:11:09 +00:00
themes_default = {
2005-10-29 16:56:33 +00:00
# sorted alphanum
2007-08-09 15:39:18 +00:00
_ ( ' default ' ) : [ ' ' , ' ' , ' ' , ' B ' , ' ' , ' ' , ' ' , ' I ' , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' ,
' ' , ' B ' ] ,
2006-04-10 11:44:27 +00:00
2006-01-25 23:47:15 +00:00
_ ( ' green ' ) : [ ' ' , ' #94aa8c ' , ' ' , ' B ' , ' #0000ff ' , ' #eff3e7 ' ,
' ' , ' I ' , ' #000000 ' , ' ' , ' ' , ' ' , ' ' ,
2006-04-10 11:44:27 +00:00
' #94aa8c ' , ' ' , ' B ' ] ,
2006-01-25 23:47:15 +00:00
_ ( ' grocery ' ) : [ ' ' , ' #6bbe18 ' , ' ' , ' B ' , ' #12125a ' , ' #ceefad ' ,
' ' , ' I ' , ' #000000 ' , ' #efb26b ' , ' ' , ' ' , ' ' ,
2006-04-10 11:44:27 +00:00
' #108abd ' , ' ' , ' B ' ] ,
2006-01-25 23:47:15 +00:00
_ ( ' human ' ) : [ ' ' , ' #996442 ' , ' ' , ' B ' , ' #ab5920 ' , ' #e3ca94 ' ,
' ' , ' I ' , ' #000000 ' , ' ' , ' ' , ' ' , ' ' ,
2006-04-10 11:44:27 +00:00
' #996442 ' , ' ' , ' B ' ] ,
2006-01-25 23:47:15 +00:00
_ ( ' marine ' ) : [ ' ' , ' #918caa ' , ' ' , ' B ' , ' ' , ' #e9e7f3 ' ,
' ' , ' I ' , ' #000000 ' , ' ' , ' ' , ' ' , ' ' ,
2006-04-10 11:44:27 +00:00
' #918caa ' , ' ' , ' B ' ] ,
2006-03-25 10:47:41 +00:00
2005-06-13 22:11:09 +00:00
}
2006-04-10 11:44:27 +00:00
2005-04-26 23:53:11 +00:00
def foreach ( self , cb , data = None ) :
2005-04-14 07:28:59 +00:00
for opt in self . __options :
2005-04-26 22:17:47 +00:00
cb ( data , opt , None , self . __options [ opt ] )
2005-04-14 07:28:59 +00:00
for opt in self . __options_per_key :
2005-04-26 22:17:47 +00:00
cb ( data , opt , None , None )
2005-04-14 07:28:59 +00:00
dict = self . __options_per_key [ opt ] [ 1 ]
for opt2 in dict . keys ( ) :
2005-04-26 22:17:47 +00:00
cb ( data , opt2 , [ opt ] , None )
2005-04-14 07:28:59 +00:00
for opt3 in dict [ opt2 ] :
2005-04-26 22:17:47 +00:00
cb ( data , opt3 , [ opt , opt2 ] , dict [ opt2 ] [ opt3 ] )
2005-04-14 07:28:59 +00:00
def is_valid_int ( self , val ) :
try :
ival = int ( val )
except :
2005-04-26 23:41:20 +00:00
return None
return ival
2005-04-14 07:28:59 +00:00
def is_valid_bool ( self , val ) :
2005-04-26 23:41:20 +00:00
if val == ' True ' :
return True
elif val == ' False ' :
return False
else :
ival = self . is_valid_int ( val )
if ival :
return True
2005-08-05 10:26:10 +00:00
elif ival is None :
2005-05-26 21:09:01 +00:00
return None
2005-04-26 23:41:20 +00:00
return False
2005-06-09 15:31:29 +00:00
return None
2005-04-14 07:28:59 +00:00
def is_valid_string ( self , val ) :
2005-04-26 23:41:20 +00:00
return val
2005-06-09 15:31:29 +00:00
2005-04-14 07:28:59 +00:00
def is_valid ( self , type , val ) :
2005-04-30 22:24:45 +00:00
if not type :
return None
2005-04-14 07:28:59 +00:00
if type [ 0 ] == ' boolean ' :
return self . is_valid_bool ( val )
elif type [ 0 ] == ' integer ' :
return self . is_valid_int ( val )
elif type [ 0 ] == ' string ' :
return self . is_valid_string ( val )
else :
2006-11-18 23:21:59 +00:00
if re . match ( type [ 1 ] , val ) :
2005-04-26 23:41:20 +00:00
return val
else :
return None
2005-04-14 07:28:59 +00:00
def set ( self , optname , value ) :
if not self . __options . has_key ( optname ) :
2005-08-05 23:47:41 +00:00
# raise RuntimeError, 'option %s does not exist' % optname
return
2005-04-14 07:28:59 +00:00
opt = self . __options [ optname ]
2005-04-26 23:41:20 +00:00
value = self . is_valid ( opt [ OPT_TYPE ] , value )
2005-08-05 10:26:10 +00:00
if value is None :
2005-08-05 23:47:41 +00:00
# raise RuntimeError, 'value of %s cannot be None' % optname
return
2005-06-09 15:31:29 +00:00
2005-04-14 07:28:59 +00:00
opt [ OPT_VAL ] = value
2005-06-09 15:31:29 +00:00
2005-04-16 22:12:41 +00:00
def get ( self , optname = None ) :
if not optname :
return self . __options . keys ( )
2005-04-16 14:50:26 +00:00
if not self . __options . has_key ( optname ) :
2005-04-14 07:28:59 +00:00
return None
2005-04-16 14:50:26 +00:00
return self . __options [ optname ] [ OPT_VAL ]
2005-09-03 12:28:30 +00:00
def get_desc ( self , optname ) :
if not self . __options . has_key ( optname ) :
return None
if len ( self . __options [ optname ] ) > OPT_DESC :
return self . __options [ optname ] [ OPT_DESC ]
2005-04-14 07:28:59 +00:00
2006-03-04 00:25:36 +00:00
def get_restart ( self , optname ) :
if not self . __options . has_key ( optname ) :
return None
if len ( self . __options [ optname ] ) > OPT_RESTART :
return self . __options [ optname ] [ OPT_RESTART ]
2005-04-18 23:55:13 +00:00
def add_per ( self , typename , name ) : # per_group_of_option
2005-04-14 07:28:59 +00:00
if not self . __options_per_key . has_key ( typename ) :
2005-08-05 23:47:41 +00:00
# raise RuntimeError, 'option %s does not exist' % typename
return
2005-04-14 07:28:59 +00:00
opt = self . __options_per_key [ typename ]
2005-04-26 23:41:20 +00:00
if opt [ 1 ] . has_key ( name ) :
2005-08-05 10:26:10 +00:00
# we already have added group name before
2005-08-05 10:30:22 +00:00
return ' you already have added %s before ' % name
2005-04-14 07:28:59 +00:00
opt [ 1 ] [ name ] = copy . deepcopy ( opt [ 0 ] )
2005-09-09 20:51:22 +00:00
def del_per ( self , typename , name , subname = None ) : # per_group_of_option
2005-04-14 07:28:59 +00:00
if not self . __options_per_key . has_key ( typename ) :
2005-08-05 23:47:41 +00:00
# raise RuntimeError, 'option %s does not exist' % typename
return
2005-08-06 21:19:16 +00:00
2005-04-14 07:28:59 +00:00
opt = self . __options_per_key [ typename ]
2005-09-10 09:30:46 +00:00
if subname is None :
2005-09-09 20:51:22 +00:00
del opt [ 1 ] [ name ]
# if subname is specified, delete the item in the group.
elif opt [ 1 ] [ name ] . has_key ( subname ) :
del opt [ 1 ] [ name ] [ subname ]
2005-04-14 07:28:59 +00:00
2005-04-18 23:55:13 +00:00
def set_per ( self , optname , key , subname , value ) : # per_group_of_option
2005-04-14 07:28:59 +00:00
if not self . __options_per_key . has_key ( optname ) :
2005-08-05 23:47:41 +00:00
# raise RuntimeError, 'option %s does not exist' % optname
return
2005-04-14 07:28:59 +00:00
dict = self . __options_per_key [ optname ] [ 1 ]
if not dict . has_key ( key ) :
2005-08-05 23:47:41 +00:00
# raise RuntimeError, '%s is not a key of %s' % (key, dict)
return
2005-04-14 07:28:59 +00:00
obj = dict [ key ]
if not obj . has_key ( subname ) :
2005-08-05 23:47:41 +00:00
# raise RuntimeError, '%s is not a key of %s' % (subname, obj)
return
2005-04-14 07:28:59 +00:00
subobj = obj [ subname ]
2005-04-26 23:41:20 +00:00
value = self . is_valid ( subobj [ OPT_TYPE ] , value )
2005-08-05 10:26:10 +00:00
if value is None :
2005-08-05 23:47:41 +00:00
# raise RuntimeError, '%s of %s cannot be None' % optname
return
2005-04-14 07:28:59 +00:00
subobj [ OPT_VAL ] = value
2005-06-09 15:31:29 +00:00
2005-04-18 23:55:13 +00:00
def get_per ( self , optname , key = None , subname = None ) : # per_group_of_option
2005-04-14 07:42:26 +00:00
if not self . __options_per_key . has_key ( optname ) :
2005-04-14 07:28:59 +00:00
return None
2005-04-14 07:42:26 +00:00
dict = self . __options_per_key [ optname ] [ 1 ]
2005-04-14 07:28:59 +00:00
if not key :
return dict . keys ( )
if not dict . has_key ( key ) :
return None
obj = dict [ key ]
if not subname :
return obj
if not obj . has_key ( subname ) :
return None
2005-04-14 11:06:58 +00:00
return obj [ subname ] [ OPT_VAL ]
2005-04-14 07:28:59 +00:00
2006-03-04 00:25:36 +00:00
def get_desc_per ( self , optname , key = None , subname = None ) :
if not self . __options_per_key . has_key ( optname ) :
return None
dict = self . __options_per_key [ optname ] [ 1 ]
if not key :
return None
if not dict . has_key ( key ) :
return None
obj = dict [ key ]
if not subname :
return None
if not obj . has_key ( subname ) :
return None
if len ( obj [ subname ] ) > OPT_DESC :
return obj [ subname ] [ OPT_DESC ]
return None
def get_restart_per ( self , optname , key = None , subname = None ) :
if not self . __options_per_key . has_key ( optname ) :
return False
dict = self . __options_per_key [ optname ] [ 1 ]
if not key :
return False
if not dict . has_key ( key ) :
return False
obj = dict [ key ]
if not subname :
return False
if not obj . has_key ( subname ) :
return False
if len ( obj [ subname ] ) > OPT_RESTART :
return obj [ subname ] [ OPT_RESTART ]
return False
2005-04-14 07:28:59 +00:00
def __init__ ( self ) :
2005-04-16 14:50:26 +00:00
#init default values
2005-04-16 15:01:06 +00:00
for event in self . soundevents_default :
default = self . soundevents_default [ event ]
self . add_per ( ' soundevents ' , event )
2005-08-05 10:26:10 +00:00
self . set_per ( ' soundevents ' , event , ' enabled ' , default [ 0 ] )
2005-04-16 15:01:06 +00:00
self . set_per ( ' soundevents ' , event , ' path ' , default [ 1 ] )
2005-08-06 20:18:44 +00:00
2006-09-14 16:48:03 +00:00
for status in self . defaultstatusmsg_default :
default = self . defaultstatusmsg_default [ status ]
self . add_per ( ' defaultstatusmsg ' , status )
self . set_per ( ' defaultstatusmsg ' , status , ' enabled ' , default [ 0 ] )
self . set_per ( ' defaultstatusmsg ' , status , ' message ' , default [ 1 ] )