summaryrefslogtreecommitdiff
path: root/src/ejabberd_config.erl
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2015-10-08 13:07:00 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2015-10-08 13:07:00 +0200
commitb5ac0db895ba978ad40583d1484e12d9475d70e5 (patch)
tree7422af8a9819f53a709f8138989a36f67654d60f /src/ejabberd_config.erl
parentHandler module shouldn't be used for differentiating listeners when merging c... (diff)
Be able to merge old style configs with {listen,...}
Diffstat (limited to 'src/ejabberd_config.erl')
-rw-r--r--src/ejabberd_config.erl32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl
index 6245179e..8553b777 100644
--- a/src/ejabberd_config.erl
+++ b/src/ejabberd_config.erl
@@ -372,16 +372,27 @@ exit_or_halt(ExitText) ->
get_config_option_key(Name, Val) ->
if Name == listen ->
- lists:foldl(
- fun({port, Port}, {_, IP, T}) ->
- {Port, IP, T};
- ({ip, IP}, {Port, _, T}) ->
- {Port, IP, T};
- ({transport, T}, {Port, IP, _}) ->
- {Port, IP, T};
- (_, Res) ->
- Res
- end, {5222, {0,0,0,0}, tcp}, Val);
+ case Val of
+ {{Port, IP, Trans}, _Mod, _Opts} ->
+ {Port, IP, Trans};
+ {{Port, Trans}, _Mod, _Opts} when Trans == tcp; Trans == udp ->
+ {Port, {0,0,0,0}, Trans};
+ {{Port, IP}, _Mod, _Opts} ->
+ {Port, IP, tcp};
+ {Port, _Mod, _Opts} ->
+ {Port, {0,0,0,0}, tcp};
+ V when is_list(V) ->
+ lists:foldl(
+ fun({port, Port}, {_, IP, T}) ->
+ {Port, IP, T};
+ ({ip, IP}, {Port, _, T}) ->
+ {Port, IP, T};
+ ({transport, T}, {Port, IP, _}) ->
+ {Port, IP, T};
+ (_, Res) ->
+ Res
+ end, {5222, {0,0,0,0}, tcp}, Val)
+ end;
is_tuple(Val) ->
element(1, Val);
true ->
@@ -397,7 +408,6 @@ maps_to_lists(IMap) ->
[{Name, Val} | Res]
end, [], IMap).
-
merge_configs(Terms, ResMap) ->
lists:foldl(fun({Name, Val}, Map) when is_list(Val) ->
Old = maps:get(Name, Map, #{}),