From 2078f9ae95cff7aa7e592322fa9380815390c809 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Tue, 27 Oct 2009 14:40:01 +0000 Subject: [PATCH] typo fix on mod_pubsub and improve ejabberd_sm:get_session_pid api SVN Revision: 2715 --- src/ejabberd_sm.erl | 7 ++++--- src/mod_pubsub/mod_pubsub.erl | 4 ++-- src/mod_pubsub/mod_pubsub_odbc.erl | 2 +- src/mod_pubsub/pubsub_odbc.patch | 13 ++----------- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl index 009d32bd7..f0e4d747f 100644 --- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -223,9 +223,10 @@ close_session_unset_presence(SID, JID, Status) when ?IS_JID(JID) -> Status]). get_session_pid(JID) when ?IS_JID(JID) -> - USR = {exmpp_jid:prep_node(JID), - exmpp_jid:prep_domain(JID), - exmpp_jid:prep_resource(JID)}, + get_session_pid({exmpp_jid:prep_node(JID), + exmpp_jid:prep_domain(JID), + exmpp_jid:prep_resource(JID)}); +get_session_pid(USR) -> case catch mnesia:dirty_index_read(session, USR, #session.usr) of [#session{sid = {_, Pid}}] -> Pid; _ -> none diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index d2af36468..3d588dab7 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -1215,7 +1215,7 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang) -> iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) -> case exmpp_xml:remove_cdata_from_list(SubEl#xmlel.children) of [#xmlel{name = Name, attrs = Attrs, children = Els} | Rest] -> - Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(attrs, 'node', false)), + Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', false)), case {IQType, Name} of {set, 'create'} -> Config = case Rest of @@ -3151,7 +3151,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp _ -> 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) -> %% 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 diff --git a/src/mod_pubsub/mod_pubsub_odbc.erl b/src/mod_pubsub/mod_pubsub_odbc.erl index 1ca07a766..4cafe2403 100644 --- a/src/mod_pubsub/mod_pubsub_odbc.erl +++ b/src/mod_pubsub/mod_pubsub_odbc.erl @@ -2961,7 +2961,7 @@ broadcast_stanza(Host, Node, _NodeId, _Type, NodeOptions, SubsByDepth, NotifyTyp _ -> 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) -> %% 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 diff --git a/src/mod_pubsub/pubsub_odbc.patch b/src/mod_pubsub/pubsub_odbc.patch index ec516a168..307122ead 100644 --- a/src/mod_pubsub/pubsub_odbc.patch +++ b/src/mod_pubsub/pubsub_odbc.patch @@ -1,5 +1,5 @@ ---- mod_pubsub.erl 2009-10-27 15:19:20.000000000 +0100 -+++ mod_pubsub_odbc.erl 2009-10-27 15:21:49.000000000 +0100 +--- mod_pubsub.erl 2009-10-27 15:30:13.000000000 +0100 ++++ mod_pubsub_odbc.erl 2009-10-27 15:30:21.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. @@ -398,15 +398,6 @@ end, case transaction(Host, Node, Action, sync_dirty) of {result, {_, Result}} -> {result, Result}; -@@ -1215,7 +1023,7 @@ - iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) -> - case exmpp_xml:remove_cdata_from_list(SubEl#xmlel.children) of - [#xmlel{name = Name, attrs = Attrs, children = Els} | Rest] -> -- Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(attrs, 'node', false)), -+ Node = string_to_node(exmpp_xml:get_attribute_from_list_as_list(Attrs, 'node', false)), - case {IQType, Name} of - {set, 'create'} -> - Config = case Rest of @@ -1290,7 +1098,8 @@ (_, Acc) -> Acc