From 6706bdc6964c5d820ae1547fba1e4b3fd3a39857 Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Sun, 21 Dec 2003 18:16:08 +0000 Subject: [PATCH] * src/mod_roster.erl: Added workaround for legacy gateways (passing of "subscribed" presence) * src/ejabberd_sm.erl: Minor fix in subscription processing SVN Revision: 187 --- ChangeLog | 7 +++++++ src/ejabberd_sm.erl | 9 ++++----- src/mod_roster.erl | 6 ++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02506a197..ee1d0dd93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-12-21 Alexey Shchepin + + * src/mod_roster.erl: Added workaround for legacy gateways + (passing of "subscribed" presence) + + * src/ejabberd_sm.erl: Minor fix in subscription processing + 2003-12-17 Alexey Shchepin * src/jlib.hrl: Added declaration of "iq" record diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl index 6fc8f1fd6..03d1cac96 100644 --- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -150,27 +150,26 @@ do_route(From, To, Packet) -> "" -> case Name of "presence" -> - FromU = jlib:jid_replace_resource(From, ""), {Pass, Subsc} = case xml:get_attr_s("type", Attrs) of "subscribe" -> {mod_roster:in_subscription(User, - FromU, + From, subscribe), true}; "subscribed" -> {mod_roster:in_subscription(User, - FromU, + From, subscribed), true}; "unsubscribe" -> {mod_roster:in_subscription(User, - FromU, + From, unsubscribe), true}; "unsubscribed" -> {mod_roster:in_subscription(User, - FromU, + From, unsubscribed), true}; _ -> diff --git a/src/mod_roster.erl b/src/mod_roster.erl index 2d0e8882f..6f3234e62 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -397,7 +397,8 @@ process_subscription(Direction, User, JID1, Type) -> %% NewState = none | {NewSubscription, NewPending} in_state_change(none, none, subscribe) -> {none, in}; -in_state_change(none, none, subscribed) -> none; +in_state_change(none, none, subscribed) -> {to, none}; % Workaround for gateways +%in_state_change(none, none, subscribed) -> none; in_state_change(none, none, unsubscribe) -> none; in_state_change(none, none, unsubscribed) -> none; in_state_change(none, out, subscribe) -> {none, both}; @@ -405,7 +406,8 @@ in_state_change(none, out, subscribed) -> {to, none}; in_state_change(none, out, unsubscribe) -> none; in_state_change(none, out, unsubscribed) -> {none, none}; in_state_change(none, in, subscribe) -> none; -in_state_change(none, in, subscribed) -> none; +in_state_change(none, in, subscribed) -> {to, in}; % Workaround for gateways +%in_state_change(none, in, subscribed) -> none; in_state_change(none, in, unsubscribe) -> {none, none}; in_state_change(none, in, unsubscribed) -> none; in_state_change(none, both, subscribe) -> none;