examples/muc.lua
changeset 99 ed4676536ed9
parent 77 8a7f7829f4df
child 111 5bcdb71ef2f2
equal deleted inserted replaced
98:59aeae623ac6 99:ed4676536ed9
     2 local lm  = require 'lm'
     2 local lm  = require 'lm'
     3 local muc = require 'lm.muc'
     3 local muc = require 'lm.muc'
     4 
     4 
     5 main.command ( 'room-config',
     5 main.command ( 'room-config',
     6 	function ( args )
     6 	function ( args )
       
     7 		local connection = main.connection ()
       
     8 		if not connection then
       
     9 			print "You are not online!"
       
    10 			return
       
    11 		end
     7 		local who
    12 		local who
     8 		if args then
    13 		if args then
     9 			who = args
    14 			who = args
    10 		else
    15 		else
    11 			who = main.current_buddy ()
    16 			who = main.current_buddy ()
    12 		end
    17 		end
    13 		local conn = lm.connection.bless ( main.connection () )
    18 		local conn = lm.connection.bless ( connection )
    14 		muc.owner_config ( conn, who,
    19 		muc.owner_config ( conn, who,
    15 			function ( form, submit, reject )
    20 			function ( form, submit, reject )
    16 				insert_form ( form,
    21 				insert_form ( form,
    17 					function ( form )
    22 					function ( form )
    18 						submit ( form,
    23 						submit ( form,
    38 			end )
    43 			end )
    39 	end, false, 'jid' )
    44 	end, false, 'jid' )
    40 
    45 
    41 commands_help['room-config'] = "[room_jid]\n\nRequests room configuration form from server. You must be owner of this room."
    46 commands_help['room-config'] = "[room_jid]\n\nRequests room configuration form from server. You must be owner of this room."
    42 
    47 
    43 -- vim: se ts=4: --
    48 -- vim: se ts=4 sw=4: --