examples/mc_remote.lua
changeset 68 742878c74b8e
parent 67 d33ca5572e91
child 69 ab6d4ee8974c
--- a/examples/mc_remote.lua	Sat Mar 28 19:43:12 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-
-local lm     = require 'lm'
-local remote = require 'remote'
-
-main.command ( 'remote',
-	function ( args )
-		local who
-		if args.t then
-			who = args.t
-		else
-			who = main.full_jid ()
-		end
-		local action = args[1]
-		local conn   = lm.connection.bless ( main.connection () )
-		if action then
-			remote.command ( conn, who, action,
-				function ( form, submit, reject )
-					if not form then
-						main.print_info ( who, ('Command %s completed'):format ( action ) )
-					else
-						insert_form ( form, -- XXX
-							function ( form )
-								submit ( form,
-									function ()
-										main.print_info ( who, ('Command %s completed'):format ( action ) )
-									end,
-									function ( mesg )
-										main.print_info ( who, ('Command %s execution failed: %s'):format ( action, mesg ) )
-									end )
-							end,
-							function ( form )
-								reject ( form,
-									function ()
-										main.print_info ( who, ('Command %s execution cancelled'):format ( action ) )
-									end,
-									function ( mesg )
-										main.print_info ( who, ('Command %s execution cancellation failed: %s'):format ( action, mesg ) )
-									end )
-							end )
-					end
-				end,
-				function ( mesg )
-					main.print_info ( who, ('Command %s execution failed: %s'):format ( action, mesg ) )
-				end )
-		else
-			remote.list ( conn, who,
-				function ( items )
-					local text = ''
-					for index, item in ipairs ( items ) do
-						text = text .. '\n - ' .. item.node
-					end
-					if text ~= '' then
-						main.print_info ( who, 'Available commands:' .. text )
-					else
-						main.print_info ( who, 'No commands available.' )
-					end
-				end,
-				function ( mesg )
-					main.print_info ( who, ("Remote commands list for %s failed: %s"):format ( who, mesg ) )
-				end )
-		end
-	end, true, 'jid' )
-
-commands_help['remote'] = "[-t target_jid] [remote_command]\n\nPrints list of available remote command or requests execution of specified command."
-
--- vim: se ts=4: --