If the "resend_on_timeout" option is set to 'if_offline' and a pending
stream management session is terminated because a new session is opened
by the same resource (while no other resource is online), resend
unacknowledged messages rather than bouncing error messages.
Resend when is_boolean(Resend) ->
Resend;
if_offline ->
- ejabberd_sm:get_user_resources(StateData#state.user,
- StateData#state.server) == []
+ Resource = StateData#state.resource,
+ case ejabberd_sm:get_user_resources(StateData#state.user,
+ StateData#state.server) of
+ [Resource] -> % Same resource opened new session
+ true;
+ [] ->
+ true;
+ _ ->
+ false
+ end
end,
ReRoute = case ResendOnTimeout of
true ->