mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
fix node path format, must be binary()
This commit is contained in:
parent
4c147c5f29
commit
b49dd8b8c4
@ -288,7 +288,7 @@ init_nodes(Host, ServerHost, _NodeTree, Plugins) ->
|
||||
case lists:member("hometree", Plugins) of
|
||||
true ->
|
||||
create_node(Host, ServerHost, string_to_node("/home"), service_jid(Host), "hometree"),
|
||||
create_node(Host, ServerHost, string_to_node("/home" ++ ServerHost), service_jid(Host), "hometree");
|
||||
create_node(Host, ServerHost, string_to_node("/home/" ++ ServerHost), service_jid(Host), "hometree");
|
||||
false ->
|
||||
ok
|
||||
end.
|
||||
|
@ -185,12 +185,12 @@ get_item_name(Host, Node, Id) ->
|
||||
node_hometree:get_item_name(Host, Node, Id).
|
||||
|
||||
node_to_path(Node) ->
|
||||
[binary_to_list(Node)].
|
||||
[Node].
|
||||
|
||||
path_to_node(Path) ->
|
||||
case Path of
|
||||
% default slot
|
||||
[Node] -> list_to_binary(Node);
|
||||
[Node] -> Node;
|
||||
% handle old possible entries, used when migrating database content to new format
|
||||
[Node|_] when is_list(Node) -> list_to_binary(string:join([""|Path], "/"));
|
||||
% default case (used by PEP for example)
|
||||
|
@ -191,14 +191,7 @@ get_last_items(NodeId, From, Count) ->
|
||||
node_hometree_odbc:get_last_items(NodeId, From, Count).
|
||||
|
||||
node_to_path(Node) ->
|
||||
[binary_to_list(Node)].
|
||||
node_flat:node_to_path(Node).
|
||||
|
||||
path_to_node(Path) ->
|
||||
case Path of
|
||||
% default slot
|
||||
[Node] -> list_to_binary(Node);
|
||||
% handle old possible entries, used when migrating database content to new format
|
||||
[Node|_] when is_list(Node) -> list_to_binary(string:join([""|Path], "/"));
|
||||
% default case (used by PEP for example)
|
||||
_ -> list_to_binary(Path)
|
||||
end.
|
||||
node_flat:path_to_node(Path).
|
||||
|
@ -208,7 +208,7 @@ create_node_permission(Host, ServerHost, Node, _ParentNode, Owner, Access) ->
|
||||
case acl:match_rule(ServerHost, Access, exmpp_jid:make(LU, LS, LR)) of
|
||||
allow ->
|
||||
case node_to_path(Node) of
|
||||
["home", Server, User | _] -> true;
|
||||
[<<"home">>, Server, User | _] -> true;
|
||||
_ -> false
|
||||
end;
|
||||
_ ->
|
||||
@ -986,12 +986,12 @@ get_item_name(_Host, _Node, Id) ->
|
||||
Id.
|
||||
|
||||
node_to_path(Node) ->
|
||||
string:tokens(binary_to_list(Node), "/").
|
||||
[list_to_binary(Item) || Item <- string:tokens(binary_to_list(Node), "/")].
|
||||
|
||||
path_to_node([]) ->
|
||||
<<>>;
|
||||
path_to_node(Path) ->
|
||||
list_to_binary(string:join([""|Path], "/")).
|
||||
list_to_binary(string:join([""|[binary_to_list(Item) || Item <- Path]], "/")).
|
||||
|
||||
%% @spec (Affiliation, Subscription) -> true | false
|
||||
%% Affiliation = owner | member | publisher | outcast | none
|
||||
|
@ -239,7 +239,7 @@ create_node(NodeId, Owner) ->
|
||||
%% Removed = [mod_pubsub:pubsubNode()]
|
||||
%% @doc <p>purge items of deleted nodes after effective deletion.</p>
|
||||
delete_node(Removed) ->
|
||||
%% pablo: TODO, this is present on trunk/node_home_tree but not on trunk/node_home_tree_odbc.
|
||||
%% pablo: TODO, this is present on trunk/node_hometree but not on trunk/node_hometree_odbc.
|
||||
%% check what is the desired behaviour
|
||||
%% Tr = fun(#pubsub_state{stateid = {J, _}, subscriptions = Ss}) ->
|
||||
%% lists:map(fun(S) ->
|
||||
@ -1382,9 +1382,7 @@ i2l(L, N) when is_list(L) ->
|
||||
end.
|
||||
|
||||
node_to_path(Node) ->
|
||||
string:tokens(binary_to_list(Node), "/").
|
||||
node_hometree:node_to_path(Node).
|
||||
|
||||
path_to_node([]) ->
|
||||
<<>>;
|
||||
path_to_node(Path) ->
|
||||
list_to_binary(string:join([""|Path], "/")).
|
||||
node_hometree:path_to_node(Path).
|
||||
|
@ -215,7 +215,7 @@ create_node(Host, Node, Type, Owner, Options, Parents) ->
|
||||
[] -> true;
|
||||
[Parent | _] ->
|
||||
case mnesia:read({pubsub_node, {Host, Parent}}) of
|
||||
[#pubsub_node{owners = [{[], Host, []}]}] -> true;
|
||||
[#pubsub_node{owners = [{undefined, Host, undefined}]}] -> true;
|
||||
[#pubsub_node{owners = Owners}] -> lists:member(BJID, Owners);
|
||||
_ -> false
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user