diff --git a/ChangeLog b/ChangeLog index fc6cbaf4f..3a0073692 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-08-20 Alexey Shchepin + * src/mod_roster.erl: Don't send roster push when unsubscribing in + "None + Pending In" state + * src/mod_roster_odbc.erl: Likewise + * src/mod_offline.erl: Renamed MAX_OFFLINE_MSGS to MaxOfflineMsgs * src/odbc/ejabberd_odbc_sup.erl: Add an odbc_pool_size config diff --git a/src/mod_roster.erl b/src/mod_roster.erl index 9d3974ac7..785f30c76 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -3,7 +3,6 @@ %%% Author : Alexey Shchepin %%% Purpose : Roster management %%% Created : 11 Dec 2002 by Alexey Shchepin -%%% Id : $Id$ %%%---------------------------------------------------------------------- -module(mod_roster). @@ -434,6 +433,10 @@ process_subscription(Direction, User, Server, JID1, Type, Reason) -> case NewState of none -> {none, AutoReply}; + {none, none} when Item#roster.subscription == none, + Item#roster.ask == in -> + mnesia:delete({roster, {LUser, LServer, LJID}}), + {none, AutoReply}; {Subscription, Pending} -> NewItem = Item#roster{subscription = Subscription, ask = Pending, diff --git a/src/mod_roster_odbc.erl b/src/mod_roster_odbc.erl index dcdf1c45a..2cf327cef 100644 --- a/src/mod_roster_odbc.erl +++ b/src/mod_roster_odbc.erl @@ -3,7 +3,6 @@ %%% Author : Alexey Shchepin %%% Purpose : Roster management %%% Created : 15 Dec 2004 by Alexey Shchepin -%%% Id : $Id$ %%%---------------------------------------------------------------------- -module(mod_roster_odbc). @@ -209,7 +208,6 @@ process_item_set(From, To, {xmlelement, _Name, Attrs, Els}) -> error -> ok; _ -> - JID = {JID1#jid.user, JID1#jid.server, JID1#jid.resource}, LJID = jlib:jid_tolower(JID1), Username = ejabberd_odbc:escape(LUser), SJID = ejabberd_odbc:escape(jlib:jid_to_string(LJID)), @@ -329,7 +327,7 @@ process_item_attrs(Item, []) -> Item. -process_item_els(Item, [{xmlelement, Name, Attrs, SEls} | Els]) -> +process_item_els(Item, [{xmlelement, Name, _Attrs, SEls} | Els]) -> case Name of "group" -> Groups = [xml:get_cdata(SEls) | Item#roster.groups], @@ -488,6 +486,10 @@ process_subscription(Direction, User, Server, JID1, Type, Reason) -> case NewState of none -> {none, AutoReply}; + {none, none} when Item#roster.subscription == none, + Item#roster.ask == in -> + odbc_queries:del_roster(LServer, Username, SJID), + {none, AutoReply}; {Subscription, Pending} -> NewItem = Item#roster{subscription = Subscription, ask = Pending, @@ -651,7 +653,6 @@ process_item_set_t(LUser, LServer, {xmlelement, _Name, Attrs, Els}) -> error -> []; _ -> - JID = {JID1#jid.user, JID1#jid.server, JID1#jid.resource}, LJID = {JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource}, Username = ejabberd_odbc:escape(LUser), SJID = ejabberd_odbc:escape(jlib:jid_to_string(LJID)),