examples/shortenurl.lua
changeset 126 5f0025da31e6
parent 125 3e2421384d7a
child 127 9157566033e8
equal deleted inserted replaced
125:3e2421384d7a 126:5f0025da31e6
    35 		local replystring = ''
    35 		local replystring = ''
    36 		main.bgread ( ( curlcommand ):format ( shell_escape ( json.encode ( { longUrl = args }, encodeoptions ) ) ),
    36 		main.bgread ( ( curlcommand ):format ( shell_escape ( json.encode ( { longUrl = args }, encodeoptions ) ) ),
    37 			function ( data )
    37 			function ( data )
    38 				if not data then
    38 				if not data then
    39 					-- eof
    39 					-- eof
    40 					print ( 'lua reply: ' .. replystring )
       
    41 					local reply = json.decode ( replystring )
    40 					local reply = json.decode ( replystring )
    42 					if reply and reply.id then
    41 					if reply and reply.id then
    43 						if jid and main.yesno ( main.option ( 'lua_shorten_post_url' ) ) then
    42 						if jid and main.yesno ( main.option ( 'lua_shorten_post_url' ) ) then
    44 							main.run ( ('say_to -q %s %s'):format ( jid, reply.id ) )
    43 							main.run ( ('say_to -q %s %s'):format ( jid, reply.id ) )
    45 						else
    44 						else