mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Advertise MAM in disco info for account/room JID
As per XEP-0313 version 0.2 and newer, advertise the MAM feature in the service discovery information for the bare account (or MUC room) JID. Some clients check the server's discovery information instead, so we'll continue to advertise the feature there as well.
This commit is contained in:
parent
11ad96fced
commit
5fd1aa0d04
@ -34,8 +34,8 @@
|
|||||||
-export([start/2, stop/1]).
|
-export([start/2, stop/1]).
|
||||||
|
|
||||||
-export([user_send_packet/4, user_receive_packet/5,
|
-export([user_send_packet/4, user_receive_packet/5,
|
||||||
process_iq_v0_2/3, process_iq_v0_3/3, remove_user/2,
|
process_iq_v0_2/3, process_iq_v0_3/3, disco_sm_features/5,
|
||||||
remove_user/3, mod_opt_type/1, muc_process_iq/4,
|
remove_user/2, remove_user/3, mod_opt_type/1, muc_process_iq/4,
|
||||||
muc_filter_message/5]).
|
muc_filter_message/5]).
|
||||||
|
|
||||||
-include_lib("stdlib/include/ms_transform.hrl").
|
-include_lib("stdlib/include/ms_transform.hrl").
|
||||||
@ -88,6 +88,8 @@ start(Host, Opts) ->
|
|||||||
muc_filter_message, 50),
|
muc_filter_message, 50),
|
||||||
ejabberd_hooks:add(muc_process_iq, Host, ?MODULE,
|
ejabberd_hooks:add(muc_process_iq, Host, ?MODULE,
|
||||||
muc_process_iq, 50),
|
muc_process_iq, 50),
|
||||||
|
ejabberd_hooks:add(disco_sm_features, Host, ?MODULE,
|
||||||
|
disco_sm_features, 50),
|
||||||
ejabberd_hooks:add(remove_user, Host, ?MODULE,
|
ejabberd_hooks:add(remove_user, Host, ?MODULE,
|
||||||
remove_user, 50),
|
remove_user, 50),
|
||||||
ejabberd_hooks:add(anonymous_purge_hook, Host, ?MODULE,
|
ejabberd_hooks:add(anonymous_purge_hook, Host, ?MODULE,
|
||||||
@ -130,6 +132,8 @@ stop(Host) ->
|
|||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_MAM_0),
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_MAM_0),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_MAM_1),
|
gen_iq_handler:remove_iq_handler(ejabberd_local, Host, ?NS_MAM_1),
|
||||||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_MAM_1),
|
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_MAM_1),
|
||||||
|
ejabberd_hooks:delete(disco_sm_features, Host, ?MODULE,
|
||||||
|
disco_sm_features, 50),
|
||||||
ejabberd_hooks:delete(remove_user, Host, ?MODULE,
|
ejabberd_hooks:delete(remove_user, Host, ?MODULE,
|
||||||
remove_user, 50),
|
remove_user, 50),
|
||||||
ejabberd_hooks:delete(anonymous_purge_hook, Host,
|
ejabberd_hooks:delete(anonymous_purge_hook, Host,
|
||||||
@ -276,6 +280,15 @@ get_xdata_fields(SubEl) ->
|
|||||||
[]
|
[]
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
disco_sm_features(empty, From, To, Node, Lang) ->
|
||||||
|
disco_sm_features({result, []}, From, To, Node, Lang);
|
||||||
|
disco_sm_features({result, OtherFeatures},
|
||||||
|
#jid{luser = U, lserver = S},
|
||||||
|
#jid{luser = U, lserver = S}, <<>>, _Lang) ->
|
||||||
|
{result, [?NS_MAM_TMP, ?NS_MAM_0, ?NS_MAM_1 | OtherFeatures]};
|
||||||
|
disco_sm_features(Acc, _From, _To, _Node, _Lang) ->
|
||||||
|
Acc.
|
||||||
|
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
%%% Internal functions
|
%%% Internal functions
|
||||||
%%%===================================================================
|
%%%===================================================================
|
||||||
|
@ -4144,6 +4144,13 @@ process_iq_disco_info(_From, get, Lang, StateData) ->
|
|||||||
<<"muc_moderated">>, <<"muc_unmoderated">>),
|
<<"muc_moderated">>, <<"muc_unmoderated">>),
|
||||||
?CONFIG_OPT_TO_FEATURE((Config#config.password_protected),
|
?CONFIG_OPT_TO_FEATURE((Config#config.password_protected),
|
||||||
<<"muc_passwordprotected">>, <<"muc_unsecured">>)]
|
<<"muc_passwordprotected">>, <<"muc_unsecured">>)]
|
||||||
|
++ case {gen_mod:is_loaded(StateData#state.server_host, mod_mam),
|
||||||
|
Config#config.mam} of
|
||||||
|
{true, true} ->
|
||||||
|
[?FEATURE(?NS_MAM_0)];
|
||||||
|
_ ->
|
||||||
|
[]
|
||||||
|
end
|
||||||
++ iq_disco_info_extras(Lang, StateData),
|
++ iq_disco_info_extras(Lang, StateData),
|
||||||
StateData}.
|
StateData}.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user