diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2009-10-20 15:03:07 +0000 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2009-10-20 15:03:07 +0000 |
commit | 8ce1e790ac788b8a0c3a2cab352dbb25f4b374f4 (patch) | |
tree | be39dbe996ef704c8a121263e107093f710faa90 /src/mod_pubsub/node_flat.erl | |
parent | Body tag not properly closed in HTTP-Bind (thanks to Janusz Dziemidowicz)(EJA... (diff) |
does not use slash as default separator in nodename (EJAB-667)
SVN Revision: 2687
Diffstat (limited to 'src/mod_pubsub/node_flat.erl')
-rw-r--r-- | src/mod_pubsub/node_flat.erl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/mod_pubsub/node_flat.erl b/src/mod_pubsub/node_flat.erl index 67b95973a..854e64321 100644 --- a/src/mod_pubsub/node_flat.erl +++ b/src/mod_pubsub/node_flat.erl @@ -59,7 +59,9 @@ get_item/7, get_item/2, set_item/1, - get_item_name/3 + get_item_name/3, + node_to_path/1, + path_to_node/1 ]). @@ -179,3 +181,16 @@ set_item(Item) -> get_item_name(Host, Node, Id) -> node_hometree:get_item_name(Host, Node, Id). + +node_to_path(Node) -> + [binary_to_list(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. |