]> granicus.if.org Git - ejabberd/commitdiff
Fix mod_muc_admin:get_room_options
authorgenric <genrich.ivaska@epfl.ch>
Tue, 5 Apr 2016 12:13:28 +0000 (14:13 +0200)
committergenric <genrich.ivaska@epfl.ch>
Tue, 5 Apr 2016 12:13:28 +0000 (14:13 +0200)
Fix mod_muc_admin:get_room_options to match the ejabberd_commands result spec.

src/mod_muc_admin.erl

index 7c6e84c453905c94493cef0d432127abba2a0e53..037f260067a41ae1d92dc1f23c4f0bc48d35ae57 100644 (file)
@@ -824,8 +824,12 @@ get_room_options(Pid) ->
     get_options(Config).
 
 get_options(Config) ->
-    Fields = record_info(fields, config),
-    [config | Values] = tuple_to_list(Config),
+    Fields = [jlib:atom_to_binary(Field) || Field <- record_info(fields, config)],
+    [config | ValuesRaw] = tuple_to_list(Config),
+    Values = lists:map(fun(V) when is_atom(V) -> jlib:atom_to_binary(V);
+                          (V) when is_integer(V) -> jlib:integer_to_binary(V);
+                          (V) when is_tuple(V); is_list(V) -> list_to_binary(hd(io_lib:format("~w", [V])));
+                          (V) -> V end, ValuesRaw),
     lists:zip(Fields, Values).
 
 %%----------------------------