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

API renaming : ldomain -> prep_domain

SVN Revision: 2123
This commit is contained in:
Karim Gemayel 2009-06-01 16:37:15 +00:00
parent 526dc54173
commit 19d7d79229
24 changed files with 96 additions and 96 deletions

View File

@ -180,7 +180,7 @@ remove_connection(SID, LUser, LServer) when is_list(LUser), is_list(LServer) ->
register_connection(SID, JID, Info) when ?IS_JID(JID) ->
LUser = exmpp_jid:lnode(JID),
LServer = exmpp_jid:ldomain(JID),
LServer = exmpp_jid:prep_domain(JID),
case proplists:get_value(auth_module, Info) of
undefined ->
ok;
@ -201,7 +201,7 @@ register_connection(SID, JID, Info) when ?IS_JID(JID) ->
unregister_connection(SID, JID, _) when ?IS_JID(JID) ->
LUser = exmpp_jid:lnode(JID),
LServer = exmpp_jid:ldomain(JID),
LServer = exmpp_jid:prep_domain(JID),
purge_hook(anonymous_user_exist(LUser, LServer),
LUser, LServer),
remove_connection(SID, LUser, LServer).

View File

@ -1574,7 +1574,7 @@ check_privacy_route(From, StateData, FromRoute, To, Packet) ->
%% Check if privacy rules allow this delivery
is_privacy_allow(From, To, Packet, PrivacyList) ->
User = exmpp_jid:lnode(To),
Server = exmpp_jid:ldomain(To),
Server = exmpp_jid:prep_domain(To),
allow == ejabberd_hooks:run_fold(
privacy_check_packet, Server,
allow,

View File

@ -76,7 +76,7 @@ start_link() ->
process_iq(From, To, Packet) ->
case exmpp_iq:xmlel_to_iq(Packet) of
#iq{kind = request, ns = XMLNS} = IQ_Rec ->
Host = exmpp_jid:ldomain(To),
Host = exmpp_jid:prep_domain(To),
case ets:lookup(?IQTABLE, {XMLNS, Host}) of
[{_, Module, Function}] ->
ResIQ = Module:Function(From, To, IQ_Rec),
@ -325,7 +325,7 @@ do_route(From, To, Packet) ->
<<"result">> -> ok;
_ ->
ejabberd_hooks:run(local_send_to_resource_hook,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
[From, To, Packet])
end
end.

View File

@ -332,7 +332,7 @@ do_route(OrigFrom, OrigTo, OrigPacket) ->
case ejabberd_hooks:run_fold(filter_packet,
{OrigFrom, OrigTo, OrigPacket}, []) of
{From, To, Packet} ->
LDomain = exmpp_jid:ldomain(To),
LDomain = exmpp_jid:prep_domain(To),
case mnesia:dirty_read(route, LDomain) of
[] ->
ejabberd_s2s:route(From, To, Packet);

View File

@ -283,7 +283,7 @@ do_route(From, To, Packet) ->
?DEBUG("sending to process ~p~n", [Pid]),
NewPacket1 = exmpp_stanza:set_sender(Packet, From),
NewPacket = exmpp_stanza:set_recipient(NewPacket1, To),
MyServer = exmpp_jid:ldomain(From),
MyServer = exmpp_jid:prep_domain(From),
ejabberd_hooks:run(
s2s_send_packet,
MyServer,

View File

@ -406,7 +406,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
(Name == 'presence')) ->
ejabberd_hooks:run(
s2s_receive_packet,
exmpp_jid:ldomain(From),
exmpp_jid:prep_domain(From),
[From, To, El]),
ejabberd_router:route(
From, To, El);
@ -426,7 +426,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
(Name == 'presence')) ->
ejabberd_hooks:run(
s2s_receive_packet,
exmpp_jid:ldomain(From),
exmpp_jid:prep_domain(From),
[From, To, El]),
ejabberd_router:route(
From, To, El);

View File

