examples/urls.lua
author Myhailo Danylenko <isbear@ukrpost.net>
Sun, 14 Mar 2010 22:10:17 +0200
changeset 95 f2f4c7810a72
parent 58 aa3376776cf2
permissions -rw-r--r--
Use new module struct with api version


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