examples/urls.lua
author Myhailo Danylenko <isbear@ukrpost.net>
Sat, 30 Jul 2016 05:05:19 +0300
changeset 154 e63030a181f0
parent 58 aa3376776cf2
permissions -rw-r--r--
Added tag v0.0.6 for changeset 8fba61f363a8


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