examples/urls.lua
author Myhailo Danylenko <isbear@ukrpost.net>
Tue, 07 Aug 2012 20:58:31 +0300
changeset 127 9157566033e8
parent 58 aa3376776cf2
permissions -rw-r--r--
Support for goo.gl api key * option lua_shorten_googl_key * better error parsing


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