examples/vcard.lua
changeset 99 ed4676536ed9
parent 70 e43e386c8a33
child 121 75a7d595817c
--- a/examples/vcard.lua	Wed Mar 31 00:28:04 2010 +0300
+++ b/examples/vcard.lua	Wed Mar 31 01:25:19 2010 +0300
@@ -6,9 +6,14 @@
 
 main.command ( 'vcard-temp',
 	function ( args )
+		local connection = main.connection ()
+		if not connection then
+			print "You are not online!"
+			return
+		end
 		local who
 		local action = args[1]
-		local conn   = lm.connection.bless ( main.connection () )
+		local conn   = lm.connection.bless ( connection )
 		if not action then
 			who = conn:jid():gsub ( '/.*', '' )
 		elseif action == 'photo' then
@@ -93,4 +98,4 @@
 
 commands_help['vcard-temp'] = '[photo filename | . | jid]\n\nObtains vcard (as a form, but you may not submit it). Without arguments obtains your own vcard. "." means current buddy.\nYou can also publish your photo from file, that will automatically get your vcard, put a data into it and submit to server.'
 
--- vim: se ts=4: --
+-- vim: se ts=4 sw=4: --