mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
cosmetic changes
SVN Revision: 1923
This commit is contained in:
parent
c5c97a8edf
commit
67e24366ee
@ -1064,7 +1064,7 @@ find_authorization_response(Packet) ->
|
||||
[invalid] -> invalid;
|
||||
[] -> none;
|
||||
[XFields] when is_list(XFields) ->
|
||||
?DEBUG("XFields: ~p", [XFields]),
|
||||
?DEBUG("XFields: ~p", [XFields]),
|
||||
case lists:keysearch("FORM_TYPE", 1, XFields) of
|
||||
{value, {_, [?NS_PUBSUB_SUB_AUTH]}} ->
|
||||
XFields;
|
||||
@ -2810,7 +2810,8 @@ transaction(Fun, Trans) ->
|
||||
|
||||
%% Add pubsub-specific error element
|
||||
extended_error(Error, Ext) ->
|
||||
extended_error(Error, Ext, [{"xmlns", ?NS_PUBSUB_ERRORS}]).
|
||||
extended_error(Error, Ext,
|
||||
[{"xmlns", ?NS_PUBSUB_ERRORS}]).
|
||||
extended_error(Error, unsupported, Feature) ->
|
||||
extended_error(Error, "unsupported",
|
||||
[{"xmlns", ?NS_PUBSUB_ERRORS},
|
||||
|
@ -224,7 +224,6 @@ create_node(Host, Node, Owner) ->
|
||||
set_state(#pubsub_state{stateid = {OwnerKey, {Host, Node}}, affiliation = owner}),
|
||||
{result, {default, broadcast}}.
|
||||
|
||||
|
||||
%% @spec (Host, Removed) -> ok
|
||||
%% Host = mod_pubsub:host()
|
||||
%% Removed = [mod_pubsub:pubsubNode()]
|
||||
@ -560,8 +559,7 @@ get_entity_affiliations(Host, Owner) ->
|
||||
{result, lists:map(Tr, States)}.
|
||||
|
||||
get_node_affiliations(Host, Node) ->
|
||||
States = mnesia:match_object(
|
||||
#pubsub_state{stateid = {'_', {Host, Node}}, _ = '_'}),
|
||||
{result, States} = get_states(Host, Node),
|
||||
Tr = fun(#pubsub_state{stateid = {J, {_, _}}, affiliation = A}) ->
|
||||
{J, A}
|
||||
end,
|
||||
@ -597,13 +595,15 @@ set_affiliation(Host, Node, Owner, Affiliation) ->
|
||||
%% that will be added to the affiliation stored in the main
|
||||
%% <tt>pubsub_state</tt> table.</p>
|
||||
get_entity_subscriptions(Host, Owner) ->
|
||||
States = case jlib:jid_tolower(Owner) of
|
||||
{U, D, ""} -> mnesia:match_object(
|
||||
SubKey = jlib:jid_tolower(Owner),
|
||||
GenKey = jlib:jid_remove_resource(SubKey),
|
||||
States = case SubKey of
|
||||
GenKey -> mnesia:match_object(
|
||||
#pubsub_state{stateid = {{U, D, '_'}, {Host, '_'}}, _ = '_'});
|
||||
{U, D, R} -> mnesia:match_object(
|
||||
#pubsub_state{stateid = {{U, D, ""}, {Host, '_'}}, _ = '_'})
|
||||
_ -> mnesia:match_object(
|
||||
#pubsub_state{stateid = {GenKey, {Host, '_'}}, _ = '_'})
|
||||
++ mnesia:match_object(
|
||||
#pubsub_state{stateid = {{U, D, R}, {Host, '_'}}, _ = '_'})
|
||||
#pubsub_state{stateid = {SubKey, {Host, '_'}}, _ = '_'})
|
||||
end,
|
||||
Tr = fun(#pubsub_state{stateid = {J, {_, N}}, subscription = S}) ->
|
||||
{N, S, J}
|
||||
@ -611,8 +611,7 @@ get_entity_subscriptions(Host, Owner) ->
|
||||
{result, lists:map(Tr, States)}.
|
||||
|
||||
get_node_subscriptions(Host, Node) ->
|
||||
States = mnesia:match_object(
|
||||
#pubsub_state{stateid = {'_', {Host, Node}}, _ = '_'}),
|
||||
{result, States} = get_states(Host, Node),
|
||||
Tr = fun(#pubsub_state{stateid = {J, {_, _}}, subscription = S}) ->
|
||||
{J, S}
|
||||
end,
|
||||
@ -783,7 +782,7 @@ get_item(Host, Node, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup
|
||||
|
||||
%% @spec (Item) -> ok | {error, Reason::stanzaError()}
|
||||
%% Item = mod_pubsub:pubsubItems()
|
||||
%% @doc <p>Write a state into database.</p>
|
||||
%% @doc <p>Write an item into database.</p>
|
||||
set_item(Item) when is_record(Item, pubsub_item) ->
|
||||
mnesia:write(Item);
|
||||
set_item(_) ->
|
||||
|
@ -113,7 +113,7 @@ features() ->
|
||||
|
||||
create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) ->
|
||||
LOwner = jlib:jid_tolower(Owner),
|
||||
{User, Server, _Resource} = LOwner,
|
||||
{User, Server, _Resource} = LOwner,
|
||||
Allowed = case LOwner of
|
||||
{"", Host, ""} ->
|
||||
true; % pubsub service always allowed
|
||||
@ -125,12 +125,12 @@ create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) ->
|
||||
_ -> false
|
||||
end;
|
||||
E ->
|
||||
?DEBUG("Create not allowed : ~p~n", [E]),
|
||||
false
|
||||
?DEBUG("Create not allowed : ~p~n", [E]),
|
||||
false
|
||||
end
|
||||
end,
|
||||
{result, Allowed}.
|
||||
|
||||
|
||||
create_node(Host, Node, Owner) ->
|
||||
case node_default:create_node(Host, Node, Owner) of
|
||||
{result, _} -> {result, []};
|
||||
|
Loading…
Reference in New Issue
Block a user