examples/urls.lua
author Myhailo Danylenko <isbear@ukrpost.net>
Sun, 15 Mar 2009 02:36:14 +0200
changeset 21 2384ce322282
parent 8 fc9060b9b7cc
child 31 54957980a83a
permissions -rw-r--r--
Pep improvements * Send empty only if changed * Incoming mood and activity handlers

-- SAVING URLS TO FILE

url_file = main.config_file ( 'urls.log' )

hooks_d['hook-message-in'].urls =
	function ( args )
		for url in args.message:gmatch ( "https?://[%w%p]+" ) do
			fd = io.open ( url_file, "a" )
			if fd then
				fd:write ( url .. "\n" )
				fd:close ()
			else
				print 'Cannot open urls log file'
			end
		end
	end

-- vim: se ts=4: --