25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

EJAB-469 bugfix

SVN Revision: 1097
This commit is contained in:
Christophe Romain 2007-12-22 01:13:06 +00:00
parent 02eaf9eaec
commit d74c527101
4 changed files with 25 additions and 8 deletions

View File

@ -5,7 +5,7 @@
* src/ejabberd_c2s.erl: Likewise
* src/mod_pubsub/mod_pubsub.erl: send last pep item bugfix and
broadcast optimization (EJAB-468) (EJAB-467) (EJAB-460)
broadcast optimization (EJAB-468) (EJAB-467) (EJAB-460) (EJAB-469)
* src/mod_pubsub/pubsub.hrl: Likewise
* src/mod_pubsub/node_default.erl: Likewise

View File

@ -1687,6 +1687,7 @@ send_items(Host, Node, LJID, Number) ->
%% Response = [pubsubIQResponse()]
%% @doc <p>Return the list of affiliations as an XMPP response.</p>
get_affiliations(Host, JID, Plugins) when is_list(Plugins) ->
?INFO_MSG("**1 ~p",[{Host,JID,Plugins}]),
Result = lists:foldl(
fun(Type, {Status, Acc}) ->
Features = features(Type),

View File

@ -143,6 +143,7 @@ features() ->
"instant-nodes",
"item-ids",
"manage-subscriptions",
"modify-affiliations",
"outcast-affiliation",
"persistent-items",
"publish",

View File

@ -75,8 +75,11 @@ options() ->
features() ->
["create-nodes", %*
"auto-create", %*
"auto-subscribe", %*
"delete-nodes", %*
"filtered-notifications", %*
"item-ids",
"modify-affiliations",
"outcast-affiliation",
"persistent-items",
"publish", %*
@ -85,9 +88,7 @@ features() ->
"retrieve-affiliations",
"retrieve-items", %*
"retrieve-subscriptions",
"subscribe", %*
"auto-subscribe", %*
"filtered-notifications" %*
"subscribe" %*
].
create_node_permission(_Host, _ServerHost, _Node, _ParentNode, _Owner, _Access) ->
@ -133,16 +134,30 @@ purge_node(Host, Node, Owner) ->
get_entity_affiliations(_Host, Owner) ->
OwnerKey = jlib:jid_tolower(jlib:jid_remove_resource(Owner)),
node_default:get_entity_affiliations(OwnerKey, Owner).
%{result, []}.
get_node_affiliations(_Host, _Node) ->
{result, []}.
get_node_affiliations(_Host, Node) ->
States = mnesia:match_object(
#pubsub_state{stateid = {'_', {'_', Node}},
_ = '_'}),
Tr = fun(#pubsub_state{stateid = {J, {_, _}}, affiliation = A}) ->
{J, A}
end,
{result, lists:map(Tr, States)}.
get_affiliation(_Host, Node, Owner) ->
OwnerKey = jlib:jid_tolower(jlib:jid_remove_resource(Owner)),
node_default:get_affiliation(OwnerKey, Node, Owner).
set_affiliation(_Host, _Node, _Owner, _Affiliation) ->
set_affiliation(_Host, Node, Owner, Affiliation) ->
OwnerKey = jlib:jid_tolower(jlib:jid_remove_resource(Owner)),
Record = case get_state(OwnerKey, Node, OwnerKey) of
{error, ?ERR_ITEM_NOT_FOUND} ->
#pubsub_state{stateid = {OwnerKey, {OwnerKey, Node}},
affiliation = Affiliation};
{result, State} ->
State#pubsub_state{affiliation = Affiliation}
end,
set_state(Record),
ok.
get_entity_subscriptions(_Host, _Owner) ->