examples/transports.lua
author Myhailo Danylenko <isbear@ukrpost.net>
Wed, 25 Feb 2009 22:58:34 +0200
changeset 8 fc9060b9b7cc
child 9 c2517f8bf647
permissions -rw-r--r--
Completion * commands completion * common hooks lua interface * complete separation of features into modules

-- 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: --