--- a/mcevent.cfg Sat Jun 21 19:52:15 2008 +0200
+++ b/mcevent.cfg Sat Jun 21 20:27:32 2008 +0200
@@ -9,6 +9,10 @@
[Contacts]
#jid@domain.org: name
+[Contact_Customized_Messages]
+#default: sent you a message.
+#jid@domain.org: is talking to you!
+
# Alerts:
# 0 = no alert
# 1 = normal alert
--- a/mcevent.py Sat Jun 21 19:52:15 2008 +0200
+++ b/mcevent.py Sat Jun 21 20:27:32 2008 +0200
@@ -29,6 +29,9 @@
contact_map = { }
# Nickname used for the notification
+contact_custom_msg = { }
+# Message used for the notification
+
online_alerts = { }
# 0: disabled 1: normal notification 2: permanent notify box
@@ -55,6 +58,7 @@
config.read(CONFFILE)
contact_map.clear()
+ contact_custom_msg.clear()
online_alerts.clear()
voicemap.clear()
blacklist.clear()
@@ -76,6 +80,10 @@
for id in config.options("Contacts"):
contact_map[id] = config.get("Contacts", id)
+ if config.has_section("Contact_Customized_Messages"):
+ for id in config.options("Contact_Customized_Messages"):
+ contact_custom_msg[id] = config.get("Contact_Customized_Messages", id)
+
if config.has_section("Alerts"):
for id in config.options("Alerts"):
online_alerts[id] = int(config.get("Alerts", id))
@@ -143,7 +151,12 @@
jid = arg2
buddy = get_nick(jid)
- msg = 'sent you a message.'
+ if jid in contact_custom_msg:
+ msg = contact_custom_msg[jid]
+ elif 'default' in contact_custom_msg:
+ msg = contact_custom_msg['default']
+ else:
+ msg = 'sent you a message.'
if not is_blacklisted(jid):
textmsg = None
@@ -221,9 +234,9 @@
sys.stderr.write("Cannot read config file!\n")
sys.exit(3)
-read_conf_from_file()
+NOTIFY_LOADED = False
-NOTIFY_LOADED = False
+read_conf_from_file()
# read stdin line by line
while 1: