mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
* src/mod_muc/mod_muc_room.erl: Support Reasons for all
affiliation and role changes (EJAB-306) SVN Revision: 1498
This commit is contained in:
parent
2660bc514f
commit
756cd06625
@ -1,5 +1,8 @@
|
||||
2008-07-30 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/mod_muc/mod_muc_room.erl: Support Reasons for all
|
||||
affiliation and role changes (EJAB-306)
|
||||
|
||||
* src/gen_mod.erl: When ejabberd is kindly stopped, don't forget
|
||||
modules configuration (EJAB-706)
|
||||
* src/ejabberd_app.erl: Likewise
|
||||
|
@ -1701,6 +1701,9 @@ extract_history([_ | Els], Type) ->
|
||||
|
||||
|
||||
send_update_presence(JID, StateData) ->
|
||||
send_update_presence(JID, "", StateData).
|
||||
|
||||
send_update_presence(JID, Reason, StateData) ->
|
||||
LJID = jlib:jid_tolower(JID),
|
||||
LJIDs = case LJID of
|
||||
{U, S, ""} ->
|
||||
@ -1722,10 +1725,13 @@ send_update_presence(JID, StateData) ->
|
||||
end
|
||||
end,
|
||||
lists:foreach(fun(J) ->
|
||||
send_new_presence(J, StateData)
|
||||
send_new_presence(J, Reason, StateData)
|
||||
end, LJIDs).
|
||||
|
||||
send_new_presence(NJID, StateData) ->
|
||||
send_new_presence(NJID, "", StateData).
|
||||
|
||||
send_new_presence(NJID, Reason, StateData) ->
|
||||
{ok, #user{jid = RealJID,
|
||||
nick = Nick,
|
||||
role = Role,
|
||||
@ -1747,6 +1753,13 @@ send_new_presence(NJID, StateData) ->
|
||||
[{"affiliation", SAffiliation},
|
||||
{"role", SRole}]
|
||||
end,
|
||||
ItemEls = case Reason of
|
||||
"" ->
|
||||
[];
|
||||
_ ->
|
||||
[{xmlelement, "reason", [],
|
||||
[{xmlcdata, Reason}]}]
|
||||
end,
|
||||
Status = case StateData#state.just_created of
|
||||
true ->
|
||||
[{xmlelement, "status", [{"code", "201"}], []}];
|
||||
@ -1756,7 +1769,7 @@ send_new_presence(NJID, StateData) ->
|
||||
Packet = append_subtags(
|
||||
Presence,
|
||||
[{xmlelement, "x", [{"xmlns", ?NS_MUC_USER}],
|
||||
[{xmlelement, "item", ItemAttrs, []} | Status]}]),
|
||||
[{xmlelement, "item", ItemAttrs, ItemEls} | Status]}]),
|
||||
ejabberd_router:route(
|
||||
jlib:jid_replace_resource(StateData#state.jid, Nick),
|
||||
Info#user.jid,
|
||||
@ -2124,21 +2137,21 @@ process_admin_items_set(UJID, Items, Lang, StateData) ->
|
||||
set_affiliation_and_reason(
|
||||
JID, outcast, Reason,
|
||||
set_role(JID, none, SD));
|
||||
{JID, affiliation, A, _Reason} when
|
||||
{JID, affiliation, A, Reason} when
|
||||
(A == admin) or (A == owner) ->
|
||||
SD1 = set_affiliation(JID, A, SD),
|
||||
SD1 = set_affiliation_and_reason(JID, A, Reason, SD),
|
||||
SD2 = set_role(JID, moderator, SD1),
|
||||
send_update_presence(JID, SD2),
|
||||
send_update_presence(JID, Reason, SD2),
|
||||
SD2;
|
||||
{JID, affiliation, member, _Reason} ->
|
||||
SD1 = set_affiliation(
|
||||
JID, member, SD),
|
||||
{JID, affiliation, member, Reason} ->
|
||||
SD1 = set_affiliation_and_reason(
|
||||
JID, member, Reason, SD),
|
||||
SD2 = set_role(JID, participant, SD1),
|
||||
send_update_presence(JID, SD2),
|
||||
send_update_presence(JID, Reason, SD2),
|
||||
SD2;
|
||||
{JID, role, R, _Reason} ->
|
||||
SD1 = set_role(JID, R, SD),
|
||||
catch send_new_presence(JID, SD1),
|
||||
{JID, role, Role, Reason} ->
|
||||
SD1 = set_role(JID, Role, SD),
|
||||
catch send_new_presence(JID, Reason, SD1),
|
||||
SD1;
|
||||
{JID, affiliation, A, _Reason} ->
|
||||
SD1 = set_affiliation(JID, A, SD),
|
||||
|
Loading…
Reference in New Issue
Block a user