@ -231,7 +231,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
%% The default is the standard behaviour in XEP-0114
_ ->
FromJID1 = exmpp_jid:parse(From),
Server = exmpp_jid:ldomain(FromJID1),
Server = exmpp_jid:prep_domain(FromJID1),
case lists:member(Server, StateData#state.hosts) of
true -> FromJID1;
false -> error

View File

@ -112,7 +112,7 @@ route(From, To, Packet) ->
open_session(SID, JID, Info) when ?IS_JID(JID) ->
set_session(SID, JID, undefined, Info),
check_for_sessions_to_replace(JID),
ejabberd_hooks:run(sm_register_connection_hook, exmpp_jid:ldomain(JID),
ejabberd_hooks:run(sm_register_connection_hook, exmpp_jid:prep_domain(JID),
[SID, JID, Info]).
close_session(SID, JID ) when ?IS_JID(JID)->
@ -124,7 +124,7 @@ close_session(SID, JID ) when ?IS_JID(JID)->
mnesia:delete({session, SID})
end,
mnesia:sync_dirty(F),
ejabberd_hooks:run(sm_remove_connection_hook, exmpp_jid:ldomain(JID),
ejabberd_hooks:run(sm_remove_connection_hook, exmpp_jid:prep_domain(JID),
[SID, JID, Info]).
check_in_subscription(Acc, User, Server, _JID, _Type, _Reason)
@ -160,7 +160,7 @@ get_user_resources(User, Server)
get_user_ip(JID) when ?IS_JID(JID) ->
USR = {exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID)},
case mnesia:dirty_index_read(session, USR, #session.usr) of
[] ->
@ -194,33 +194,33 @@ get_user_info(User, Server, Resource)
set_presence(SID, JID, Priority, Presence, Info) when ?IS_JID(JID) ->
set_session(SID, JID, Priority, Info),
ejabberd_hooks:run(set_presence_hook,
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
[exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID),
Presence]).
unset_presence(SID, JID, Status, Info) when ?IS_JID(JID)->
set_session(SID, JID, undefined, Info),
ejabberd_hooks:run(unset_presence_hook,
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
[exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID),
Status]).
close_session_unset_presence(SID, JID, Status) when ?IS_JID(JID) ->
close_session(SID, JID),
ejabberd_hooks:run(unset_presence_hook,
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
[exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID),
Status]).
get_session_pid(JID) when ?IS_JID(JID) ->
USR = {exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID)},
case catch mnesia:dirty_index_read(session, USR, #session.usr) of
[#session{sid = {_, Pid}}] -> Pid;
@ -385,9 +385,9 @@ code_change(_OldVsn, State, _Extra) ->
%%--------------------------------------------------------------------
set_session(SID, JID, Priority, Info) ->
US = {exmpp_jid:lnode(JID), exmpp_jid:ldomain(JID)},
US = {exmpp_jid:lnode(JID), exmpp_jid:prep_domain(JID)},
USR = {exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID)},
F = fun() ->
mnesia:write(#session{sid = SID,
@ -427,40 +427,40 @@ do_route(From, To, Packet) ->
{is_privacy_allow(From, To, Packet) andalso
ejabberd_hooks:run_fold(
roster_in_subscription,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
false,
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To), From, subscribe, Reason]),
[exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), From, subscribe, Reason]),
true};
'subscribed' ->
{is_privacy_allow(From, To, Packet) andalso
ejabberd_hooks:run_fold(
roster_in_subscription,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
false,
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To), From, subscribed, <<>>]),
[exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), From, subscribed, <<>>]),
true};
'unsubscribe' ->
{is_privacy_allow(From, To, Packet) andalso
ejabberd_hooks:run_fold(
roster_in_subscription,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
false,
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To), From, unsubscribe, <<>>]),
[exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), From, unsubscribe, <<>>]),
true};
'unsubscribed' ->
{is_privacy_allow(From, To, Packet) andalso
ejabberd_hooks:run_fold(
roster_in_subscription,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
false,
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To), From, unsubscribed, <<>>]),
[exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), From, unsubscribed, <<>>]),
true};
_ ->
{true, false}
end,
if Pass ->
PResources = get_user_present_resources(
exmpp_jid:lnode(To), exmpp_jid:ldomain(To)),
exmpp_jid:lnode(To), exmpp_jid:prep_domain(To)),
lists:foreach(
fun({_, R}) ->
do_route(
@ -482,13 +482,13 @@ do_route(From, To, Packet) ->
exmpp_jid:full(To, R),
Packet)
end, get_user_resources(exmpp_jid:lnode(To),
exmpp_jid:ldomain(To)));
exmpp_jid:prep_domain(To)));
_ ->
ok
end;
_ ->
USR = {exmpp_jid:lnode(To),
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
exmpp_jid:lresource(To)},
case mnesia:dirty_index_read(session, USR, #session.usr) of
[] ->
@ -522,7 +522,7 @@ do_route(From, To, Packet) ->
%% or if there are no current sessions for the user.
is_privacy_allow(From, To, Packet) ->
User = exmpp_jid:lnode(To),
Server = exmpp_jid:ldomain(To),
Server = exmpp_jid:prep_domain(To),
PrivacyList = ejabberd_hooks:run_fold(privacy_get_user_list, Server,
#userlist{}, [User, Server]),
is_privacy_allow(From, To, Packet, PrivacyList).
@ -531,7 +531,7 @@ is_privacy_allow(From, To, Packet) ->
%% Function copied from ejabberd_c2s.erl
is_privacy_allow(From, To, Packet, PrivacyList) ->
User = exmpp_jid:lnode(To),
Server = exmpp_jid:ldomain(To),
Server = exmpp_jid:prep_domain(To),
allow == ejabberd_hooks:run_fold(
privacy_check_packet, Server,
allow,
@ -543,7 +543,7 @@ is_privacy_allow(From, To, Packet, PrivacyList) ->
route_message(From, To, Packet) ->
LUser = exmpp_jid:lnode(To),
LServer = exmpp_jid:ldomain(To),
LServer = exmpp_jid:prep_domain(To),
PrioRes = get_user_present_resources(LUser, LServer),
case catch lists:max(PrioRes) of
{Priority, _R} when is_integer(Priority), Priority >= 0 ->
@ -579,7 +579,7 @@ route_message(From, To, Packet) ->
exmpp_jid:ldomain_as_list(To)) of
true ->
ejabberd_hooks:run(offline_message_hook,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
[From, To, Packet]);
_ ->
Err = exmpp_stanza:reply_with_error(
@ -636,7 +636,7 @@ check_for_sessions_to_replace(JID) ->
check_existing_resources(JID) ->
USR = {exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID)},
%% A connection exist with the same resource. We replace it:
SIDs = mnesia:dirty_select(
@ -659,7 +659,7 @@ check_max_sessions(JID) ->
SIDs = mnesia:dirty_select(
session,
[{#session{sid = '$1',
us = {exmpp_jid:lnode(JID), exmpp_jid:ldomain(JID)},
us = {exmpp_jid:lnode(JID), exmpp_jid:prep_domain(JID)},
_ = '_'}, [],
['$1']}]),
MaxSessions = get_max_user_sessions(JID),
@ -690,7 +690,7 @@ get_max_user_sessions(JID) ->
process_iq(From, To, Packet) ->
case exmpp_iq:xmlel_to_iq(Packet) of
#iq{kind = request, ns = XMLNS} = IQ_Rec ->
LServer = exmpp_jid:ldomain(To),
LServer = exmpp_jid:prep_domain(To),
case ets:lookup(sm_iqtable, {XMLNS, LServer}) of
[{_, Module, Function}] ->
ResIQ = Module:Function(From, To, IQ_Rec),

View File

@ -218,7 +218,7 @@ get_admin_jids() ->
try
JID = exmpp_jid:parse(S),
[{exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID)}]
catch
_ ->

View File

@ -383,7 +383,7 @@ short_bare_jid(JID) ->
short_prepd_jid(JID) ->
{exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
exmpp_jid:lresource(JID)}.
short_prepd_bare_jid(JID) ->

View File

@ -103,7 +103,7 @@ get_local_commands(Acc, _From, To, <<>>, Lang) ->
end;
get_local_commands(_Acc, From, To, ?NS_ADHOC_b, Lang) ->
ejabberd_hooks:run_fold(adhoc_local_items, exmpp_jid:ldomain(To), {result, []}, [From, To, Lang]);
ejabberd_hooks:run_fold(adhoc_local_items, exmpp_jid:prep_domain(To), {result, []}, [From, To, Lang]);
get_local_commands(_Acc, _From, _To, <<"ping">>, _Lang) ->
{result, []};
@ -134,7 +134,7 @@ get_sm_commands(Acc, _From, To, <<>>, Lang) ->
end;
get_sm_commands(_Acc, From, To, ?NS_ADHOC_b, Lang) ->
ejabberd_hooks:run_fold(adhoc_sm_items, exmpp_jid:ldomain(To), {result, []}, [From, To, Lang]);
ejabberd_hooks:run_fold(adhoc_sm_items, exmpp_jid:prep_domain(To), {result, []}, [From, To, Lang]);
get_sm_commands(Acc, _From, _To, _Node, _Lang) ->
Acc.
@ -221,7 +221,7 @@ process_adhoc_request(From, To, IQ_Rec, Hook) ->
{error, Error} ->
exmpp_iq:error(IQ_Rec, Error);
#adhoc_request{} = AdhocRequest ->
case ejabberd_hooks:run_fold(Hook, exmpp_jid:ldomain(To), empty,
case ejabberd_hooks:run_fold(Hook, exmpp_jid:prep_domain(To), empty,
[From, To, AdhocRequest]) of
ignore ->
ignore;

View File

@ -702,7 +702,7 @@ announce_online(From, To, Packet) ->
Err = exmpp_stanza:reply_with_error(Packet, 'forbidden'),
ejabberd_router:route(To, From, Err);
allow ->
announce_online1(ejabberd_sm:get_vh_session_list(exmpp_jid:ldomain(To)),
announce_online1(ejabberd_sm:get_vh_session_list(exmpp_jid:prep_domain(To)),
exmpp_jid:domain_as_list(To),
Packet)
end.
@ -837,7 +837,7 @@ send_motd(JID) ->
[#motd_users{}] ->
ok;
_ ->
Local = exmpp_jid:make(exmpp_jid:ldomain(JID)),
Local = exmpp_jid:make(exmpp_jid:prep_domain(JID)),
ejabberd_router:route(Local, JID, Packet),
F = fun() ->
mnesia:write(#motd_users{us = US})

View File

@ -315,7 +315,7 @@ handle_cast({note_caps, From,
%% lots of caps disco requests.
%#jid{node = U, domain = S, resource = R} = From,
U = exmpp_jid:lnode(From),
S = exmpp_jid:ldomain(From),
S = exmpp_jid:prep_domain(From),
R = exmpp_jid:resource(From),
BJID = exmpp_jid:jid_to_binary(From),
mnesia:transaction(fun() ->

View File

@ -299,7 +299,7 @@ get_sm_items(Acc, From, To, Node, Lang) ->
get_user_resources(BareJID) ->
Rs = ejabberd_sm:get_user_resources(exmpp_jid:lnode(BareJID),
exmpp_jid:ldomain(BareJID)),
exmpp_jid:prep_domain(BareJID)),
lists:map(fun(R) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid',
@ -1641,7 +1641,7 @@ set_form(From, Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) ->
%% TODO: Update time format to XEP-0202: Entity Time
FLast =
case ejabberd_sm:get_user_resources(exmpp_jid:lnode(User),
exmpp_jid:ldomain(Server)) of
exmpp_jid:prep_domain(Server)) of
[] ->
_US = {User, Server},
case get_last_info(User, Server) of
@ -1676,13 +1676,13 @@ set_form(From, Host, ?NS_ADMINL("user-stats"), Lang, XData) ->
true = (Server == Host) orelse (get_permission_level(From) == global),
Resources = ejabberd_sm:get_user_resources(exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID)),
exmpp_jid:prep_domain(JID)),
IPs1 = [ejabberd_sm:get_user_ip(exmpp_jid:full(JID,Resource))
|| Resource <- Resources],
IPs = [inet_parse:ntoa(IP)++":"++integer_to_list(Port) || {IP, Port} <- IPs1],
Items = ejabberd_hooks:run_fold(roster_get,
exmpp_jid:ldomain(JID),
exmpp_jid:prep_domain(JID),
[],
[{list_to_binary(User), list_to_binary(Server)}]),
Rostersize = integer_to_list(erlang:length(Items)),

View File

@ -133,7 +133,7 @@ process_local_iq_items(From, To, #iq{type = get, payload = SubEl,
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
case ejabberd_hooks:run_fold(disco_local_items,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
empty,
[From, To, Node, Lang]) of
{result, Items} ->
@ -155,11 +155,11 @@ process_local_iq_info(From, To, #iq{type = get, payload = SubEl,
lang = Lang} = IQ_Rec) ->
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
Identity = ejabberd_hooks:run_fold(disco_local_identity,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
[],
[From, To, Node, Lang]),
case ejabberd_hooks:run_fold(disco_local_features,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
empty,
[From, To, Node, Lang]) of
{result, Features} ->
@ -274,7 +274,7 @@ process_sm_iq_items(From, To, #iq{type = get, payload = SubEl,
lang = Lang} = IQ_Rec) ->
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
case ejabberd_hooks:run_fold(disco_sm_items,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
empty,
[From, To, Node, Lang]) of
{result, Items} ->
@ -348,11 +348,11 @@ process_sm_iq_info(From, To, #iq{type = get, payload = SubEl,
lang = Lang} = IQ_Rec) ->
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
Identity = ejabberd_hooks:run_fold(disco_sm_identity,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
[],
[From, To, Node, Lang]),
case ejabberd_hooks:run_fold(disco_sm_features,
exmpp_jid:ldomain(To),
exmpp_jid:prep_domain(To),
empty,
[From, To, Node, Lang]) of
{result, Features} ->
@ -393,7 +393,7 @@ get_sm_features(Acc, _From, _To, _Node, _Lang) ->
get_user_resources(JID) ->
Rs = ejabberd_sm:get_user_resources(exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID)),
exmpp_jid:prep_domain(JID)),
lists:map(fun(R) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
?XMLATTR('jid',

View File

@ -105,23 +105,23 @@ now_to_seconds({MegaSecs, Secs, _MicroSecs}) ->
process_sm_iq(From, To, #iq{type = get} = IQ_Rec) ->
{Subscription, _Groups} =
ejabberd_hooks:run_fold(
roster_get_jid_info, exmpp_jid:ldomain(To),
{none, []}, [exmpp_jid:lnode(To), exmpp_jid:ldomain(To), From]),
roster_get_jid_info, exmpp_jid:prep_domain(To),
{none, []}, [exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), From]),
if
(Subscription == both) or (Subscription == from) ->
UserListRecord = ejabberd_hooks:run_fold(
privacy_get_user_list, exmpp_jid:ldomain(To),
privacy_get_user_list, exmpp_jid:prep_domain(To),
#userlist{},
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To)]),
[exmpp_jid:lnode(To), exmpp_jid:prep_domain(To)]),
case ejabberd_hooks:run_fold(
privacy_check_packet, exmpp_jid:ldomain(To),
privacy_check_packet, exmpp_jid:prep_domain(To),
allow,
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To), UserListRecord,
[exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), UserListRecord,
{From, To,
exmpp_presence:available()},
out]) of
allow ->
get_last(IQ_Rec, exmpp_jid:lnode(To), exmpp_jid:ldomain(To));
get_last(IQ_Rec, exmpp_jid:lnode(To), exmpp_jid:prep_domain(To));
deny ->
exmpp_iq:error(IQ_Rec, 'not-allowed')
end;

