examples/vcard.lua
changeset 99 ed4676536ed9
parent 70 e43e386c8a33
child 121 75a7d595817c
equal deleted inserted replaced
98:59aeae623ac6 99:ed4676536ed9
     4 local base64 = require 'base64'
     4 local base64 = require 'base64'
     5 local mime   = require 'mime-type'
     5 local mime   = require 'mime-type'
     6 
     6 
     7 main.command ( 'vcard-temp',
     7 main.command ( 'vcard-temp',
     8 	function ( args )
     8 	function ( args )
       
     9 		local connection = main.connection ()
       
    10 		if not connection then
       
    11 			print "You are not online!"
       
    12 			return
       
    13 		end
     9 		local who
    14 		local who
    10 		local action = args[1]
    15 		local action = args[1]
    11 		local conn   = lm.connection.bless ( main.connection () )
    16 		local conn   = lm.connection.bless ( connection )
    12 		if not action then
    17 		if not action then
    13 			who = conn:jid():gsub ( '/.*', '' )
    18 			who = conn:jid():gsub ( '/.*', '' )
    14 		elseif action == 'photo' then
    19 		elseif action == 'photo' then
    15 			local file = args[2]
    20 			local file = args[2]
    16 			if not file then
    21 			if not file then
    91 			end )
    96 			end )
    92 	end, true, 'jid' )
    97 	end, true, 'jid' )
    93 
    98 
    94 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.'
    99 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.'
    95 
   100 
    96 -- vim: se ts=4: --
   101 -- vim: se ts=4 sw=4: --