25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +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
true ->
catch send_kickban_presence(
JID, Reason, "321", SD),
JID, Reason, "321", none, SD),
SD1 = set_affiliation(JID, none, SD),
set_role(JID, none, SD1);
_ ->
@ -2275,7 +2275,7 @@ process_admin_items_set(UJID, Items, Lang, StateData) ->
end;
{JID, affiliation, outcast, Reason} ->
catch send_kickban_presence(
JID, Reason, "301", SD),
JID, Reason, "301", outcast, SD),
set_affiliation_and_reason(
JID, outcast, Reason,
set_role(JID, none, SD));
@ -2637,6 +2637,10 @@ can_change_ra(_FAffiliation, _FRole,
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),
LJIDs = case LJID of
{U, S, ""} ->
@ -2662,14 +2666,13 @@ send_kickban_presence(JID, Reason, Code, StateData) ->
?DICT:find(J, StateData#state.users),
add_to_log(kickban, {Nick, Reason, Code}, StateData),
tab_remove_online_user(J, StateData),
send_kickban_presence1(J, Reason, Code, StateData)
send_kickban_presence1(J, Reason, Code, NewAffiliation, StateData)
end, LJIDs).
send_kickban_presence1(UJID, Reason, Code, StateData) ->
send_kickban_presence1(UJID, Reason, Code, Affiliation, StateData) ->
{ok, #user{jid = _RealJID,
nick = Nick}} =
?DICT:find(jlib:jid_tolower(UJID), StateData#state.users),
Affiliation = get_affiliation(UJID, StateData),
SAffiliation = affiliation_to_list(Affiliation),
lists:foreach(
fun({_LJID, Info}) ->