# HG changeset patch # User Mikael Berthe # Date 1214068470 -7200 # Node ID da4bef36c34fedb1ca23f4d2c9a1dc83579ea915 # Parent 7e59e32f24022e85016ccb6f8851ed5cb804a64b Add option snd_cmd_msg_in diff -r 7e59e32f2402 -r da4bef36c34f mcevent.cfg --- a/mcevent.cfg Sat Jun 21 16:35:53 2008 +0200 +++ b/mcevent.cfg Sat Jun 21 19:14:30 2008 +0200 @@ -4,6 +4,7 @@ sound: 1 short_nick: 1 #unread_file: /tmp/event.unread +#snd_cmd_msg_in = /usr/bin/play -V0 -v3 sound.wav [Contacts] #jid@domain.org: name diff -r 7e59e32f2402 -r da4bef36c34f mcevent.py --- a/mcevent.py Sat Jun 21 16:35:53 2008 +0200 +++ b/mcevent.py Sat Jun 21 19:14:30 2008 +0200 @@ -20,6 +20,7 @@ 'use_sound': 1, 'short_nick': 1, 'unread_file': '', + 'snd_cmd_msg_in': '/usr/bin/play -V0 -v3 sound.wav', } NOTIFY_TIMEOUT=4000 @@ -36,7 +37,6 @@ blacklist = { } # No notification for these JIDs -CMD_MSG_IN="/usr/bin/play -V0 -v3 sound.wav" CMD_ESPEAK="/usr/bin/espeak" def init_notify(): @@ -50,6 +50,8 @@ def read_conf_from_file(): import ConfigParser + # TODO: Do not re-read file if it hasn't been touched + config = ConfigParser.ConfigParser() config.read(CONFFILE) @@ -68,6 +70,8 @@ opt['short_nick'] = int(config.get("Notifications", "short_nick")) if config.has_option("Notifications", "unread_file"): opt['unread_file'] = config.get("Notifications", "unread_file") + if config.has_option("Notifications", "snd_cmd_msg_in"): + opt['snd_cmd_msg_in'] = config.get("Notifications", "snd_cmd_msg_in") for id in config.options("Contacts"): contact_map[id] = config.get("Contacts", id) @@ -151,7 +155,7 @@ notify(buddy, textmsg, NOTIFY_TIMEOUT) if opt['use_sound']: - os.system(CMD_MSG_IN + '> /dev/null 2>&1') + os.system(opt['snd_cmd_msg_in'] + '> /dev/null 2>&1') if opt['use_voice'] and not is_blacklisted(jid): if jid in voicemap: @@ -169,7 +173,7 @@ type = online_alerts[jid] if type > 0: if opt['use_sound']: - os.system(CMD_MSG_IN + '> /dev/null 2>&1') + os.system(opt['snd_cmd_msg_in'] + '> /dev/null 2>&1') buddy = get_nick(jid)