examples/mpd.lua
changeset 8 fc9060b9b7cc
parent 7 eb6d89bf1fbf
child 19 365e77518376
--- a/examples/mpd.lua	Tue Feb 24 19:42:48 2009 +0200
+++ b/examples/mpd.lua	Wed Feb 25 22:58:34 2009 +0200
@@ -103,6 +103,18 @@
 
 mpd_enabled = false
 
+-- XXX: to C?
+char2status = {
+	f = 'free',
+	o = 'online',
+	a = 'away',
+	d = 'dnd',
+	n = 'notavail',
+	i = 'invisible',
+	['_'] = 'offline',
+	['?'] = 'message',
+}
+
 function mpd_getstatus ()
 	if not mpd_enabled then
 		return ''
@@ -188,8 +200,16 @@
 		else
 			enable_mpd ( enable )
 		end
-	end )
+	end, boolean_cid )
 
 commands_help['mpd'] = "[enable|disable|on|off|yes|no|true|false]\n\nSets state of mpd string in your status.\nIf state is omitted, prints current state."
 
+-- XXX: why post-connect, why not start?
+hooks_d['hook-post-connect'].mpd =
+	function ( args )
+		if mpd_enabled then
+			mpd_callback ()
+		end
+	end
+
 -- vim: se ts=4: --