examples/urls.lua
author Myhailo Danylenko <isbear@ukrpost.net>
Fri, 20 Mar 2009 19:38:12 +0200
changeset 39 0d43f33243cc
parent 33 db5396037b43
child 58 aa3376776cf2
permissions -rw-r--r--
Minor aligning

-- SAVING URLS TO FILE

hooks_d['hook-message-in'].urls =
	function ( args )
		for url in args.message:gmatch ( "https?://[%w%p]+" ) do
			fd = io.open ( main.fileoption 'lua_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: --