format_result(Binary, {_Name, string}) when is_binary(Binary) ->
io_lib:format("~s", [binary_to_list(Binary)]);
+format_result(Atom, {_Name, string}) when is_atom(Atom) ->
+ io_lib:format("~s", [atom_to_list(Atom)]);
+
+format_result(Integer, {_Name, string}) when is_integer(Integer) ->
+ io_lib:format("~s", [integer_to_list(Integer)]);
+
+format_result(Other, {_Name, string}) ->
+ io_lib:format("~p", [Other]);
+
format_result(Code, {_Name, rescode}) ->
make_status(Code);
{struct, [{Name, lists:flatten(String)}]};
format_result(Binary, {Name, string}) when is_binary(Binary) ->
{struct, [{Name, binary_to_list(Binary)}]};
+format_result(Atom, {Name, string}) when is_atom(Atom) ->
+ {struct, [{Name, atom_to_list(Atom)}]};
+format_result(Integer, {Name, string}) when is_integer(Integer) ->
+ {struct, [{Name, integer_to_list(Integer)}]};
+format_result(Other, {Name, string}) ->
+ {struct, [{Name, io_lib:format("~p", [Other])}]};
format_result(String, {Name, binary}) when is_list(String) ->
{struct, [{Name, lists:flatten(String)}]};
format_result(Binary, {Name, binary}) when is_binary(Binary) ->
get_room_occupants_number/2,
send_direct_invitation/4,
change_room_option/4,
+ get_room_options/2,
set_room_affiliation/4,
get_room_affiliations/2,
web_menu_main/2, web_page_main/2, % Web Admin API
args = [{name, binary}, {service, binary},
{option, binary}, {value, binary}],
result = {res, rescode}},
+ #ejabberd_commands{name = get_room_options, tags = [muc_room],
+ desc = "Get options from a MUC room",
+ module = ?MODULE, function = get_room_options,
+ args = [{name, binary}, {service, binary}],
+ result = {options, {list,
+ {option, {tuple,
+ [{name, string},
+ {value, string}
+ ]}}
+ }}},
#ejabberd_commands{name = set_room_affiliation, tags = [muc_room],
desc = "Change an affiliation in a MUC room",
title -> Config#config{title = Value}
end.
+%%----------------------------
+%% Get Room Options
+%%----------------------------
+
+get_room_options(Name, Service) ->
+ Pid = get_room_pid(Name, Service),
+ get_room_options(Pid).
+
+get_room_options(Pid) ->
+ Config = get_room_config(Pid),
+ get_options(Config).
+
+get_options(Config) ->
+ Fields = record_info(fields, config),
+ [config | Values] = tuple_to_list(Config),
+ lists:zip(Fields, Values).
%%----------------------------
%% Get Room Affiliations