25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Fix PEP broadcasting issue on ODBC (EJAB-1680)

This commit is contained in:
Christophe Romain 2014-05-06 13:29:35 +02:00
parent 58717923eb
commit cc1f93d7a0

View File

@ -4077,15 +4077,7 @@ broadcast_stanza(Host, _Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTy
broadcast_stanza({LUser, LServer, LResource}, Publisher, Node, NodeId, Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza, SHIM) -> broadcast_stanza({LUser, LServer, LResource}, Publisher, Node, NodeId, Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza, SHIM) ->
broadcast_stanza({LUser, LServer, LResource}, Node, NodeId, Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza, SHIM), broadcast_stanza({LUser, LServer, LResource}, Node, NodeId, Type, NodeOptions, SubsByDepth, NotifyType, BaseStanza, SHIM),
%% Handles implicit presence subscriptions %% Handles implicit presence subscriptions
SenderResource = case LResource of SenderResource = user_resource(LUser, LServer, LResource),
[] ->
case user_resources(LUser, LServer) of
[Resource|_] -> Resource;
_ -> <<>>
end;
_ ->
LResource
end,
case ejabberd_sm:get_session_pid(LUser, LServer, SenderResource) of case ejabberd_sm:get_session_pid(LUser, LServer, SenderResource) of
C2SPid when is_pid(C2SPid) -> C2SPid when is_pid(C2SPid) ->
Stanza = case get_option(NodeOptions, notification_type, headline) of Stanza = case get_option(NodeOptions, notification_type, headline) of
@ -4096,8 +4088,8 @@ broadcast_stanza({LUser, LServer, LResource}, Publisher, Node, NodeId, Type, Nod
%% Also, add "replyto" if entity has presence subscription to the account owner %% Also, add "replyto" if entity has presence subscription to the account owner
%% See XEP-0163 1.1 section 4.3.1 %% See XEP-0163 1.1 section 4.3.1
ejabberd_c2s:broadcast(C2SPid, ejabberd_c2s:broadcast(C2SPid,
{pep_message, binary_to_list(Node)++"+notify"}, {pep_message, <<((Node))/binary, "+notify">>},
_Sender = jlib:make_jid(LUser, LServer, ""), _Sender = jlib:make_jid(LUser, LServer, <<"">>),
_StanzaToSend = add_extended_headers(Stanza, _StanzaToSend = add_extended_headers(Stanza,
_ReplyTo = extended_headers([jlib:jid_to_string(Publisher)]))); _ReplyTo = extended_headers([jlib:jid_to_string(Publisher)])));
_ -> _ ->
@ -4162,6 +4154,13 @@ subscribed_nodes_by_jid(NotifyType, SubsByDepth) ->
user_resources(User, Server) -> user_resources(User, Server) ->
ejabberd_sm:get_user_resources(User, Server). ejabberd_sm:get_user_resources(User, Server).
user_resource(User, Server, <<>>) ->
case user_resources(User, Server) of
[R | _] -> R;
_ -> <<>>
end;
user_resource(_, _, Resource) -> Resource.
%%%%%%% Configuration handling %%%%%%% Configuration handling
%%<p>There are several reasons why the default node configuration options request might fail:</p> %%<p>There are several reasons why the default node configuration options request might fail:</p>