25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Provide new, not old, affiliation in kick/ban presence with codes 321 and 301

This commit is contained in:
Badlop 2010-11-16 00:03:09 +01:00
parent 0ccff15599
commit 6eeef62ce4

View File

@ -2265,7 +2265,7 @@ process_admin_items_set(UJID, Items, Lang, StateData) ->
case (SD#state.config)#config.members_only of case (SD#state.config)#config.members_only of
true -> true ->
catch send_kickban_presence( catch send_kickban_presence(
JID, Reason, "321", SD), JID, Reason, "321", none, SD),
SD1 = set_affiliation(JID, none, SD), SD1 = set_affiliation(JID, none, SD),
set_role(JID, none, SD1); set_role(JID, none, SD1);
_ -> _ ->
@ -2275,7 +2275,7 @@ process_admin_items_set(UJID, Items, Lang, StateData) ->
end; end;
{JID, affiliation, outcast, Reason} -> {JID, affiliation, outcast, Reason} ->
catch send_kickban_presence( catch send_kickban_presence(
JID, Reason, "301", SD), JID, Reason, "301", outcast, SD),
set_affiliation_and_reason( set_affiliation_and_reason(
JID, outcast, Reason, JID, outcast, Reason,
set_role(JID, none, SD)); set_role(JID, none, SD));
@ -2637,6 +2637,10 @@ can_change_ra(_FAffiliation, _FRole,
send_kickban_presence(JID, Reason, Code, StateData) -> send_kickban_presence(JID, Reason, Code, StateData) ->
NewAffiliation = get_affiliation(JID, StateData),
send_kickban_presence(JID, Reason, Code, NewAffiliation, StateData).
send_kickban_presence(JID, Reason, Code, NewAffiliation, StateData) ->
LJID = jlib:jid_tolower(JID), LJID = jlib:jid_tolower(JID),
LJIDs = case LJID of LJIDs = case LJID of
{U, S, ""} -> {U, S, ""} ->
@ -2662,14 +2666,13 @@ send_kickban_presence(JID, Reason, Code, StateData) ->
?DICT:find(J, StateData#state.users), ?DICT:find(J, StateData#state.users),
add_to_log(kickban, {Nick, Reason, Code}, StateData), add_to_log(kickban, {Nick, Reason, Code}, StateData),
tab_remove_online_user(J, StateData), tab_remove_online_user(J, StateData),
send_kickban_presence1(J, Reason, Code, StateData) send_kickban_presence1(J, Reason, Code, NewAffiliation, StateData)
end, LJIDs). end, LJIDs).
send_kickban_presence1(UJID, Reason, Code, StateData) -> send_kickban_presence1(UJID, Reason, Code, Affiliation, StateData) ->
{ok, #user{jid = _RealJID, {ok, #user{jid = _RealJID,
nick = Nick}} = nick = Nick}} =
?DICT:find(jlib:jid_tolower(UJID), StateData#state.users), ?DICT:find(jlib:jid_tolower(UJID), StateData#state.users),
Affiliation = get_affiliation(UJID, StateData),
SAffiliation = affiliation_to_list(Affiliation), SAffiliation = affiliation_to_list(Affiliation),
lists:foreach( lists:foreach(
fun({_LJID, Info}) -> fun({_LJID, Info}) ->