24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-02 21:17:12 +02:00

Fix host/serverhost usage (#902)

This commit is contained in:
Christophe Romain 2016-02-26 09:33:07 +01:00
parent ebaf750a9b
commit 1c6d20924b

View File

@ -482,7 +482,7 @@ send_loop(State) ->
-> [xmlel()] -> [xmlel()]
). ).
disco_local_identity(Acc, _From, To, <<>>, _Lang) -> disco_local_identity(Acc, _From, To, <<>>, _Lang) ->
case lists:member(?PEPNODE, plugins(To#jid.lserver)) of case lists:member(?PEPNODE, plugins(host(To#jid.lserver))) of
true -> true ->
[#xmlel{name = <<"identity">>, [#xmlel{name = <<"identity">>,
attrs = [{<<"category">>, <<"pubsub">>}, attrs = [{<<"category">>, <<"pubsub">>},
@ -1236,7 +1236,7 @@ iq_get_vcard(Lang) ->
). ).
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang) -> iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang) ->
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, all, plugins(ServerHost)). iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, all, plugins(Host)).
-spec(iq_pubsub/8 :: -spec(iq_pubsub/8 ::
( (
@ -3997,16 +3997,11 @@ get_cached_item(Host, Nidx) ->
host(ServerHost) -> host(ServerHost) ->
config(ServerHost, host, <<"pubsub.", ServerHost/binary>>). config(ServerHost, host, <<"pubsub.", ServerHost/binary>>).
serverhost({_U, Server, _R})-> serverhost({_U, ServerHost, _R})->
Server; ServerHost;
serverhost(Host) -> serverhost(Host) ->
case binary:match(Host, <<"pubsub.">>) of [_, ServerHost] = binary:split(Host, <<".">>),
{0,7} -> ServerHost.
[_,ServerHost] = binary:split(Host, <<".">>),
ServerHost;
_ ->
Host
end.
tree(Host) -> tree(Host) ->
case config(serverhost(Host), nodetree) of case config(serverhost(Host), nodetree) of
@ -4062,14 +4057,14 @@ select_type(ServerHost, Host, Node, Type) ->
_ -> _ ->
Type Type
end, end,
ConfiguredTypes = plugins(ServerHost), ConfiguredTypes = plugins(Host),
case lists:member(SelectedType, ConfiguredTypes) of case lists:member(SelectedType, ConfiguredTypes) of
true -> SelectedType; true -> SelectedType;
false -> hd(ConfiguredTypes) false -> hd(ConfiguredTypes)
end. end.
select_type(ServerHost, Host, Node) -> select_type(ServerHost, Host, Node) ->
select_type(ServerHost, Host, Node, hd(plugins(ServerHost))). select_type(ServerHost, Host, Node, hd(plugins(Host))).
feature(<<"rsm">>) -> ?NS_RSM; feature(<<"rsm">>) -> ?NS_RSM;
feature(Feature) -> <<(?NS_PUBSUB)/binary, "#", Feature/binary>>. feature(Feature) -> <<(?NS_PUBSUB)/binary, "#", Feature/binary>>.