examples/transports.lua
changeset 8 fc9060b9b7cc
child 9 c2517f8bf647
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/transports.lua	Wed Feb 25 22:58:34 2009 +0200
@@ -0,0 +1,33 @@
+-- TRANSPORTED BUDDIES AVAILABILITY INDICATION
+
+transport_jids = { 'icq.jabber.kiev.ua', 'mrim.unixzone.org.ua' }
+
+hooks_d['hook-status-change'].transports =
+	function ( args )
+		for k, jid in pairs ( transport_jids ) do
+			if args.jid == jid then
+				if args.new_status == '_' then
+					main.run ( ("color roster * *@%s red"):format ( jid ) )
+					main.run ( ("color roster dn_? *@%s red"):format ( jid ) )
+				else
+					main.run ( ("color roster * *@%s white"):format ( jid ) )
+					main.run ( ("color roster dn_? *@%s brightblack"):format ( jid ) )
+				end
+			end
+		end
+	end
+
+hooks_d['hook-start'].transports =
+	function ( args )
+		for k, jid in pairs ( transport_jids ) do
+			if not online ( jid ) then
+				main.run ( ("color roster * *@%s red"):format ( jid ) )
+				main.run ( ("color roster dn_? *@%s red"):format ( jid ) )
+			else
+				main.run ( ("color roster * *@%s white"):format ( jid ) )
+				main.run ( ("color roster dn_? *@%s brightblack"):format ( jid ) )
+			end
+		end
+	end
+
+-- vim: se ts=4: --