25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Fix affiliation managment

Node owner can add/remove affiliations

SVN Revision: 2535
This commit is contained in:
Pablo Polvorin 2009-08-25 17:42:25 +00:00
parent b4f0bb65c6
commit fcf66c2e75
2 changed files with 4 additions and 4 deletions

View File

@ -2395,7 +2395,7 @@ set_affiliations(Host, Node, From, EntitiesEls) ->
#xmlel{name = 'affiliation', attrs = Attrs} ->
JID = try
exmpp_jid:parse(
exmpp_xml:get_attribute_from_list_as_list(Attrs, 'jid', ""))
exmpp_xml:get_attribute_from_list(Attrs, 'jid', ""))
catch
_:_ -> error
end,
@ -2406,7 +2406,7 @@ set_affiliations(Host, Node, From, EntitiesEls) ->
(Affiliation == false) ->
error;
true ->
[{jlib:short_prepd_jid(JID), Affiliation} | Acc]
[{JID, Affiliation} | Acc]
end
end
end
@ -2420,7 +2420,7 @@ set_affiliations(Host, Node, From, EntitiesEls) ->
true ->
lists:foreach(
fun({JID, Affiliation}) ->
node_call(Type, set_affiliation, [NodeId, JID, Affiliation]),
{result, _} = node_call(Type, set_affiliation, [NodeId, JID, Affiliation]),
case Affiliation of
owner ->
NewOwner = jlib:short_prepd_bare_jid(JID),

View File

@ -619,7 +619,7 @@ get_affiliation(NodeId, Owner) ->
GenState = get_state(NodeId, GenKey),
{result, GenState#pubsub_state.affiliation}.
set_affiliation(NodeId, Owner, Affiliation) ->
set_affiliation(NodeId, Owner, Affiliation) when ?IS_JID(Owner)->
GenKey = jlib:short_prepd_bare_jid(Owner),
GenState = get_state(NodeId, GenKey),
case {Affiliation, GenState#pubsub_state.subscriptions} of