Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-02-16 08:28:33 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2018-02-16 08:28:33 +0300
commit32e5a3255dbd0f2a6e0fdb011311e4466caf641a (patch)
tree7addae39257edc6c5854a594ac56acb37a309f4a
parentc102a45fac3748b1dc7c670056847fdb12cbff4d (diff)
Export aux functions from mod_muc_room
-rw-r--r--src/mod_muc_room.erl33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl
index 646d0fdd7..417bd4a15 100644
--- a/src/mod_muc_room.erl
+++ b/src/mod_muc_room.erl
@@ -37,7 +37,9 @@
get_role/2,
get_affiliation/2,
is_occupant_or_admin/2,
- route/2]).
+ route/2,
+ expand_opts/1,
+ config_fields/0]).
%% gen_fsm callbacks
-export([init/1,
@@ -3568,6 +3570,35 @@ make_opts(StateData) ->
{subject_author, StateData#state.subject_author},
{subscribers, Subscribers}].
+expand_opts(CompactOpts) ->
+ DefConfig = #config{},
+ Fields = record_info(fields, config),
+ {_, Opts1} =
+ lists:foldl(
+ fun(Field, {Pos, Opts}) ->
+ case lists:keyfind(Field, 1, CompactOpts) of
+ false ->
+ DefV = element(Pos, DefConfig),
+ DefVal = case (?SETS):is_set(DefV) of
+ true -> (?SETS):to_list(DefV);
+ false -> DefV
+ end,
+ {Pos+1, [{Field, DefVal}|Opts]};
+ {_, Val} ->
+ {Pos+1, [{Field, Val}|Opts]}
+ end
+ end, {2, []}, Fields),
+ SubjectAuthor = proplists:get_value(subject_author, CompactOpts, <<"">>),
+ Subject = proplists:get_value(subject, CompactOpts, <<"">>),
+ Subscribers = proplists:get_value(subscribers, CompactOpts, []),
+ [{subject, Subject},
+ {subject_author, SubjectAuthor},
+ {subscribers, Subscribers}
+ | lists:reverse(Opts1)].
+
+config_fields() ->
+ [subject, subject_author, subscribers | record_info(fields, config)].
+
-spec destroy_room(muc_destroy(), state()) -> {result, undefined, stop}.
destroy_room(DEl, StateData) ->
Destroy = DEl#muc_destroy{xmlns = ?NS_MUC_USER},