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

fix broadcast issue (EJAB-1411)

This commit is contained in:
Christophe Romain 2011-02-21 15:12:31 +01:00
parent 75a85beb80
commit 7f899ee179
3 changed files with 8 additions and 8 deletions

View File

@ -3361,7 +3361,7 @@ state_can_deliver({U, S, R}, SubOptions) ->
get_resource_state({U, S, R}, ShowValues, JIDs) -> get_resource_state({U, S, R}, ShowValues, JIDs) ->
%% Get user session PID %% Get user session PID
case ejabberd_sm:get_session_pid(exmpp_jid:make(U, S, R)) of case ejabberd_sm:get_session_pid({U, S, R}) of
%% If no PID, item can be delivered %% If no PID, item can be delivered
none -> lists:append([{U, S, R}], JIDs); none -> lists:append([{U, S, R}], JIDs);
%% If PID ... %% If PID ...
@ -3478,7 +3478,7 @@ broadcast(Host, Node, NodeId, Type, NodeOptions, Notify, Condition, Stanza, SHIM
broadcast({U, S, R}, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM) -> broadcast({U, S, R}, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM) ->
broadcast(S, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM) broadcast(S, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM)
or case ejabberd_sm:get_session_pid(U, S, user_resource(U, S, R)) of or case ejabberd_sm:get_session_pid({U, S, user_resource(U, S, R)}) of
C2SPid when is_pid(C2SPid) -> C2SPid when is_pid(C2SPid) ->
%% set the from address on the notification to the bare JID of the account owner %% set the from address on the notification to the bare JID of the account owner
%% Also, add "replyto" if entity has presence subscription to the account owner %% Also, add "replyto" if entity has presence subscription to the account owner
@ -3619,7 +3619,7 @@ sub_with_options(JID, NodeId, SubId) ->
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, []) -> user_resource(User, Server, undefined) ->
case user_resources(User, Server) of case user_resources(User, Server) of
[R|_] -> R; [R|_] -> R;
_ -> [] _ -> []

View File

@ -3166,7 +3166,7 @@ state_can_deliver({U, S, R}, SubOptions) ->
get_resource_state({U, S, R}, ShowValues, JIDs) -> get_resource_state({U, S, R}, ShowValues, JIDs) ->
%% Get user session PID %% Get user session PID
case ejabberd_sm:get_session_pid(exmpp_jid:make(U, S, R)) of case ejabberd_sm:get_session_pid({U, S, R}) of
%% If no PID, item can be delivered %% If no PID, item can be delivered
none -> lists:append([{U, S, R}], JIDs); none -> lists:append([{U, S, R}], JIDs);
%% If PID ... %% If PID ...
@ -3283,7 +3283,7 @@ broadcast(Host, Node, NodeId, Type, NodeOptions, Notify, Condition, Stanza, SHIM
broadcast({U, S, R}, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM) -> broadcast({U, S, R}, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM) ->
broadcast(S, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM) broadcast(S, Node, NodeId, Type, NodeOptions, Subscriptions, Stanza, SHIM)
or case ejabberd_sm:get_session_pid(U, S, user_resource(U, S, R)) of or case ejabberd_sm:get_session_pid({U, S, user_resource(U, S, R)}) of
C2SPid when is_pid(C2SPid) -> C2SPid when is_pid(C2SPid) ->
%% set the from address on the notification to the bare JID of the account owner %% set the from address on the notification to the bare JID of the account owner
%% Also, add "replyto" if entity has presence subscription to the account owner %% Also, add "replyto" if entity has presence subscription to the account owner
@ -3424,7 +3424,7 @@ sub_with_options(JID, NodeId, SubId) ->
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, []) -> user_resource(User, Server, undefined) ->
case user_resources(User, Server) of case user_resources(User, Server) of
[R|_] -> R; [R|_] -> R;
_ -> [] _ -> []

View File

@ -1,5 +1,5 @@
--- mod_pubsub.erl 2011-02-21 12:07:31.000000000 +0100 --- mod_pubsub.erl 2011-02-21 15:11:24.000000000 +0100
+++ mod_pubsub_odbc.erl 2011-02-21 12:07:50.000000000 +0100 +++ mod_pubsub_odbc.erl 2011-02-21 15:12:03.000000000 +0100
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see %%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
%%% XEP-0060 section 12.18. %%% XEP-0060 section 12.18.