mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-20 17:27:00 +01:00
cosmetic changes, move badly placed comments
This commit is contained in:
parent
4d8f770624
commit
26b815f52d
@ -1286,17 +1286,6 @@ remove_user(User, Server) ->
|
||||
LServer = jlib:nameprep(Server),
|
||||
Entity = jlib:make_jid(LUser, LServer, <<"">>),
|
||||
Host = host(LServer),
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function:
|
||||
%% handle_call(Request, From, State) -> {reply, Reply, State} |
|
||||
%% {reply, Reply, State, Timeout} |
|
||||
%% {noreply, State} |
|
||||
%% {noreply, State, Timeout} |
|
||||
%% {stop, Reason, Reply, State} |
|
||||
%% {stop, Reason, State}
|
||||
%% Description: Handling call messages
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
HomeTreeBase = <<"/home/", LServer/binary, "/", LUser/binary>>,
|
||||
spawn(fun () ->
|
||||
lists:foreach(fun (PType) ->
|
||||
@ -1375,13 +1364,6 @@ handle_call(stop, _From, State) ->
|
||||
%% Description: Handling cast messages
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: handle_info(Info, State) -> {noreply, State} |
|
||||
%% {noreply, State, Timeout} |
|
||||
%% {stop, Reason, State}
|
||||
%% Description: Handling all non call/cast messages
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
handle_cast(_Msg, State) -> {noreply, State}.
|
||||
|
||||
-spec(handle_info/2 ::
|
||||
@ -1391,6 +1373,13 @@ handle_cast(_Msg, State) -> {noreply, State}.
|
||||
-> {noreply, state()}
|
||||
).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: handle_info(Info, State) -> {noreply, State} |
|
||||
%% {noreply, State, Timeout} |
|
||||
%% {stop, Reason, State}
|
||||
%% Description: Handling all non call/cast messages
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
handle_info({route, From, To, Packet},
|
||||
#state{server_host = ServerHost, access = Access,
|
||||
plugins = Plugins} =
|
||||
@ -1402,6 +1391,9 @@ handle_info({route, From, To, Packet},
|
||||
_ -> ok
|
||||
end,
|
||||
{noreply, State};
|
||||
handle_info(_Info, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: terminate(Reason, State) -> void()
|
||||
%% Description: This function is called by a gen_server when it is about to
|
||||
@ -1410,8 +1402,6 @@ handle_info({route, From, To, Packet},
|
||||
%% The return value is ignored.
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
handle_info(_Info, State) -> {noreply, State}.
|
||||
|
||||
terminate(_Reason,
|
||||
#state{host = Host, server_host = ServerHost,
|
||||
nodetree = TreePlugin, plugins = Plugins}) ->
|
||||
@ -1452,14 +1442,14 @@ terminate(_Reason,
|
||||
?MODULE, remove_user, 50),
|
||||
mod_disco:unregister_feature(ServerHost, ?NS_PUBSUB),
|
||||
gen_mod:get_module_proc(ServerHost, ?LOOPNAME) ! stop,
|
||||
terminate_plugins(Host, ServerHost, Plugins,
|
||||
TreePlugin).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}
|
||||
%% Description: Convert process state when code is changed
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
terminate_plugins(Host, ServerHost, Plugins,
|
||||
TreePlugin).
|
||||
|
||||
code_change(_OldVsn, State, _Extra) -> {ok, State}.
|
||||
|
||||
-spec(do_route/7 ::
|
||||
@ -3380,13 +3370,6 @@ send_items(Host, Node, NodeId, Type, {U, S, R} = LJID,
|
||||
children = itemsEls(ToSend)}])
|
||||
end,
|
||||
case is_tuple(Host) of
|
||||
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
||||
%% Host = host()
|
||||
%% JID = jid()
|
||||
%% Plugins = [Plugin::string()]
|
||||
%% Reason = stanzaError()
|
||||
%% Response = [pubsubIQResponse()]
|
||||
%% @doc <p>Return the list of affiliations as an XMPP response.</p>
|
||||
false ->
|
||||
ejabberd_router:route(service_jid(Host),
|
||||
jlib:make_jid(LJID), Stanza);
|
||||
@ -3401,6 +3384,13 @@ send_items(Host, Node, NodeId, Type, {U, S, R} = LJID,
|
||||
end
|
||||
end.
|
||||
|
||||
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
||||
%% Host = host()
|
||||
%% JID = jid()
|
||||
%% Plugins = [Plugin::string()]
|
||||
%% Reason = stanzaError()
|
||||
%% Response = [pubsubIQResponse()]
|
||||
%% @doc <p>Return the list of affiliations as an XMPP response.</p>
|
||||
-spec(get_affiliations/4 ::
|
||||
(
|
||||
Host :: mod_pubsub:host(),
|
||||
@ -4069,10 +4059,6 @@ get_roster_info(OwnerUser, OwnerServer,
|
||||
end,
|
||||
Groups),
|
||||
{PresenceSubscription, RosterGroup};
|
||||
%% @spec (AffiliationStr) -> Affiliation
|
||||
%% AffiliationStr = string()
|
||||
%% Affiliation = atom()
|
||||
%% @doc <p>Convert an affiliation type from string to atom.</p>
|
||||
get_roster_info(OwnerUser, OwnerServer, JID,
|
||||
AllowedGroups) ->
|
||||
get_roster_info(OwnerUser, OwnerServer,
|
||||
@ -4085,10 +4071,6 @@ string_to_affiliation(<<"outcast">>) -> outcast;
|
||||
string_to_affiliation(<<"none">>) -> none;
|
||||
string_to_affiliation(_) -> false.
|
||||
|
||||
%% @spec (SubscriptionStr) -> Subscription
|
||||
%% SubscriptionStr = string()
|
||||
%% Subscription = atom()
|
||||
%% @doc <p>Convert a subscription type from string to atom.</p>
|
||||
string_to_subscription(<<"subscribed">>) -> subscribed;
|
||||
string_to_subscription(<<"pending">>) -> pending;
|
||||
string_to_subscription(<<"unconfigured">>) ->
|
||||
@ -4096,21 +4078,6 @@ string_to_subscription(<<"unconfigured">>) ->
|
||||
string_to_subscription(<<"none">>) -> none;
|
||||
string_to_subscription(_) -> false.
|
||||
|
||||
%% @spec (Affiliation) -> AffiliationStr
|
||||
%% Affiliation = atom()
|
||||
%% AffiliationStr = string()
|
||||
%% @doc <p>Convert an affiliation type from atom to string.</p>
|
||||
%% @spec (Subscription) -> SubscriptionStr
|
||||
%% Subscription = atom()
|
||||
%% SubscriptionStr = string()
|
||||
%% @doc <p>Convert a subscription type from atom to string.</p>
|
||||
%% @spec (Node) -> NodeStr
|
||||
%% Node = pubsubNode()
|
||||
%% NodeStr = string()
|
||||
%% @doc <p>Convert a node type from pubsubNode to string.</p>
|
||||
%% @spec (Host) -> jid()
|
||||
%% Host = host()
|
||||
%% @doc <p>Generate pubsub service JID.</p>
|
||||
affiliation_to_string(owner) -> <<"owner">>;
|
||||
affiliation_to_string(publisher) -> <<"publisher">>;
|
||||
affiliation_to_string(member) -> <<"member">>;
|
||||
@ -4128,6 +4095,11 @@ subscription_to_string(_) -> <<"none">>.
|
||||
-> jid()
|
||||
).
|
||||
service_jid(Host) ->
|
||||
case Host of
|
||||
{U, S, _} -> {jid, U, S, <<"">>, U, S, <<"">>};
|
||||
_ -> {jid, <<"">>, Host, <<"">>, <<"">>, Host, <<"">>}
|
||||
end.
|
||||
|
||||
%% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
|
||||
%% LJID = jid()
|
||||
%% NotifyType = items | nodes
|
||||
@ -4136,11 +4108,6 @@ service_jid(Host) ->
|
||||
%% SubOptions = [{atom(), term()}]
|
||||
%% @doc <p>Check if a notification must be delivered or not based on
|
||||
%% node and subscription options.</p>
|
||||
case Host of
|
||||
{U, S, _} -> {jid, U, S, <<"">>, U, S, <<"">>};
|
||||
_ -> {jid, <<"">>, Host, <<"">>, <<"">>, Host, <<"">>}
|
||||
end.
|
||||
|
||||
is_to_deliver(LJID, NotifyType, Depth, NodeOptions,
|
||||
SubOptions) ->
|
||||
sub_to_deliver(LJID, NotifyType, Depth, SubOptions)
|
||||
@ -4243,13 +4210,13 @@ get_resource_state({U, S, R}, ShowValues, JIDs) ->
|
||||
end
|
||||
end.
|
||||
|
||||
%% @spec (Payload) -> int()
|
||||
%% Payload = term()
|
||||
-spec(payload_xmlelements/1 ::
|
||||
(
|
||||
Payload :: mod_pubsub:payload())
|
||||
-> Count :: non_neg_integer()
|
||||
).
|
||||
%% @spec (Payload) -> int()
|
||||
%% Payload = term()
|
||||
%% @doc <p>Count occurence of XML elements in payload.</p>
|
||||
payload_xmlelements(Payload) -> payload_xmlelements(Payload, 0).
|
||||
payload_xmlelements([], Count) -> Count;
|
||||
|
@ -931,17 +931,6 @@ remove_user(User, Server) ->
|
||||
LServer = jlib:nameprep(Server),
|
||||
Entity = jlib:make_jid(LUser, LServer, <<"">>),
|
||||
Host = host(LServer),
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function:
|
||||
%% handle_call(Request, From, State) -> {reply, Reply, State} |
|
||||
%% {reply, Reply, State, Timeout} |
|
||||
%% {noreply, State} |
|
||||
%% {noreply, State, Timeout} |
|
||||
%% {stop, Reason, Reply, State} |
|
||||
%% {stop, Reason, State}
|
||||
%% Description: Handling call messages
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
HomeTreeBase = <<"/home/", LServer/binary, "/", LUser/binary>>,
|
||||
spawn(fun () ->
|
||||
lists:foreach(fun (PType) ->
|
||||
@ -1020,13 +1009,6 @@ handle_call(stop, _From, State) ->
|
||||
%% Description: Handling cast messages
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: handle_info(Info, State) -> {noreply, State} |
|
||||
%% {noreply, State, Timeout} |
|
||||
%% {stop, Reason, State}
|
||||
%% Description: Handling all non call/cast messages
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
handle_cast(_Msg, State) -> {noreply, State}.
|
||||
|
||||
-spec(handle_info/2 ::
|
||||
@ -1036,6 +1018,13 @@ handle_cast(_Msg, State) -> {noreply, State}.
|
||||
-> {noreply, state()}
|
||||
).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: handle_info(Info, State) -> {noreply, State} |
|
||||
%% {noreply, State, Timeout} |
|
||||
%% {stop, Reason, State}
|
||||
%% Description: Handling all non call/cast messages
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
handle_info({route, From, To, Packet},
|
||||
#state{server_host = ServerHost, access = Access,
|
||||
plugins = Plugins} =
|
||||
@ -1047,6 +1036,9 @@ handle_info({route, From, To, Packet},
|
||||
_ -> ok
|
||||
end,
|
||||
{noreply, State};
|
||||
handle_info(_Info, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: terminate(Reason, State) -> void()
|
||||
%% Description: This function is called by a gen_server when it is about to
|
||||
@ -1055,8 +1047,6 @@ handle_info({route, From, To, Packet},
|
||||
%% The return value is ignored.
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
handle_info(_Info, State) -> {noreply, State}.
|
||||
|
||||
terminate(_Reason,
|
||||
#state{host = Host, server_host = ServerHost,
|
||||
nodetree = TreePlugin, plugins = Plugins}) ->
|
||||
@ -1097,14 +1087,14 @@ terminate(_Reason,
|
||||
?MODULE, remove_user, 50),
|
||||
mod_disco:unregister_feature(ServerHost, ?NS_PUBSUB),
|
||||
gen_mod:get_module_proc(ServerHost, ?LOOPNAME) ! stop,
|
||||
terminate_plugins(Host, ServerHost, Plugins,
|
||||
TreePlugin).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}
|
||||
%% Description: Convert process state when code is changed
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
terminate_plugins(Host, ServerHost, Plugins,
|
||||
TreePlugin).
|
||||
|
||||
code_change(_OldVsn, State, _Extra) -> {ok, State}.
|
||||
|
||||
-spec(do_route/7 ::
|
||||
@ -3684,10 +3674,6 @@ get_roster_info(OwnerUser, OwnerServer,
|
||||
end,
|
||||
Groups),
|
||||
{PresenceSubscription, RosterGroup};
|
||||
%% @spec (AffiliationStr) -> Affiliation
|
||||
%% AffiliationStr = string()
|
||||
%% Affiliation = atom()
|
||||
%% @doc <p>Convert an affiliation type from string to atom.</p>
|
||||
get_roster_info(OwnerUser, OwnerServer, JID,
|
||||
AllowedGroups) ->
|
||||
get_roster_info(OwnerUser, OwnerServer,
|
||||
@ -3700,10 +3686,6 @@ string_to_affiliation(<<"outcast">>) -> outcast;
|
||||
string_to_affiliation(<<"none">>) -> none;
|
||||
string_to_affiliation(_) -> false.
|
||||
|
||||
%% @spec (SubscriptionStr) -> Subscription
|
||||
%% SubscriptionStr = string()
|
||||
%% Subscription = atom()
|
||||
%% @doc <p>Convert a subscription type from string to atom.</p>
|
||||
string_to_subscription(<<"subscribed">>) -> subscribed;
|
||||
string_to_subscription(<<"pending">>) -> pending;
|
||||
string_to_subscription(<<"unconfigured">>) ->
|
||||
@ -3711,21 +3693,6 @@ string_to_subscription(<<"unconfigured">>) ->
|
||||
string_to_subscription(<<"none">>) -> none;
|
||||
string_to_subscription(_) -> false.
|
||||
|
||||
%% @spec (Affiliation) -> AffiliationStr
|
||||
%% Affiliation = atom()
|
||||
%% AffiliationStr = string()
|
||||
%% @doc <p>Convert an affiliation type from atom to string.</p>
|
||||
%% @spec (Subscription) -> SubscriptionStr
|
||||
%% Subscription = atom()
|
||||
%% SubscriptionStr = string()
|
||||
%% @doc <p>Convert a subscription type from atom to string.</p>
|
||||
%% @spec (Node) -> NodeStr
|
||||
%% Node = pubsubNode()
|
||||
%% NodeStr = string()
|
||||
%% @doc <p>Convert a node type from pubsubNode to string.</p>
|
||||
%% @spec (Host) -> jid()
|
||||
%% Host = host()
|
||||
%% @doc <p>Generate pubsub service JID.</p>
|
||||
affiliation_to_string(owner) -> <<"owner">>;
|
||||
affiliation_to_string(publisher) -> <<"publisher">>;
|
||||
affiliation_to_string(member) -> <<"member">>;
|
||||
@ -3743,6 +3710,11 @@ subscription_to_string(_) -> <<"none">>.
|
||||
-> jid()
|
||||
).
|
||||
service_jid(Host) ->
|
||||
case Host of
|
||||
{U, S, _} -> {jid, U, S, <<"">>, U, S, <<"">>};
|
||||
_ -> {jid, <<"">>, Host, <<"">>, <<"">>, Host, <<"">>}
|
||||
end.
|
||||
|
||||
%% @spec (LJID, NotifyType, Depth, NodeOptions, SubOptions) -> boolean()
|
||||
%% LJID = jid()
|
||||
%% NotifyType = items | nodes
|
||||
@ -3751,11 +3723,6 @@ service_jid(Host) ->
|
||||
%% SubOptions = [{atom(), term()}]
|
||||
%% @doc <p>Check if a notification must be delivered or not based on
|
||||
%% node and subscription options.</p>
|
||||
case Host of
|
||||
{U, S, _} -> {jid, U, S, <<"">>, U, S, <<"">>};
|
||||
_ -> {jid, <<"">>, Host, <<"">>, <<"">>, Host, <<"">>}
|
||||
end.
|
||||
|
||||
is_to_deliver(LJID, NotifyType, Depth, NodeOptions,
|
||||
SubOptions) ->
|
||||
sub_to_deliver(LJID, NotifyType, Depth, SubOptions)
|
||||
@ -3858,13 +3825,13 @@ get_resource_state({U, S, R}, ShowValues, JIDs) ->
|
||||
end
|
||||
end.
|
||||
|
||||
%% @spec (Payload) -> int()
|
||||
%% Payload = term()
|
||||
-spec(payload_xmlelements/1 ::
|
||||
(
|
||||
Payload :: mod_pubsub:payload())
|
||||
-> Count :: non_neg_integer()
|
||||
).
|
||||
%% @spec (Payload) -> int()
|
||||
%% Payload = term()
|
||||
%% @doc <p>Count occurence of XML elements in payload.</p>
|
||||
payload_xmlelements(Payload) -> payload_xmlelements(Payload, 0).
|
||||
payload_xmlelements([], Count) -> Count;
|
||||
|
@ -137,6 +137,18 @@ options() ->
|
||||
%% @doc Returns the node features
|
||||
-spec(features/0 :: () -> Features::[binary(),...]).
|
||||
features() ->
|
||||
[<<"create-nodes">>, <<"auto-create">>,
|
||||
<<"access-authorize">>, <<"delete-nodes">>,
|
||||
<<"delete-items">>, <<"get-pending">>,
|
||||
<<"instant-nodes">>, <<"manage-subscriptions">>,
|
||||
<<"modify-affiliations">>, <<"multi-subscribe">>,
|
||||
<<"outcast-affiliation">>, <<"persistent-items">>,
|
||||
<<"publish">>, <<"purge-nodes">>, <<"retract-items">>,
|
||||
<<"retrieve-affiliations">>, <<"retrieve-items">>,
|
||||
<<"retrieve-subscriptions">>, <<"subscribe">>,
|
||||
<<"subscription-notifications">>,
|
||||
<<"subscription-options">>].
|
||||
|
||||
%% @spec (Host, ServerHost, NodeId, ParentNodeId, Owner, Access) -> {result, Allowed}
|
||||
%% Host = mod_pubsub:hostPubsub()
|
||||
%% ServerHost = string()
|
||||
@ -157,18 +169,6 @@ features() ->
|
||||
%% module by implementing this function like this:
|
||||
%% ```check_create_user_permission(Host, ServerHost, NodeId, ParentNodeId, Owner, Access) ->
|
||||
%% node_default:check_create_user_permission(Host, ServerHost, NodeId, ParentNodeId, Owner, Access).'''</p>
|
||||
[<<"create-nodes">>, <<"auto-create">>,
|
||||
<<"access-authorize">>, <<"delete-nodes">>,
|
||||
<<"delete-items">>, <<"get-pending">>,
|
||||
<<"instant-nodes">>, <<"manage-subscriptions">>,
|
||||
<<"modify-affiliations">>, <<"multi-subscribe">>,
|
||||
<<"outcast-affiliation">>, <<"persistent-items">>,
|
||||
<<"publish">>, <<"purge-nodes">>, <<"retract-items">>,
|
||||
<<"retrieve-affiliations">>, <<"retrieve-items">>,
|
||||
<<"retrieve-subscriptions">>, <<"subscribe">>,
|
||||
<<"subscription-notifications">>,
|
||||
<<"subscription-options">>].
|
||||
|
||||
-spec(create_node_permission/6 ::
|
||||
(
|
||||
Host :: mod_pubsub:host(),
|
||||
@ -1073,14 +1073,14 @@ get_state(NodeIdx, JID) ->
|
||||
-> ok
|
||||
).
|
||||
set_state(State) when is_record(State, pubsub_state) ->
|
||||
mnesia:write(State).
|
||||
%set_state(_) -> {error, ?ERR_INTERNAL_SERVER_ERROR}.
|
||||
|
||||
%% @spec (NodeIdx, JID) -> ok | {error, Reason}
|
||||
%% NodeIdx = mod_pubsub:nodeIdx()
|
||||
%% JID = mod_pubsub:jid()
|
||||
%% Reason = mod_pubsub:stanzaError()
|
||||
%% @doc <p>Delete a state from database.</p>
|
||||
mnesia:write(State).
|
||||
%set_state(_) -> {error, ?ERR_INTERNAL_SERVER_ERROR}.
|
||||
|
||||
-spec(del_state/2 ::
|
||||
(
|
||||
NodeIdx :: mod_pubsub:nodeIdx(),
|
||||
@ -1251,14 +1251,14 @@ get_item(NodeIdx, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup,
|
||||
-> ok
|
||||
).
|
||||
set_item(Item) when is_record(Item, pubsub_item) ->
|
||||
mnesia:write(Item).
|
||||
%set_item(_) -> {error, ?ERR_INTERNAL_SERVER_ERROR}.
|
||||
|
||||
%% @spec (NodeIdx, ItemId) -> ok | {error, Reason}
|
||||
%% NodeIdx = mod_pubsub:nodeIdx()
|
||||
%% ItemId = mod_pubsub:itemId()
|
||||
%% Reason = mod_pubsub:stanzaError()
|
||||
%% @doc <p>Delete an item from database.</p>
|
||||
mnesia:write(Item).
|
||||
%set_item(_) -> {error, ?ERR_INTERNAL_SERVER_ERROR}.
|
||||
|
||||
-spec(del_item/2 ::
|
||||
(
|
||||
NodeIdx :: mod_pubsub:nodeIdx(),
|
||||
@ -1299,13 +1299,13 @@ node_to_path(Node) -> str:tokens((Node), <<"/">>).
|
||||
|
||||
path_to_node([]) -> <<>>;
|
||||
path_to_node(Path) ->
|
||||
iolist_to_binary(str:join([<<"">> | Path], <<"/">>)).
|
||||
|
||||
%% @spec (Affiliation, Subscription) -> true | false
|
||||
%% Affiliation = owner | member | publisher | outcast | none
|
||||
%% Subscription = subscribed | none
|
||||
%% @doc Determines if the combination of Affiliation and Subscribed
|
||||
%% are allowed to get items from a node.
|
||||
iolist_to_binary(str:join([<<"">> | Path], <<"/">>)).
|
||||
|
||||
can_fetch_item(owner, _) -> true;
|
||||
can_fetch_item(member, _) -> true;
|
||||
can_fetch_item(publisher, _) -> true;
|
||||
|
@ -132,6 +132,18 @@ options() ->
|
||||
%% @doc Returns the node features
|
||||
-spec(features/0 :: () -> Features::[Feature::binary(),...]).
|
||||
features() ->
|
||||
[<<"create-nodes">>, <<"auto-create">>,
|
||||
<<"access-authorize">>, <<"delete-nodes">>,
|
||||
<<"delete-items">>, <<"get-pending">>,
|
||||
<<"instant-nodes">>, <<"manage-subscriptions">>,
|
||||
<<"modify-affiliations">>, <<"multi-subscribe">>,
|
||||
<<"outcast-affiliation">>, <<"persistent-items">>,
|
||||
<<"publish">>, <<"purge-nodes">>, <<"retract-items">>,
|
||||
<<"retrieve-affiliations">>, <<"retrieve-items">>,
|
||||
<<"retrieve-subscriptions">>, <<"subscribe">>,
|
||||
<<"subscription-notifications">>,
|
||||
<<"subscription-options">>, <<"rsm">>].
|
||||
|
||||
%% @spec (Host, ServerHost, Node, ParentNode, Owner, Access) -> bool()
|
||||
%% Host = mod_pubsub:host()
|
||||
%% ServerHost = mod_pubsub:host()
|
||||
@ -151,18 +163,6 @@ features() ->
|
||||
%% module by implementing this function like this:
|
||||
%% ```check_create_user_permission(Host, ServerHost, Node, ParentNode, Owner, Access) ->
|
||||
%% node_default:check_create_user_permission(Host, ServerHost, Node, ParentNode, Owner, Access).'''</p>
|
||||
[<<"create-nodes">>, <<"auto-create">>,
|
||||
<<"access-authorize">>, <<"delete-nodes">>,
|
||||
<<"delete-items">>, <<"get-pending">>,
|
||||
<<"instant-nodes">>, <<"manage-subscriptions">>,
|
||||
<<"modify-affiliations">>, <<"multi-subscribe">>,
|
||||
<<"outcast-affiliation">>, <<"persistent-items">>,
|
||||
<<"publish">>, <<"purge-nodes">>, <<"retract-items">>,
|
||||
<<"retrieve-affiliations">>, <<"retrieve-items">>,
|
||||
<<"retrieve-subscriptions">>, <<"subscribe">>,
|
||||
<<"subscription-notifications">>,
|
||||
<<"subscription-options">>, <<"rsm">>].
|
||||
|
||||
-spec(create_node_permission/6 ::
|
||||
(
|
||||
Host :: mod_pubsub:host(),
|
||||
@ -1503,8 +1503,6 @@ del_item(NodeId, ItemId) ->
|
||||
del_items(_, []) -> ok;
|
||||
del_items(NodeId, [ItemId]) -> del_item(NodeId, ItemId);
|
||||
del_items(NodeId, ItemIds) ->
|
||||
%% @doc <p>Return the name of the node if known: Default is to return
|
||||
%% node id.</p>
|
||||
I = str:join([[<<"'">>, (?PUBSUB):escape(X), <<"'">>]
|
||||
|| X <- ItemIds],
|
||||
<<",">>),
|
||||
@ -1519,13 +1517,13 @@ node_to_path(Node) -> str:tokens((Node), <<"/">>).
|
||||
|
||||
path_to_node([]) -> <<>>;
|
||||
path_to_node(Path) ->
|
||||
iolist_to_binary(str:join([<<"">> | Path], <<"/">>)).
|
||||
|
||||
%% @spec (Affiliation, Subscription) -> true | false
|
||||
%% Affiliation = owner | member | publisher | outcast | none
|
||||
%% Subscription = subscribed | none
|
||||
%% @doc Determines if the combination of Affiliation and Subscribed
|
||||
%% are allowed to get items from a node.
|
||||
iolist_to_binary(str:join([<<"">> | Path], <<"/">>)).
|
||||
|
||||
can_fetch_item(owner, _) -> true;
|
||||
can_fetch_item(member, _) -> true;
|
||||
can_fetch_item(publisher, _) -> true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- mod_pubsub.erl 2013-06-06 11:08:12.333599362 +0200
|
||||
+++ mod_pubsub_odbc.erl 2013-06-06 11:31:06.640173557 +0200
|
||||
--- mod_pubsub.erl 2013-06-13 23:58:13.380824021 +0200
|
||||
+++ mod_pubsub_odbc.erl 2013-06-14 00:01:11.907478941 +0200
|
||||
@@ -43,7 +43,7 @@
|
||||
%%% 6.2.3.1, 6.2.3.5, and 6.3. For information on subscription leases see
|
||||
%%% XEP-0060 section 12.18.
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
-author('christophe.romain@process-one.net').
|
||||
|
||||
@@ -61,11 +61,11 @@
|
||||
@@ -62,11 +62,11 @@
|
||||
|
||||
-include("pubsub.hrl").
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
%% exports for hooks
|
||||
-export([presence_probe/3, caps_update/3,
|
||||
@@ -100,7 +100,7 @@
|
||||
@@ -101,7 +101,7 @@
|
||||
-export([subscription_to_string/1, affiliation_to_string/1,
|
||||
string_to_subscription/1, string_to_affiliation/1,
|
||||
extended_error/2, extended_error/3,
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
%% API and gen_server callbacks
|
||||
-export([start_link/2, start/2, stop/1, init/1,
|
||||
@@ -110,7 +110,7 @@
|
||||
@@ -111,7 +111,7 @@
|
||||
%% calls for parallel sending of last items
|
||||
-export([send_loop/1]).
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
-define(LOOPNAME, ejabberd_mod_pubsub_loop).
|
||||
|
||||
@@ -349,8 +349,6 @@
|
||||
@@ -350,8 +350,6 @@
|
||||
false -> ok
|
||||
end,
|
||||
ejabberd_router:register_route(Host),
|
||||
@ -51,7 +51,7 @@
|
||||
put(server_host, ServerHost),
|
||||
init_nodes(Host, ServerHost, NodeTree, Plugins),
|
||||
State = #state{host = Host, server_host = ServerHost,
|
||||
@@ -423,359 +421,14 @@
|
||||
@@ -424,359 +422,14 @@
|
||||
ok.
|
||||
|
||||
init_nodes(Host, ServerHost, _NodeTree, Plugins) ->
|
||||
@ -414,7 +414,7 @@
|
||||
send_loop(State) ->
|
||||
receive
|
||||
{presence, JID, Pid} ->
|
||||
@@ -784,11 +437,13 @@
|
||||
@@ -785,11 +438,13 @@
|
||||
LJID = jlib:jid_tolower(JID),
|
||||
BJID = jlib:jid_remove_resource(LJID),
|
||||
lists:foreach(fun (PType) ->
|
||||
@ -432,7 +432,7 @@
|
||||
lists:foreach(fun ({Node, subscribed, _,
|
||||
SubJID}) ->
|
||||
if (SubJID == LJID) or
|
||||
@@ -800,24 +455,14 @@
|
||||
@@ -801,24 +456,14 @@
|
||||
type =
|
||||
Type,
|
||||
id =
|
||||
@ -459,7 +459,7 @@
|
||||
true ->
|
||||
% resource not concerned about that subscription
|
||||
ok
|
||||
@@ -1008,7 +653,8 @@
|
||||
@@ -1009,7 +654,8 @@
|
||||
children = []}];
|
||||
disco_identity(Host, Node, From) ->
|
||||
Action = fun (#pubsub_node{id = Idx, type = Type,
|
||||
@ -469,7 +469,7 @@
|
||||
case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of
|
||||
{result, _} ->
|
||||
{result,
|
||||
@@ -1060,7 +706,8 @@
|
||||
@@ -1061,7 +707,8 @@
|
||||
|| Feature <- features(<<"pep">>)]];
|
||||
disco_features(Host, Node, From) ->
|
||||
Action = fun (#pubsub_node{id = Idx, type = Type,
|
||||
@ -479,7 +479,7 @@
|
||||
case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of
|
||||
{result, _} ->
|
||||
{result,
|
||||
@@ -1105,9 +752,9 @@
|
||||
@@ -1106,9 +753,9 @@
|
||||
).
|
||||
disco_items(Host, <<>>, From) ->
|
||||
Action = fun (#pubsub_node{nodeid = {_, NodeID},
|
||||
@ -491,7 +491,7 @@
|
||||
case get_allowed_items_call(Host, Idx, From, Type, Options, Owners) of
|
||||
{result, _} ->
|
||||
[#xmlel{name = <<"item">>,
|
||||
@@ -1128,13 +775,14 @@
|
||||
@@ -1129,13 +776,14 @@
|
||||
_ -> Acc
|
||||
end
|
||||
end,
|
||||
@ -508,7 +508,7 @@
|
||||
case get_allowed_items_call(Host, Idx, From, Type,
|
||||
Options, Owners)
|
||||
of
|
||||
@@ -1238,9 +886,6 @@
|
||||
@@ -1239,9 +887,6 @@
|
||||
lists:foreach(fun ({#pubsub_node{options
|
||||
=
|
||||
Options,
|
||||
@ -518,7 +518,7 @@
|
||||
id =
|
||||
NodeId},
|
||||
subscribed, _,
|
||||
@@ -1252,7 +897,7 @@
|
||||
@@ -1253,7 +898,7 @@
|
||||
presence ->
|
||||
case
|
||||
lists:member(BJID,
|
||||
@ -527,7 +527,7 @@
|
||||
of
|
||||
true ->
|
||||
node_action(Host,
|
||||
@@ -1512,7 +1157,8 @@
|
||||
@@ -1503,7 +1148,8 @@
|
||||
IQ ->
|
||||
#xmlel{attrs = QAttrs} = SubEl,
|
||||
Node = xml:get_attr_s(<<"node">>, QAttrs),
|
||||
@ -537,7 +537,7 @@
|
||||
{result, IQRes} ->
|
||||
jlib:iq_to_xml(IQ#iq{type = result,
|
||||
sub_el =
|
||||
@@ -1639,7 +1285,7 @@
|
||||
@@ -1630,7 +1276,7 @@
|
||||
% [] ->
|
||||
% [<<"leaf">>]; %% No sub-nodes: it's a leaf node
|
||||
% _ ->
|
||||
@ -546,7 +546,7 @@
|
||||
% {result, []} -> [<<"collection">>];
|
||||
% {result, _} -> [<<"leaf">>, <<"collection">>];
|
||||
% _ -> []
|
||||
@@ -1661,7 +1307,11 @@
|
||||
@@ -1652,7 +1298,11 @@
|
||||
% [#xmlel{name = <<"feature">>,
|
||||
% attrs = [{<<"var">>, ?NS_PUBSUB}],
|
||||
% children = []}
|
||||
@ -559,7 +559,7 @@
|
||||
% #xmlel{name = <<"feature">>,
|
||||
% attrs =
|
||||
% [{<<"var">>,
|
||||
@@ -1686,7 +1336,7 @@
|
||||
@@ -1677,7 +1327,7 @@
|
||||
[] -> [<<"leaf">>];
|
||||
_ ->
|
||||
case node_call(Type, get_items,
|
||||
@ -568,7 +568,7 @@
|
||||
of
|
||||
{result, []} ->
|
||||
[<<"collection">>];
|
||||
@@ -1708,7 +1358,11 @@
|
||||
@@ -1699,7 +1349,11 @@
|
||||
F = [#xmlel{name = <<"feature">>,
|
||||
attrs = [{<<"var">>, ?NS_PUBSUB}],
|
||||
children = []}
|
||||
@ -581,7 +581,7 @@
|
||||
#xmlel{name = <<"feature">>,
|
||||
attrs =
|
||||
[{<<"var">>,
|
||||
@@ -1752,7 +1406,11 @@
|
||||
@@ -1743,7 +1397,11 @@
|
||||
#xmlel{name = <<"feature">>,
|
||||
attrs = [{<<"var">>, ?NS_VCARD}], children = []}]
|
||||
++
|
||||
@ -594,7 +594,7 @@
|
||||
#xmlel{name = <<"feature">>,
|
||||
attrs =
|
||||
[{<<"var">>, <<(?NS_PUBSUB)/binary, "#", Feature/binary>>}],
|
||||
@@ -1765,14 +1423,15 @@
|
||||
@@ -1756,14 +1414,15 @@
|
||||
_ -> node_disco_info(Host, Node, From)
|
||||
end.
|
||||
|
||||
@ -613,7 +613,7 @@
|
||||
{result,
|
||||
lists:map(fun (#pubsub_node{nodeid = {_, SubNode},
|
||||
options = Options}) ->
|
||||
@@ -1809,7 +1468,7 @@
|
||||
@@ -1800,7 +1459,7 @@
|
||||
% Nodes)};
|
||||
% Other -> Other
|
||||
% end;
|
||||
@ -622,7 +622,7 @@
|
||||
CommandItems = [#xmlel{name = <<"item">>,
|
||||
attrs =
|
||||
[{<<"jid">>, Host},
|
||||
@@ -1817,22 +1476,19 @@
|
||||
@@ -1808,22 +1467,19 @@
|
||||
{<<"name">>, <<"Get Pending">>}],
|
||||
children = []}],
|
||||
{result, CommandItems};
|
||||
@ -651,7 +651,7 @@
|
||||
end,
|
||||
Nodes = lists:map(fun (#pubsub_node{nodeid =
|
||||
{_, SubNode},
|
||||
@@ -1875,7 +1531,7 @@
|
||||
@@ -1866,7 +1522,7 @@
|
||||
children = []}
|
||||
end,
|
||||
NodeItems),
|
||||
@ -660,7 +660,7 @@
|
||||
end,
|
||||
case transaction(Host, Node, Action, sync_dirty) of
|
||||
{result, {_, Result}} -> {result, Result};
|
||||
@@ -2026,7 +1682,8 @@
|
||||
@@ -2017,7 +1673,8 @@
|
||||
(_, Acc) -> Acc
|
||||
end,
|
||||
[], xml:remove_cdata(Els)),
|
||||
@ -670,7 +670,7 @@
|
||||
{get, <<"subscriptions">>} ->
|
||||
get_subscriptions(Host, Node, From, Plugins);
|
||||
{get, <<"affiliations">>} ->
|
||||
@@ -2061,7 +1718,9 @@
|
||||
@@ -2052,7 +1709,9 @@
|
||||
).
|
||||
iq_pubsub_owner(Host, ServerHost, From, IQType, SubEl, Lang) ->
|
||||
#xmlel{children = SubEls} = SubEl,
|
||||
@ -681,7 +681,7 @@
|
||||
case Action of
|
||||
[#xmlel{name = Name, attrs = Attrs, children = Els}] ->
|
||||
Node = xml:get_attr_s(<<"node">>, Attrs),
|
||||
@@ -2195,7 +1854,8 @@
|
||||
@@ -2186,7 +1845,8 @@
|
||||
_ -> []
|
||||
end
|
||||
end,
|
||||
@ -691,7 +691,7 @@
|
||||
{result, lists:flatmap(Tr, Plugins)}
|
||||
end,
|
||||
sync_dirty)
|
||||
@@ -2240,7 +1900,8 @@
|
||||
@@ -2231,7 +1891,8 @@
|
||||
|
||||
%%% authorization handling
|
||||
|
||||
@ -701,7 +701,7 @@
|
||||
Subscriber) ->
|
||||
Lang = <<"en">>,
|
||||
Stanza = #xmlel{name = <<"message">>, attrs = [],
|
||||
@@ -2318,7 +1979,7 @@
|
||||
@@ -2309,7 +1970,7 @@
|
||||
ejabberd_router:route(service_jid(Host),
|
||||
jlib:make_jid(Owner), Stanza)
|
||||
end,
|
||||
@ -710,7 +710,7 @@
|
||||
|
||||
find_authorization_response(Packet) ->
|
||||
#xmlel{children = Els} = Packet,
|
||||
@@ -2383,11 +2044,11 @@
|
||||
@@ -2374,11 +2035,11 @@
|
||||
<<"true">> -> true;
|
||||
_ -> false
|
||||
end,
|
||||
@ -724,7 +724,7 @@
|
||||
{result, Subscriptions} = node_call(Type,
|
||||
get_subscriptions,
|
||||
[NodeId,
|
||||
@@ -2642,7 +2303,7 @@
|
||||
@@ -2633,7 +2294,7 @@
|
||||
children = [#xmlel{name = <<"create">>,
|
||||
attrs = nodeAttr(Node),
|
||||
children = []}]}],
|
||||
@ -733,7 +733,7 @@
|
||||
{result, {NodeId, SubsByDepth, {Result, broadcast}}} ->
|
||||
broadcast_created_node(Host, Node, NodeId, Type, NodeOptions, SubsByDepth),
|
||||
ejabberd_hooks:run(pubsub_create_node, ServerHost, [ServerHost, Host, Node, NodeId, NodeOptions]),
|
||||
@@ -2779,7 +2440,7 @@
|
||||
@@ -2770,7 +2431,7 @@
|
||||
%%</ul>
|
||||
subscribe_node(Host, Node, From, JID, Configuration) ->
|
||||
SubOpts = case
|
||||
@ -742,7 +742,7 @@
|
||||
of
|
||||
{result, GoodSubOpts} -> GoodSubOpts;
|
||||
_ -> invalid
|
||||
@@ -2793,7 +2454,7 @@
|
||||
@@ -2784,7 +2445,7 @@
|
||||
end
|
||||
end,
|
||||
Action = fun (#pubsub_node{options = Options,
|
||||
@ -751,7 +751,7 @@
|
||||
Features = features(Type),
|
||||
SubscribeFeature = lists:member(<<"subscribe">>, Features),
|
||||
OptionsFeature = lists:member(<<"subscription-options">>, Features),
|
||||
@@ -2802,6 +2463,7 @@
|
||||
@@ -2793,6 +2454,7 @@
|
||||
AccessModel = get_option(Options, access_model),
|
||||
SendLast = get_option(Options, send_last_published_item),
|
||||
AllowedGroups = get_option(Options, roster_groups_allowed, []),
|
||||
@ -759,7 +759,7 @@
|
||||
{PresenceSubscription, RosterGroup} =
|
||||
get_presence_and_roster_permissions(Host, Subscriber,
|
||||
Owners, AccessModel, AllowedGroups),
|
||||
@@ -2956,12 +2618,9 @@
|
||||
@@ -2947,12 +2609,9 @@
|
||||
Features = features(Type),
|
||||
PublishFeature = lists:member(<<"publish">>, Features),
|
||||
PublishModel = get_option(Options, publish_model),
|
||||
@ -773,7 +773,7 @@
|
||||
PayloadCount = payload_xmlelements(Payload),
|
||||
PayloadSize = byte_size(term_to_binary(Payload)) - 2,
|
||||
PayloadMaxSize = get_option(Options, max_payload_size),
|
||||
@@ -3017,7 +2676,7 @@
|
||||
@@ -3008,7 +2667,7 @@
|
||||
false ->
|
||||
ok
|
||||
end,
|
||||
@ -782,7 +782,7 @@
|
||||
case Result of
|
||||
default -> {result, Reply};
|
||||
_ -> {result, Result}
|
||||
@@ -3210,19 +2869,20 @@
|
||||
@@ -3201,19 +2860,20 @@
|
||||
%% <p>The permission are not checked in this function.</p>
|
||||
%% @todo We probably need to check that the user doing the query has the right
|
||||
%% to read the items.
|
||||
@ -806,7 +806,7 @@
|
||||
MaxItems = if SMaxItems == <<"">> ->
|
||||
get_max_items_node(Host);
|
||||
true ->
|
||||
@@ -3234,13 +2894,13 @@
|
||||
@@ -3225,13 +2885,13 @@
|
||||
case MaxItems of
|
||||
{error, Error} -> {error, Error};
|
||||
_ ->
|
||||
@ -822,7 +822,7 @@
|
||||
{PresenceSubscription, RosterGroup} =
|
||||
get_presence_and_roster_permissions(Host, From, Owners,
|
||||
AccessModel, AllowedGroups),
|
||||
@@ -3258,11 +2918,11 @@
|
||||
@@ -3249,11 +2909,11 @@
|
||||
node_call(Type, get_items,
|
||||
[NodeId, From, AccessModel,
|
||||
PresenceSubscription, RosterGroup,
|
||||
@ -836,7 +836,7 @@
|
||||
SendItems = case ItemIDs of
|
||||
[] -> Items;
|
||||
_ ->
|
||||
@@ -3280,8 +2940,8 @@
|
||||
@@ -3271,8 +2931,8 @@
|
||||
children =
|
||||
[#xmlel{name = <<"items">>, attrs = nodeAttr(Node),
|
||||
children =
|
||||
@ -847,7 +847,7 @@
|
||||
Error -> Error
|
||||
end
|
||||
end.
|
||||
@@ -3305,13 +2965,18 @@
|
||||
@@ -3296,13 +2956,18 @@
|
||||
end.
|
||||
|
||||
get_allowed_items_call(Host, NodeIdx, From, Type, Options, Owners) ->
|
||||
@ -867,7 +867,7 @@
|
||||
|
||||
%% @spec (Host, Node, NodeId, Type, LJID, Number) -> any()
|
||||
%% Host = pubsubHost()
|
||||
@@ -3322,35 +2987,32 @@
|
||||
@@ -3313,35 +2978,32 @@
|
||||
%% Number = last | integer()
|
||||
%% @doc <p>Resend the items of a node to the user.</p>
|
||||
%% @todo use cache-last-item feature
|
||||
@ -922,20 +922,11 @@
|
||||
send_items(Host, Node, NodeId, Type, {U, S, R} = LJID,
|
||||
Number) ->
|
||||
ToSend = case node_action(Host, Type, get_items,
|
||||
@@ -3378,7 +3040,8 @@
|
||||
@@ -3369,20 +3031,7 @@
|
||||
attrs = nodeAttr(Node),
|
||||
children = itemsEls(ToSend)}])
|
||||
end,
|
||||
- case is_tuple(Host) of
|
||||
+ ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza).
|
||||
+
|
||||
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
||||
%% Host = host()
|
||||
%% JID = jid()
|
||||
@@ -3386,20 +3049,6 @@
|
||||
%% Reason = stanzaError()
|
||||
%% Response = [pubsubIQResponse()]
|
||||
%% @doc <p>Return the list of affiliations as an XMPP response.</p>
|
||||
- false ->
|
||||
- ejabberd_router:route(service_jid(Host),
|
||||
- jlib:make_jid(LJID), Stanza);
|
||||
@ -949,11 +940,11 @@
|
||||
- _ -> ok
|
||||
- end
|
||||
- end.
|
||||
-
|
||||
-spec(get_affiliations/4 ::
|
||||
(
|
||||
Host :: mod_pubsub:host(),
|
||||
@@ -3586,9 +3235,10 @@
|
||||
+ ejabberd_router:route(service_jid(Host), jlib:make_jid(LJID), Stanza).
|
||||
|
||||
%% @spec (Host, JID, Plugins) -> {error, Reason} | {result, Response}
|
||||
%% Host = host()
|
||||
@@ -3577,9 +3226,10 @@
|
||||
case Entities of
|
||||
error -> {error, ?ERR_BAD_REQUEST};
|
||||
_ ->
|
||||
@ -965,7 +956,7 @@
|
||||
case lists:member(Owner, Owners) of
|
||||
true ->
|
||||
OwnerJID = jlib:make_jid(Owner),
|
||||
@@ -3601,42 +3251,7 @@
|
||||
@@ -3592,42 +3242,7 @@
|
||||
_ -> Entities
|
||||
end,
|
||||
lists:foreach(fun ({JID, Affiliation}) ->
|
||||
@ -1009,7 +1000,7 @@
|
||||
end,
|
||||
FilteredEntities),
|
||||
{result, []};
|
||||
@@ -3695,11 +3310,11 @@
|
||||
@@ -3686,11 +3301,11 @@
|
||||
end.
|
||||
|
||||
read_sub(Subscriber, Node, NodeID, SubID, Lang) ->
|
||||
@ -1023,7 +1014,7 @@
|
||||
OptionsEl = #xmlel{name = <<"options">>,
|
||||
attrs =
|
||||
[{<<"jid">>, jlib:jid_to_string(Subscriber)},
|
||||
@@ -3733,7 +3348,7 @@
|
||||
@@ -3724,7 +3339,7 @@
|
||||
end.
|
||||
|
||||
set_options_helper(Configuration, JID, NodeID, SubID, Type) ->
|
||||
@ -1032,7 +1023,7 @@
|
||||
{result, GoodSubOpts} -> GoodSubOpts;
|
||||
_ -> invalid
|
||||
end,
|
||||
@@ -3765,7 +3380,7 @@
|
||||
@@ -3756,7 +3371,7 @@
|
||||
write_sub(_Subscriber, _NodeID, _SubID, invalid) ->
|
||||
{error, extended_error(?ERR_BAD_REQUEST, <<"invalid-options">>)};
|
||||
write_sub(Subscriber, NodeID, SubID, Options) ->
|
||||
@ -1041,7 +1032,7 @@
|
||||
{error, notfound} ->
|
||||
{error, extended_error(?ERR_NOT_ACCEPTABLE, <<"invalid-subid">>)};
|
||||
{result, _} ->
|
||||
@@ -3986,9 +3601,9 @@
|
||||
@@ -3977,9 +3592,9 @@
|
||||
ejabberd_router:route(service_jid(Host),
|
||||
jlib:make_jid(JID), Stanza)
|
||||
end,
|
||||
@ -1053,7 +1044,7 @@
|
||||
true ->
|
||||
Result = lists:foldl(fun ({JID, Subscription,
|
||||
SubId},
|
||||
@@ -4405,7 +4020,7 @@
|
||||
@@ -4373,7 +3988,7 @@
|
||||
{Depth, [{N, get_node_subs(N)} || N <- Nodes]}
|
||||
end, tree_call(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)]))}
|
||||
end,
|
||||
@ -1062,7 +1053,7 @@
|
||||
{result, CollSubs} -> CollSubs;
|
||||
_ -> []
|
||||
end.
|
||||
@@ -4419,9 +4034,9 @@
|
||||
@@ -4387,9 +4002,9 @@
|
||||
|
||||
get_options_for_subs(NodeID, Subs) ->
|
||||
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
||||
@ -1074,7 +1065,7 @@
|
||||
_ -> Acc
|
||||
end;
|
||||
(_, Acc) ->
|
||||
@@ -5121,6 +4736,30 @@
|
||||
@@ -5089,6 +4704,30 @@
|
||||
_ -> features()
|
||||
end.
|
||||
|
||||
@ -1105,7 +1096,7 @@
|
||||
%% @doc <p>node tree plugin call.</p>
|
||||
tree_call({_User, Server, _Resource}, Function, Args) ->
|
||||
tree_call(Server, Function, Args);
|
||||
@@ -5140,7 +4779,13 @@
|
||||
@@ -5108,7 +4747,13 @@
|
||||
tree_action(Host, Function, Args) ->
|
||||
?DEBUG("tree_action ~p ~p ~p", [Host, Function, Args]),
|
||||
Fun = fun () -> tree_call(Host, Function, Args) end,
|
||||
@ -1120,7 +1111,7 @@
|
||||
|
||||
%% @doc <p>node plugin call.</p>
|
||||
node_call(Type, Function, Args) ->
|
||||
@@ -5165,13 +4810,12 @@
|
||||
@@ -5133,13 +4778,12 @@
|
||||
node_action(Host, Type, Function, Args) ->
|
||||
?DEBUG("node_action ~p ~p ~p ~p",
|
||||
[Host, Type, Function, Args]),
|
||||
@ -1136,7 +1127,7 @@
|
||||
case tree_call(Host, get_node, [Host, Node]) of
|
||||
N when is_record(N, pubsub_node) ->
|
||||
case Action(N) of
|
||||
@@ -5185,16 +4829,22 @@
|
||||
@@ -5153,16 +4797,22 @@
|
||||
end,
|
||||
Trans).
|
||||
|
||||
@ -1163,7 +1154,7 @@
|
||||
{result, Result} -> {result, Result};
|
||||
{error, Error} -> {error, Error};
|
||||
{atomic, {result, Result}} -> {result, Result};
|
||||
@@ -5203,6 +4853,15 @@
|
||||
@@ -5171,6 +4821,15 @@
|
||||
?ERROR_MSG("transaction return internal error: ~p~n",
|
||||
[{aborted, Reason}]),
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR};
|
||||
@ -1179,7 +1170,7 @@
|
||||
{'EXIT', Reason} ->
|
||||
?ERROR_MSG("transaction return internal error: ~p~n",
|
||||
[{'EXIT', Reason}]),
|
||||
@@ -5213,6 +4872,16 @@
|
||||
@@ -5181,6 +4840,16 @@
|
||||
{error, ?ERR_INTERNAL_SERVER_ERROR}
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user