25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

finish port to exmpp calls on jid transformation

This commit is contained in:
Christophe Romain 2010-05-18 15:20:41 +02:00
parent f6e4d95c6f
commit 95057c1182
4 changed files with 10 additions and 12 deletions

View File

@ -750,7 +750,7 @@ unsub_with_subid(NodeId, SubId, SubState) ->
%% @doc <p>Returns a list of Owner's nodes on Host with pending %% @doc <p>Returns a list of Owner's nodes on Host with pending
%% subscriptions.</p> %% subscriptions.</p>
get_pending_nodes(Host, Owner) -> get_pending_nodes(Host, Owner) ->
GenKey = jlib:jid_remove_resource(jlib:jid_tolower(Owner)), GenKey = jlib:short_prepd_bare_jid(Owner),
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'},
affiliation = owner, affiliation = owner,
_ = '_'}), _ = '_'}),

View File

@ -694,8 +694,8 @@ get_entity_subscriptions(Host, Owner) ->
%% nodes having send_last_published_item=on_sub_and_presence %% nodes having send_last_published_item=on_sub_and_presence
%% as this call avoid seeking node, it must return node and type as well %% as this call avoid seeking node, it must return node and type as well
get_entity_subscriptions_for_send_last(Host, Owner) -> get_entity_subscriptions_for_send_last(Host, Owner) ->
SubKey = jlib:jid_tolower(Owner), SubKey = jlib:short_prepd_jid(Owner),
GenKey = jlib:jid_remove_resource(SubKey), GenKey = jlib:short_prepd_bare_jid(Owner),
H = ?PUBSUB:escape(Host), H = ?PUBSUB:escape(Host),
SJ = encode_jid(SubKey), SJ = encode_jid(SubKey),
GJ = encode_jid(GenKey), GJ = encode_jid(GenKey),
@ -830,8 +830,7 @@ unsub_with_subid(NodeId, SubId, SubState) ->
%% @doc <p>Returns a list of Owner's nodes on Host with pending %% @doc <p>Returns a list of Owner's nodes on Host with pending
%% subscriptions.</p> %% subscriptions.</p>
get_pending_nodes(Host, Owner) -> get_pending_nodes(Host, Owner) ->
%% pablo TODO, need to port those jlib:* calls to exmpp. Mnesia? KenKey = jlib:short_prepd_bare_jid(Owner),
GenKey = jlib:jid_remove_resource(jlib:jid_tolower(Owner)),
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'},
affiliation = owner, affiliation = owner,
_ = '_'}), _ = '_'}),
@ -1306,7 +1305,7 @@ update_subscription(NodeId, JID, Subscription) ->
"values('", NodeId, "', '", J, "', 'n', '", S, "');"]) "values('", NodeId, "', '", J, "', 'n', '", S, "');"])
end. end.
decode_jid(SJID) -> jlib:jid_tolower(jlib:string_to_jid(SJID)). decode_jid(SJID) -> jlib:short_prepd_jid(jlib:string_to_jid(SJID)).
decode_node(N) -> ?PUBSUB:string_to_node(N). decode_node(N) -> ?PUBSUB:string_to_node(N).

View File

@ -175,9 +175,8 @@ purge_node(NodeId, Owner) ->
node_flat:purge_node(NodeId, Owner). node_flat:purge_node(NodeId, Owner).
get_entity_affiliations(_Host, Owner) -> get_entity_affiliations(_Host, Owner) ->
{_, D, _} = SubKey = jlib:jid_tolower(Owner), {_, D, _} = SubKey = jlib:short_prepd_jid(Owner),
SubKey = jlib:jid_tolower(Owner), GenKey = jlib:short_prepd_bare_jid(Owner),
GenKey = jlib:jid_remove_resource(SubKey),
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, _ = '_'}), States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'}, _ = '_'}),
NodeTree = case catch ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of NodeTree = case catch ets:lookup(gen_mod:get_module_proc(D, config), nodetree) of
[{nodetree, N}] -> N; [{nodetree, N}] -> N;
@ -201,8 +200,8 @@ set_affiliation(NodeId, Owner, Affiliation) ->
node_flat:set_affiliation(NodeId, Owner, Affiliation). node_flat:set_affiliation(NodeId, Owner, Affiliation).
get_entity_subscriptions(_Host, Owner) -> get_entity_subscriptions(_Host, Owner) ->
{U, D, _} = SubKey = jlib:jid_tolower(Owner), {U, D, _} = SubKey = jlib:short_prepd_jid(Owner),
GenKey = jlib:jid_remove_resource(SubKey), GenKey = jlib:short_prepd_bare_jid(Owner),
States = case SubKey of States = case SubKey of
GenKey -> mnesia:match_object( GenKey -> mnesia:match_object(
#pubsub_state{stateid = {{U, D, '_'}, '_'}, _ = '_'}); #pubsub_state{stateid = {{U, D, '_'}, '_'}, _ = '_'});

View File

@ -59,7 +59,7 @@ terminate(Host, ServerHost) ->
nodetree_tree:terminate(Host, ServerHost). nodetree_tree:terminate(Host, ServerHost).
create_node(Key, NodeID, Type, Owner, Options, Parents) -> create_node(Key, NodeID, Type, Owner, Options, Parents) ->
OwnerJID = jlib:jid_tolower(jlib:jid_remove_resource(Owner)), OwnerJID = jlib:short_prepd_bare_jid(Owner),
case find_node(Key, NodeID) of case find_node(Key, NodeID) of
false -> false ->
ID = pubsub_index:new(node), ID = pubsub_index:new(node),