mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
API renaming : lresource -> prep_resource
SVN Revision: 2127
This commit is contained in:
parent
d51d9e9fff
commit
29c0e17ca2
@ -1920,7 +1920,7 @@ check_from(El, FromJID) ->
|
|||||||
{value, SJID} ->
|
{value, SJID} ->
|
||||||
try
|
try
|
||||||
JIDEl = exmpp_jid:parse(SJID),
|
JIDEl = exmpp_jid:parse(SJID),
|
||||||
case exmpp_jid:lresource(JIDEl) of
|
case exmpp_jid:prep_resource(JIDEl) of
|
||||||
undefined ->
|
undefined ->
|
||||||
%% Matching JID: The stanza is ok
|
%% Matching JID: The stanza is ok
|
||||||
case exmpp_jid:compare_bare_jids(JIDEl, FromJID) of
|
case exmpp_jid:compare_bare_jids(JIDEl, FromJID) of
|
||||||
|
@ -304,7 +304,7 @@ do_route(From, To, Packet) ->
|
|||||||
[From, To, Packet, 8]),
|
[From, To, Packet, 8]),
|
||||||
|
|
||||||
LNode = exmpp_jid:prep_node(To),
|
LNode = exmpp_jid:prep_node(To),
|
||||||
LResource = exmpp_jid:lresource(To),
|
LResource = exmpp_jid:prep_resource(To),
|
||||||
if
|
if
|
||||||
LNode /= undefined ->
|
LNode /= undefined ->
|
||||||
ejabberd_sm:route(From, To, Packet);
|
ejabberd_sm:route(From, To, Packet);
|
||||||
|
@ -161,7 +161,7 @@ get_user_resources(User, Server)
|
|||||||
get_user_ip(JID) when ?IS_JID(JID) ->
|
get_user_ip(JID) when ?IS_JID(JID) ->
|
||||||
USR = {exmpp_jid:prep_node(JID),
|
USR = {exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID)},
|
exmpp_jid:prep_resource(JID)},
|
||||||
case mnesia:dirty_index_read(session, USR, #session.usr) of
|
case mnesia:dirty_index_read(session, USR, #session.usr) of
|
||||||
[] ->
|
[] ->
|
||||||
undefined;
|
undefined;
|
||||||
@ -197,7 +197,7 @@ set_presence(SID, JID, Priority, Presence, Info) when ?IS_JID(JID) ->
|
|||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
[exmpp_jid:prep_node(JID),
|
[exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID),
|
exmpp_jid:prep_resource(JID),
|
||||||
Presence]).
|
Presence]).
|
||||||
|
|
||||||
unset_presence(SID, JID, Status, Info) when ?IS_JID(JID)->
|
unset_presence(SID, JID, Status, Info) when ?IS_JID(JID)->
|
||||||
@ -206,7 +206,7 @@ unset_presence(SID, JID, Status, Info) when ?IS_JID(JID)->
|
|||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
[exmpp_jid:prep_node(JID),
|
[exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID),
|
exmpp_jid:prep_resource(JID),
|
||||||
Status]).
|
Status]).
|
||||||
|
|
||||||
close_session_unset_presence(SID, JID, Status) when ?IS_JID(JID) ->
|
close_session_unset_presence(SID, JID, Status) when ?IS_JID(JID) ->
|
||||||
@ -215,13 +215,13 @@ close_session_unset_presence(SID, JID, Status) when ?IS_JID(JID) ->
|
|||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
[exmpp_jid:prep_node(JID),
|
[exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID),
|
exmpp_jid:prep_resource(JID),
|
||||||
Status]).
|
Status]).
|
||||||
|
|
||||||
get_session_pid(JID) when ?IS_JID(JID) ->
|
get_session_pid(JID) when ?IS_JID(JID) ->
|
||||||
USR = {exmpp_jid:prep_node(JID),
|
USR = {exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID)},
|
exmpp_jid:prep_resource(JID)},
|
||||||
case catch mnesia:dirty_index_read(session, USR, #session.usr) of
|
case catch mnesia:dirty_index_read(session, USR, #session.usr) of
|
||||||
[#session{sid = {_, Pid}}] -> Pid;
|
[#session{sid = {_, Pid}}] -> Pid;
|
||||||
_ -> none
|
_ -> none
|
||||||
@ -388,7 +388,7 @@ set_session(SID, JID, Priority, Info) ->
|
|||||||
US = {exmpp_jid:prep_node(JID), exmpp_jid:prep_domain(JID)},
|
US = {exmpp_jid:prep_node(JID), exmpp_jid:prep_domain(JID)},
|
||||||
USR = {exmpp_jid:prep_node(JID),
|
USR = {exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID)},
|
exmpp_jid:prep_resource(JID)},
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
mnesia:write(#session{sid = SID,
|
mnesia:write(#session{sid = SID,
|
||||||
usr = USR,
|
usr = USR,
|
||||||
@ -416,7 +416,7 @@ clean_table_from_bad_node(Node) ->
|
|||||||
do_route(From, To, Packet) ->
|
do_route(From, To, Packet) ->
|
||||||
?DEBUG("session manager~n\tfrom ~p~n\tto ~p~n\tpacket ~P~n",
|
?DEBUG("session manager~n\tfrom ~p~n\tto ~p~n\tpacket ~P~n",
|
||||||
[From, To, Packet, 8]),
|
[From, To, Packet, 8]),
|
||||||
case exmpp_jid:lresource(To) of
|
case exmpp_jid:prep_resource(To) of
|
||||||
undefined ->
|
undefined ->
|
||||||
case Packet of
|
case Packet of
|
||||||
_ when ?IS_PRESENCE(Packet) ->
|
_ when ?IS_PRESENCE(Packet) ->
|
||||||
@ -489,7 +489,7 @@ do_route(From, To, Packet) ->
|
|||||||
_ ->
|
_ ->
|
||||||
USR = {exmpp_jid:prep_node(To),
|
USR = {exmpp_jid:prep_node(To),
|
||||||
exmpp_jid:prep_domain(To),
|
exmpp_jid:prep_domain(To),
|
||||||
exmpp_jid:lresource(To)},
|
exmpp_jid:prep_resource(To)},
|
||||||
case mnesia:dirty_index_read(session, USR, #session.usr) of
|
case mnesia:dirty_index_read(session, USR, #session.usr) of
|
||||||
[] ->
|
[] ->
|
||||||
case Packet of
|
case Packet of
|
||||||
@ -637,7 +637,7 @@ check_for_sessions_to_replace(JID) ->
|
|||||||
check_existing_resources(JID) ->
|
check_existing_resources(JID) ->
|
||||||
USR = {exmpp_jid:prep_node(JID),
|
USR = {exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID)},
|
exmpp_jid:prep_resource(JID)},
|
||||||
%% A connection exist with the same resource. We replace it:
|
%% A connection exist with the same resource. We replace it:
|
||||||
SIDs = mnesia:dirty_select(
|
SIDs = mnesia:dirty_select(
|
||||||
session,
|
session,
|
||||||
|
@ -60,7 +60,7 @@ end,
|
|||||||
gen_server:start_link({local, ?MODULE}, ?MODULE, Opts, []).
|
gen_server:start_link({local, ?MODULE}, ?MODULE, Opts, []).
|
||||||
|
|
||||||
process_command(From, To, Packet) ->
|
process_command(From, To, Packet) ->
|
||||||
case {exmpp_jid:prep_node(To), exmpp_jid:lresource(To) } of
|
case {exmpp_jid:prep_node(To), exmpp_jid:prep_resource(To) } of
|
||||||
{undefined, <<"watchdog">>} ->
|
{undefined, <<"watchdog">>} ->
|
||||||
case Packet#xmlel.name of
|
case Packet#xmlel.name of
|
||||||
'message' ->
|
'message' ->
|
||||||
@ -219,7 +219,7 @@ get_admin_jids() ->
|
|||||||
JID = exmpp_jid:parse(S),
|
JID = exmpp_jid:parse(S),
|
||||||
[{exmpp_jid:prep_node(JID),
|
[{exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID)}]
|
exmpp_jid:prep_resource(JID)}]
|
||||||
catch
|
catch
|
||||||
_ ->
|
_ ->
|
||||||
[]
|
[]
|
||||||
|
@ -384,7 +384,7 @@ short_bare_jid(JID) ->
|
|||||||
short_prepd_jid(JID) ->
|
short_prepd_jid(JID) ->
|
||||||
{exmpp_jid:prep_node(JID),
|
{exmpp_jid:prep_node(JID),
|
||||||
exmpp_jid:prep_domain(JID),
|
exmpp_jid:prep_domain(JID),
|
||||||
exmpp_jid:lresource(JID)}.
|
exmpp_jid:prep_resource(JID)}.
|
||||||
|
|
||||||
short_prepd_bare_jid(JID) ->
|
short_prepd_bare_jid(JID) ->
|
||||||
short_prepd_jid(exmpp_jid:bare(JID)).
|
short_prepd_jid(exmpp_jid:bare(JID)).
|
||||||
|
@ -133,7 +133,7 @@ stop(Host) ->
|
|||||||
|
|
||||||
%% Announcing via messages to a custom resource
|
%% Announcing via messages to a custom resource
|
||||||
announce(From, To, Packet) ->
|
announce(From, To, Packet) ->
|
||||||
case {exmpp_jid:prep_node(To), exmpp_jid:lresource(To)} of
|
case {exmpp_jid:prep_node(To), exmpp_jid:prep_resource(To)} of
|
||||||
{undefined, Res} ->
|
{undefined, Res} ->
|
||||||
Name = Packet#xmlel.name,
|
Name = Packet#xmlel.name,
|
||||||
Proc = gen_mod:get_module_proc(exmpp_jid:prep_domain_as_list(To), ?PROCNAME),
|
Proc = gen_mod:get_module_proc(exmpp_jid:prep_domain_as_list(To), ?PROCNAME),
|
||||||
|
@ -119,7 +119,7 @@ get_caps({U, S, R}, Retry) ->
|
|||||||
|
|
||||||
%% clear_caps removes user caps from database
|
%% clear_caps removes user caps from database
|
||||||
clear_caps(JID) ->
|
clear_caps(JID) ->
|
||||||
R = exmpp_jid:lresource(JID),
|
R = exmpp_jid:prep_resource(JID),
|
||||||
BJID = exmpp_jid:jid_to_binary(JID),
|
BJID = exmpp_jid:jid_to_binary(JID),
|
||||||
BUID = exmpp_jid:bare_jid_to_binary(JID),
|
BUID = exmpp_jid:bare_jid_to_binary(JID),
|
||||||
catch mnesia:dirty_delete({user_caps, BJID}),
|
catch mnesia:dirty_delete({user_caps, BJID}),
|
||||||
|
@ -345,7 +345,7 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
|
|||||||
From, To, Packet, DefRoomOpts) ->
|
From, To, Packet, DefRoomOpts) ->
|
||||||
{_AccessRoute, AccessCreate, AccessAdmin, _AccessPersistent} = Access,
|
{_AccessRoute, AccessCreate, AccessAdmin, _AccessPersistent} = Access,
|
||||||
Room = exmpp_jid:prep_node(To),
|
Room = exmpp_jid:prep_node(To),
|
||||||
Nick = exmpp_jid:lresource(To),
|
Nick = exmpp_jid:prep_resource(To),
|
||||||
#xmlel{name = Name} = Packet,
|
#xmlel{name = Name} = Packet,
|
||||||
case Room of
|
case Room of
|
||||||
'undefined' ->
|
'undefined' ->
|
||||||
|
@ -662,7 +662,7 @@ is_type_match(Type, Value, JID, Subscription, Groups) ->
|
|||||||
{User, Server, Resource} = Value,
|
{User, Server, Resource} = Value,
|
||||||
((User == undefined) orelse (User == []) orelse (User == exmpp_jid:prep_node(JID)))
|
((User == undefined) orelse (User == []) orelse (User == exmpp_jid:prep_node(JID)))
|
||||||
andalso ((Server == undefined) orelse (Server == []) orelse (Server == exmpp_jid:prep_domain(JID)))
|
andalso ((Server == undefined) orelse (Server == []) orelse (Server == exmpp_jid:prep_domain(JID)))
|
||||||
andalso ((Resource == undefined) orelse (Resource == []) orelse (Resource == exmpp_jid:lresource(JID)));
|
andalso ((Resource == undefined) orelse (Resource == []) orelse (Resource == exmpp_jid:prep_resource(JID)));
|
||||||
subscription ->
|
subscription ->
|
||||||
Value == Subscription;
|
Value == Subscription;
|
||||||
group ->
|
group ->
|
||||||
|
@ -661,7 +661,7 @@ is_type_match(Type, Value, JID, Subscription, Groups) ->
|
|||||||
{User, Server, Resource} = Value,
|
{User, Server, Resource} = Value,
|
||||||
((User == undefined) orelse (User == []) orelse (User == exmpp_jid:prep_node(JID)))
|
((User == undefined) orelse (User == []) orelse (User == exmpp_jid:prep_node(JID)))
|
||||||
andalso ((Server == undefined) orelse (Server == []) orelse (Server == exmpp_jid:prep_domain(JID)))
|
andalso ((Server == undefined) orelse (Server == []) orelse (Server == exmpp_jid:prep_domain(JID)))
|
||||||
andalso ((Resource == undefined) orelse (Resource == []) orelse (Resource == exmpp_jid:lresource(JID)));
|
andalso ((Resource == undefined) orelse (Resource == []) orelse (Resource == exmpp_jid:prep_resource(JID)));
|
||||||
subscription ->
|
subscription ->
|
||||||
Value == Subscription;
|
Value == Subscription;
|
||||||
group ->
|
group ->
|
||||||
|
@ -829,7 +829,7 @@ code_change(_OldVsn, State, _Extra) ->
|
|||||||
do_route(ServerHost, Access, Plugins, Host, From, To, Packet) ->
|
do_route(ServerHost, Access, Plugins, Host, From, To, Packet) ->
|
||||||
#xmlel{name = Name} = Packet,
|
#xmlel{name = Name} = Packet,
|
||||||
LNode = exmpp_jid:prep_node(To),
|
LNode = exmpp_jid:prep_node(To),
|
||||||
LRes = exmpp_jid:lresource(To),
|
LRes = exmpp_jid:prep_resource(To),
|
||||||
case {LNode, LRes} of
|
case {LNode, LRes} of
|
||||||
{undefined, undefined} ->
|
{undefined, undefined} ->
|
||||||
case Name of
|
case Name of
|
||||||
|
Loading…
Reference in New Issue
Block a user