]> granicus.if.org Git - ejabberd/commitdiff
fix broadcast issue (EJAB-1411)
authorChristophe Romain <christophe.romain@process-one.net>
Mon, 21 Feb 2011 14:12:31 +0000 (15:12 +0100)
committerChristophe Romain <christophe.romain@process-one.net>
Mon, 21 Feb 2011 14:12:31 +0000 (15:12 +0100)
src/mod_pubsub/mod_pubsub.erl
src/mod_pubsub/mod_pubsub_odbc.erl
src/mod_pubsub/pubsub_odbc.patch

index 9b4c9c54f8e8987ebf7f09600d0910fecc988eca..7cca1477c57e031939f78e393bbcaac89e36723a 100644 (file)
@@ -3361,7 +3361,7 @@ state_can_deliver({U, S, R}, SubOptions) ->
 
 get_resource_state({U, S, R}, ShowValues, JIDs) ->
     %% 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
        none -> lists:append([{U, S, R}], JIDs);
        %% 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(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) ->
            %% 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
@@ -3619,7 +3619,7 @@ sub_with_options(JID, NodeId, SubId) ->
 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
        [R|_] -> R;
        _ ->  []
index 0ec5e0ab183dd0428cdc0c7029316f7b3deb4013..5e40b45e4c4c8828f97cdba1c26080ce6a203ee9 100644 (file)
@@ -3166,7 +3166,7 @@ state_can_deliver({U, S, R}, SubOptions) ->
 
 get_resource_state({U, S, R}, ShowValues, JIDs) ->
     %% 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
        none -> lists:append([{U, S, R}], JIDs);
        %% 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(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) ->
            %% 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
@@ -3424,7 +3424,7 @@ sub_with_options(JID, NodeId, SubId) ->
 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
        [R|_] -> R;
        _ ->  []
index 2053393a7efe5e3a91444a1b9859b566b164ffc8..499c7d6e7f78ab9480eec38b9a7e3ff0acc7f387 100644 (file)
@@ -1,5 +1,5 @@
---- mod_pubsub.erl     2011-02-21 12:07:31.000000000 +0100
-+++ mod_pubsub_odbc.erl        2011-02-21 12:07:50.000000000 +0100
+--- mod_pubsub.erl     2011-02-21 15:11:24.000000000 +0100
++++ mod_pubsub_odbc.erl        2011-02-21 15:12:03.000000000 +0100
 @@ -42,7 +42,7 @@
  %%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
  %%% XEP-0060 section 12.18.