examples/remote.lua
changeset 99 ed4676536ed9
parent 68 742878c74b8e
child 121 75a7d595817c
--- a/examples/remote.lua	Wed Mar 31 00:28:04 2010 +0300
+++ b/examples/remote.lua	Wed Mar 31 01:25:19 2010 +0300
@@ -4,6 +4,11 @@
 
 main.command ( 'remote',
 	function ( args )
+		local connection = main.connection ()
+		if not connection then
+			print "You are not online!"
+			return
+		end
 		local who
 		if args.t then
 			who = args.t
@@ -11,7 +16,7 @@
 			who = main.full_jid ()
 		end
 		local action = args[1]
-		local conn   = lm.connection.bless ( main.connection () )
+		local conn   = lm.connection.bless ( connection )
 		if action then
 			remote.command ( conn, who, action,
 				function ( form, submit, reject )
@@ -63,4 +68,4 @@
 
 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: --
+-- vim: se ts=4 sw=4: --