From 5ceffdd5a7cd5bb948a55170b0839146dd3fa8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Mon, 6 Oct 2008 15:00:34 +0000 Subject: [PATCH] Fix a confusion between #jid and tuples. PR: EJABP-1 Submitted by: Pablo Polvorin SVN Revision: 1604 --- ChangeLog | 3 +++ src/mod_roster_odbc.erl | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4692cfacb..6abb9c51a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ * src/ejabberd_c2s.erl (process_privacy_iq/4): mod_privacy & friends may return an empty list. Thanks to Pablo Polvorin! + * src/mod_roster_odbc.erl (get_jid_info/4): Fix a confusion between + #jid and tuples. Thanks to Pablo Polvorin! + 2008-10-02 Jean-Sébastien Pédron * src/mod_roster_odbc.erl: Fix a bug where a JID represented as a diff --git a/src/mod_roster_odbc.erl b/src/mod_roster_odbc.erl index 819fa483a..be3ffcb03 100644 --- a/src/mod_roster_odbc.erl +++ b/src/mod_roster_odbc.erl @@ -740,14 +740,15 @@ get_in_pending_subscriptions(Ls, User, Server) -> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - +%% JID is #jid record, because it's used latter on for both short_prepd_jid +%% and short_prepd_bare_jid get_jid_info(_, User, Server, JID) -> try LUser = exmpp_stringprep:nodeprep(User), LServer = exmpp_stringprep:nameprep(Server), - LJID = jlib:short_prepd_jid(JID), + LJID = {N, D, R} = jlib:short_prepd_jid(JID), Username = ejabberd_odbc:escape(LUser), - SJID = ejabberd_odbc:escape(exmpp_jid:jid_to_list(LJID)), + SJID = ejabberd_odbc:escape(exmpp_jid:jid_to_list(N, D, R)), case catch odbc_queries:get_subscription(LServer, Username, SJID) of {selected, ["subscription"], [{SSubscription}]} -> Subscription = case SSubscription of @@ -769,7 +770,8 @@ get_jid_info(_, User, Server, JID) -> LRJID == LJID -> {none, []}; true -> - SRJID = ejabberd_odbc:escape(exmpp_jid:jid_to_list(LRJID)), + {LR_N, LR_D, LR_R} = LRJID, + SRJID = ejabberd_odbc:escape(exmpp_jid:jid_to_list(LR_N, LR_D, LR_R)), case catch odbc_queries:get_subscription(LServer, Username, SRJID) of {selected, ["subscription"], [{SSubscription}]} -> Subscription = case SSubscription of