25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +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
%% subscriptions.</p>
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, '_'},
affiliation = owner,
_ = '_'}),

View File

@ -694,8 +694,8 @@ get_entity_subscriptions(Host, Owner) ->
%% nodes having send_last_published_item=on_sub_and_presence
%% as this call avoid seeking node, it must return node and type as well
get_entity_subscriptions_for_send_last(Host, Owner) ->
SubKey = jlib:jid_tolower(Owner),
GenKey = jlib:jid_remove_resource(SubKey),
SubKey = jlib:short_prepd_jid(Owner),
GenKey = jlib:short_prepd_bare_jid(Owner),
H = ?PUBSUB:escape(Host),
SJ = encode_jid(SubKey),
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
%% subscriptions.</p>
get_pending_nodes(Host, Owner) ->
%% pablo TODO, need to port those jlib:* calls to exmpp. Mnesia?
GenKey = jlib:jid_remove_resource(jlib:jid_tolower(Owner)),
KenKey = jlib:short_prepd_bare_jid(Owner),
States = mnesia:match_object(#pubsub_state{stateid = {GenKey, '_'},
affiliation = owner,
_ = '_'}),
@ -1306,7 +1305,7 @@ update_subscription(NodeId, JID, Subscription) ->
"values('", NodeId, "', '", J, "', 'n', '", S, "');"])
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).

View File

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

View File

@ -59,7 +59,7 @@ terminate(Host, ServerHost) ->
nodetree_tree:terminate(Host, ServerHost).
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
false ->
ID = pubsub_index:new(node),