View File

@ -99,18 +99,18 @@ process_sm_iq(From, To, #iq{type = get} = IQ_Rec) ->
Server = exmpp_jid:ldomain_as_list(To),
{Subscription, _Groups} =
ejabberd_hooks:run_fold(
roster_get_jid_info, exmpp_jid:ldomain(To),
{none, []}, [exmpp_jid:lnode(To), exmpp_jid:ldomain(To), From]),
roster_get_jid_info, exmpp_jid:prep_domain(To),
{none, []}, [exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), From]),
if
(Subscription == both) or (Subscription == from) ->
UserListRecord = ejabberd_hooks:run_fold(
privacy_get_user_list, exmpp_jid:ldomain(To),
privacy_get_user_list, exmpp_jid:prep_domain(To),
#userlist{},
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To)]),
[exmpp_jid:lnode(To), exmpp_jid:prep_domain(To)]),
case ejabberd_hooks:run_fold(
privacy_check_packet, exmpp_jid:ldomain(To),
privacy_check_packet, exmpp_jid:prep_domain(To),
allow,
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To), UserListRecord,
[exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), UserListRecord,
{From, To,
exmpp_presence:available()},
out]) of

View File

@ -146,7 +146,7 @@ process_iq_disco_items(Host, From, To, #iq{lang = Lang} = IQ) when is_binary(Hos
can_use_nick(_Host, _JID, <<>>) ->
false;
can_use_nick(Host, JID, Nick) when is_binary(Host), is_binary(Nick) ->
LUS = {exmpp_jid:lnode(JID), exmpp_jid:ldomain(JID)},
LUS = {exmpp_jid:lnode(JID), exmpp_jid:prep_domain(JID)},
case catch mnesia:dirty_select(
muc_registered,
[{#muc_registered{us_host = '$1',
@ -662,7 +662,7 @@ flush() ->
iq_get_register_info(Host, From, Lang) ->
LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From),
LServer = exmpp_jid:prep_domain(From),
LUS = {LUser, LServer},
{Nick, Registered} =
case catch mnesia:dirty_read(muc_registered, {LUS, Host}) of
@ -692,7 +692,7 @@ iq_get_register_info(Host, From, Lang) ->
iq_set_register_info(Host, From, Nick, Lang) when is_binary(Host), is_binary(Nick) ->
LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From),
LServer = exmpp_jid:prep_domain(From),
LUS = {LUser, LServer},
F = fun() ->
case Nick of

View File

@ -3495,7 +3495,7 @@ add_to_log(Type, Data, StateData) ->
tab_add_online_user(JID, StateData) ->
LUser = exmpp_jid:lnode(JID),
LServer = exmpp_jid:ldomain(JID),
LServer = exmpp_jid:prep_domain(JID),
US = {LUser, LServer},
Room = StateData#state.room,
Host = StateData#state.host,
@ -3507,7 +3507,7 @@ tab_add_online_user(JID, StateData) ->
tab_remove_online_user(JID, StateData) when ?IS_JID(JID) ->
LUser = exmpp_jid:lnode(JID),
LServer = exmpp_jid:ldomain(JID),
LServer = exmpp_jid:prep_domain(JID),
tab_remove_online_user({LUser, LServer, none},StateData);
tab_remove_online_user({LUser, LServer,_}, StateData) ->
@ -3520,7 +3520,7 @@ tab_remove_online_user({LUser, LServer,_}, StateData) ->
tab_count_user(JID) ->
LUser = exmpp_jid:lnode(JID),
LServer = exmpp_jid:ldomain(JID),
LServer = exmpp_jid:prep_domain(JID),
US = {LUser, LServer},
case catch ets:select(
muc_online_users,

View File

@ -661,7 +661,7 @@ is_type_match(Type, Value, JID, Subscription, Groups) ->
jid ->
{User, Server, Resource} = Value,
((User == undefined) orelse (User == []) orelse (User == exmpp_jid:lnode(JID)))
andalso ((Server == undefined) orelse (Server == []) orelse (Server == exmpp_jid:ldomain(JID)))
andalso ((Server == undefined) orelse (Server == []) orelse (Server == exmpp_jid:prep_domain(JID)))
andalso ((Resource == undefined) orelse (Resource == []) orelse (Resource == exmpp_jid:lresource(JID)));
subscription ->
Value == Subscription;

View File

@ -660,7 +660,7 @@ is_type_match(Type, Value, JID, Subscription, Groups) ->
jid ->
{User, Server, Resource} = Value,
((User == undefined) orelse (User == []) orelse (User == exmpp_jid:lnode(JID)))
andalso ((Server == undefined) orelse (Server == []) orelse (Server == exmpp_jid:ldomain(JID)))
andalso ((Server == undefined) orelse (Server == []) orelse (Server == exmpp_jid:prep_domain(JID)))
andalso ((Resource == undefined) orelse (Resource == []) orelse (Resource == exmpp_jid:lresource(JID)));
subscription ->
Value == Subscription;

View File

@ -74,7 +74,7 @@ process_sm_iq(From, To, #iq{type = Type} = IQ_Rec) ->
process_iq_get(From, _To, #iq{payload = SubEl} = IQ_Rec) ->
LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From),
LServer = exmpp_jid:prep_domain(From),
case catch get_data(LUser,
LServer,
exmpp_xml:get_child_elements(SubEl)) of
@ -89,7 +89,7 @@ process_iq_get(From, _To, #iq{payload = SubEl} = IQ_Rec) ->
process_iq_set(From, _To, #iq{payload = SubEl} = IQ_Rec) ->
LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From),
LServer = exmpp_jid:prep_domain(From),
F = fun() ->
lists:foreach(
fun(El) ->

View File

@ -163,8 +163,8 @@ process_local_iq(From, To, #iq{type = set} = IQ_Rec)
%% IQ_Result = exmpp_iq:iq()
process_iq_get(From, To, IQ_Rec) ->
US = {exmpp_jid:lnode(From), exmpp_jid:ldomain(From)},
case catch ejabberd_hooks:run_fold(roster_get, exmpp_jid:ldomain(To), [], [US]) of
US = {exmpp_jid:lnode(From), exmpp_jid:prep_domain(From)},
case catch ejabberd_hooks:run_fold(roster_get, exmpp_jid:prep_domain(To), [], [US]) of
Items when is_list(Items) ->
XItems = lists:map(fun item_to_xml/1, Items),
Result = #xmlel{ns = ?NS_ROSTER, name = 'query',
@ -251,7 +251,7 @@ process_item_set(From, To, #xmlel{} = El) ->
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, 'jid', <<>>)),
User = exmpp_jid:node(From),
LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From),
LServer = exmpp_jid:prep_domain(From),
JID = jlib:short_jid(JID1),
LJID = jlib:short_prepd_jid(JID1),
F = fun() ->
@ -279,7 +279,7 @@ process_item_set(From, To, #xmlel{} = El) ->
%% If the item exist in shared roster, take the
%% subscription information from there:
Item3 = ejabberd_hooks:run_fold(roster_process_item,
exmpp_jid:ldomain(From), Item2, [exmpp_jid:ldomain(From)]),
exmpp_jid:prep_domain(From), Item2, [exmpp_jid:prep_domain(From)]),
{Item, Item3}
end,
case mnesia:transaction(F) of
@ -844,7 +844,7 @@ process_item_attrs_ws(Item, []) ->
get_in_pending_subscriptions(Ls, User, Server)
when is_binary(User), is_binary(Server) ->
JID = exmpp_jid:make(User, Server),
US = {exmpp_jid:lnode(JID), exmpp_jid:ldomain(JID)},
US = {exmpp_jid:lnode(JID), exmpp_jid:prep_domain(JID)},
case mnesia:dirty_index_read(roster, US, #roster.us) of
Result when is_list(Result) ->
Ls ++ lists:map(
@ -1185,7 +1185,7 @@ user_roster(User, Server, Query, Lang) ->
build_contact_jid_td({U, S, R}) ->
%% Convert {U, S, R} into {jid, U, S, R, U, S, R}:
ContactJID = exmpp_jid:make(U, S, R),
JIDURI = case {exmpp_jid:lnode(ContactJID), exmpp_jid:ldomain(ContactJID)} of
JIDURI = case {exmpp_jid:lnode(ContactJID), exmpp_jid:prep_domain(ContactJID)} of
{undefined, _} -> "";
{CUser, CServer} ->
CUser_S = binary_to_list(CUser),

View File

@ -119,8 +119,8 @@ process_local_iq(From, To, #iq{type = set} = IQ_Rec) ->
process_iq_get(From, To, IQ_Rec) ->
US = {exmpp_jid:lnode(From), exmpp_jid:ldomain(From)},
case catch ejabberd_hooks:run_fold(roster_get, exmpp_jid:ldomain(To), [], [US]) of
US = {exmpp_jid:lnode(From), exmpp_jid:prep_domain(From)},
case catch ejabberd_hooks:run_fold(roster_get, exmpp_jid:prep_domain(To), [], [US]) of
Items when is_list(Items) ->
XItems = lists:map(fun item_to_xml/1, Items),
Result = #xmlel{ns = ?NS_ROSTER, name = 'query',
@ -218,7 +218,7 @@ process_item_set(From, To, #xmlel{} = El) ->
try
JID1 = exmpp_jid:parse(exmpp_xml:get_attribute_as_binary(El, 'jid', <<>>)),
User = exmpp_jid:lnode(From),
Server = exmpp_jid:ldomain(From),
Server = exmpp_jid:prep_domain(From),
LServer = binary_to_list(Server),
{U0, S0, R0} = LJID = jlib:short_prepd_jid(JID1),
Username = ejabberd_odbc:escape(User),
@ -234,7 +234,7 @@ process_item_set(From, To, #xmlel{} = El) ->
us = {User, Server},
jid = LJID};
[I] ->
R = raw_to_record(exmpp_jid:ldomain(From), I),
R = raw_to_record(exmpp_jid:prep_domain(From), I),
case R of
%% Bad JID in database:
error ->
@ -263,12 +263,12 @@ process_item_set(From, To, #xmlel{} = El) ->
%% If the item exist in shared roster, take the
%% subscription information from there:
Item3 = ejabberd_hooks:run_fold(roster_process_item,
exmpp_jid:ldomain(From), Item2, [exmpp_jid:ldomain(From)]),
exmpp_jid:prep_domain(From), Item2, [exmpp_jid:prep_domain(From)]),
{Item, Item3}
end,
case odbc_queries:sql_transaction(LServer, F) of
{atomic, {OldItem, Item}} ->
push_item(exmpp_jid:node(From), exmpp_jid:ldomain(From), To, Item),
push_item(exmpp_jid:node(From), exmpp_jid:prep_domain(From), To, Item),
case Item#roster.subscription of
remove ->
IsTo = case OldItem#roster.subscription of
@ -774,7 +774,7 @@ get_in_pending_subscriptions(Ls, User, Server)
end,
lists:flatmap(
fun(I) ->
case raw_to_record(exmpp_jid:ldomain(JID), I) of
case raw_to_record(exmpp_jid:prep_domain(JID), I) of
%% Bad JID in database:
error ->
[];
@ -1020,7 +1020,7 @@ user_roster(User, Server, Query, Lang) ->
build_contact_jid_td({U, S, R}) ->
%% Convert {U, S, R} into {jid, U, S, R, U, S, R}:
ContactJID = exmpp_jid:make(U, S, R),
JIDURI = case {exmpp_jid:lnode(ContactJID), exmpp_jid:ldomain(ContactJID)} of
JIDURI = case {exmpp_jid:lnode(ContactJID), exmpp_jid:prep_domain(ContactJID)} of
{undefined, _} -> "";
{CUser, CServer} ->
CUser_S = binary_to_list(CUser),