25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

mod_caps: Don't forget caps on XEP-0198 resumption

Many thanks to Thilo Molitor for spotting the issue and testing the fix.
This commit is contained in:
Holger Weiss 2021-11-06 23:48:49 +01:00
parent 4e014d23bd
commit 2cdda4cf49

View File

@ -49,7 +49,8 @@
handle_cast/2, terminate/2, code_change/3]).
-export([user_send_packet/1, user_receive_packet/1,
c2s_presence_in/2, mod_opt_type/1, mod_options/1, mod_doc/0]).
c2s_presence_in/2, c2s_copy_session/2,
mod_opt_type/1, mod_options/1, mod_doc/0]).
-include("logger.hrl").
@ -274,6 +275,13 @@ c2s_presence_in(C2SState,
C2SState#{caps_resources => NewRs}
end.
-spec c2s_copy_session(ejabberd_c2s:state(), ejabberd_c2s:state())
-> ejabberd_c2s:state().
c2s_copy_session(C2SState, #{caps_resources := Rs}) ->
C2SState#{caps_resources => Rs};
c2s_copy_session(C2SState, _) ->
C2SState.
-spec depends(binary(), gen_mod:opts()) -> [{module(), hard | soft}].
depends(_Host, _Opts) ->
[].
@ -304,6 +312,8 @@ init([Host|_]) ->
caps_stream_features, 75),
ejabberd_hooks:add(s2s_in_post_auth_features, Host, ?MODULE,
caps_stream_features, 75),
ejabberd_hooks:add(c2s_copy_session, Host, ?MODULE,
c2s_copy_session, 75),
ejabberd_hooks:add(disco_local_features, Host, ?MODULE,
disco_features, 75),
ejabberd_hooks:add(disco_local_identity, Host, ?MODULE,
@ -341,6 +351,8 @@ terminate(_Reason, State) ->
?MODULE, caps_stream_features, 75),
ejabberd_hooks:delete(s2s_in_post_auth_features, Host,
?MODULE, caps_stream_features, 75),
ejabberd_hooks:delete(c2s_copy_session, Host, ?MODULE,
c2s_copy_session, 75),
ejabberd_hooks:delete(disco_local_features, Host,
?MODULE, disco_features, 75),
ejabberd_hooks:delete(disco_local_identity, Host,