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) -> register_connection(SID, JID, Info) when ?IS_JID(JID) ->
LUser = exmpp_jid:lnode(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 case proplists:get_value(auth_module, Info) of
undefined -> undefined ->
ok; ok;
@ -201,7 +201,7 @@ register_connection(SID, JID, Info) when ?IS_JID(JID) ->
unregister_connection(SID, JID, _) when ?IS_JID(JID) -> unregister_connection(SID, JID, _) when ?IS_JID(JID) ->
LUser = exmpp_jid:lnode(JID), LUser = exmpp_jid:lnode(JID),
LServer = exmpp_jid:ldomain(JID), LServer = exmpp_jid:prep_domain(JID),
purge_hook(anonymous_user_exist(LUser, LServer), purge_hook(anonymous_user_exist(LUser, LServer),
LUser, LServer), LUser, LServer),
remove_connection(SID, 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 %% Check if privacy rules allow this delivery
is_privacy_allow(From, To, Packet, PrivacyList) -> is_privacy_allow(From, To, Packet, PrivacyList) ->
User = exmpp_jid:lnode(To), User = exmpp_jid:lnode(To),
Server = exmpp_jid:ldomain(To), Server = exmpp_jid:prep_domain(To),
allow == ejabberd_hooks:run_fold( allow == ejabberd_hooks:run_fold(
privacy_check_packet, Server, privacy_check_packet, Server,
allow, allow,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -103,7 +103,7 @@ get_local_commands(Acc, _From, To, <<>>, Lang) ->
end; end;
get_local_commands(_Acc, From, To, ?NS_ADHOC_b, Lang) -> 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) -> get_local_commands(_Acc, _From, _To, <<"ping">>, _Lang) ->
{result, []}; {result, []};
@ -134,7 +134,7 @@ get_sm_commands(Acc, _From, To, <<>>, Lang) ->
end; end;
get_sm_commands(_Acc, From, To, ?NS_ADHOC_b, Lang) -> 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) -> get_sm_commands(Acc, _From, _To, _Node, _Lang) ->
Acc. Acc.
@ -221,7 +221,7 @@ process_adhoc_request(From, To, IQ_Rec, Hook) ->
{error, Error} -> {error, Error} ->
exmpp_iq:error(IQ_Rec, Error); exmpp_iq:error(IQ_Rec, Error);
#adhoc_request{} = AdhocRequest -> #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 [From, To, AdhocRequest]) of
ignore -> ignore ->
ignore; ignore;

View File

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

View File

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

View File

@ -299,7 +299,7 @@ get_sm_items(Acc, From, To, Node, Lang) ->
get_user_resources(BareJID) -> get_user_resources(BareJID) ->
Rs = ejabberd_sm:get_user_resources(exmpp_jid:lnode(BareJID), Rs = ejabberd_sm:get_user_resources(exmpp_jid:lnode(BareJID),
exmpp_jid:ldomain(BareJID)), exmpp_jid:prep_domain(BareJID)),
lists:map(fun(R) -> lists:map(fun(R) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[?XMLATTR('jid', [?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 %% TODO: Update time format to XEP-0202: Entity Time
FLast = FLast =
case ejabberd_sm:get_user_resources(exmpp_jid:lnode(User), case ejabberd_sm:get_user_resources(exmpp_jid:lnode(User),
exmpp_jid:ldomain(Server)) of exmpp_jid:prep_domain(Server)) of
[] -> [] ->
_US = {User, Server}, _US = {User, Server},
case get_last_info(User, Server) of 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), true = (Server == Host) orelse (get_permission_level(From) == global),
Resources = ejabberd_sm:get_user_resources(exmpp_jid:lnode(JID), 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)) IPs1 = [ejabberd_sm:get_user_ip(exmpp_jid:full(JID,Resource))
|| Resource <- Resources], || Resource <- Resources],
IPs = [inet_parse:ntoa(IP)++":"++integer_to_list(Port) || {IP, Port} <- IPs1], IPs = [inet_parse:ntoa(IP)++":"++integer_to_list(Port) || {IP, Port} <- IPs1],
Items = ejabberd_hooks:run_fold(roster_get, Items = ejabberd_hooks:run_fold(roster_get,
exmpp_jid:ldomain(JID), exmpp_jid:prep_domain(JID),
[], [],
[{list_to_binary(User), list_to_binary(Server)}]), [{list_to_binary(User), list_to_binary(Server)}]),
Rostersize = integer_to_list(erlang:length(Items)), 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', <<>>), Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
case ejabberd_hooks:run_fold(disco_local_items, case ejabberd_hooks:run_fold(disco_local_items,
exmpp_jid:ldomain(To), exmpp_jid:prep_domain(To),
empty, empty,
[From, To, Node, Lang]) of [From, To, Node, Lang]) of
{result, Items} -> {result, Items} ->
@ -155,11 +155,11 @@ process_local_iq_info(From, To, #iq{type = get, payload = SubEl,
lang = Lang} = IQ_Rec) -> lang = Lang} = IQ_Rec) ->
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>), Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
Identity = ejabberd_hooks:run_fold(disco_local_identity, Identity = ejabberd_hooks:run_fold(disco_local_identity,
exmpp_jid:ldomain(To), exmpp_jid:prep_domain(To),
[], [],
[From, To, Node, Lang]), [From, To, Node, Lang]),
case ejabberd_hooks:run_fold(disco_local_features, case ejabberd_hooks:run_fold(disco_local_features,
exmpp_jid:ldomain(To), exmpp_jid:prep_domain(To),
empty, empty,
[From, To, Node, Lang]) of [From, To, Node, Lang]) of
{result, Features} -> {result, Features} ->
@ -274,7 +274,7 @@ process_sm_iq_items(From, To, #iq{type = get, payload = SubEl,
lang = Lang} = IQ_Rec) -> lang = Lang} = IQ_Rec) ->
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>), Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
case ejabberd_hooks:run_fold(disco_sm_items, case ejabberd_hooks:run_fold(disco_sm_items,
exmpp_jid:ldomain(To), exmpp_jid:prep_domain(To),
empty, empty,
[From, To, Node, Lang]) of [From, To, Node, Lang]) of
{result, Items} -> {result, Items} ->
@ -348,11 +348,11 @@ process_sm_iq_info(From, To, #iq{type = get, payload = SubEl,
lang = Lang} = IQ_Rec) -> lang = Lang} = IQ_Rec) ->
Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>), Node = exmpp_xml:get_attribute_as_binary(SubEl, 'node', <<>>),
Identity = ejabberd_hooks:run_fold(disco_sm_identity, Identity = ejabberd_hooks:run_fold(disco_sm_identity,
exmpp_jid:ldomain(To), exmpp_jid:prep_domain(To),
[], [],
[From, To, Node, Lang]), [From, To, Node, Lang]),
case ejabberd_hooks:run_fold(disco_sm_features, case ejabberd_hooks:run_fold(disco_sm_features,
exmpp_jid:ldomain(To), exmpp_jid:prep_domain(To),
empty, empty,
[From, To, Node, Lang]) of [From, To, Node, Lang]) of
{result, Features} -> {result, Features} ->
@ -393,7 +393,7 @@ get_sm_features(Acc, _From, _To, _Node, _Lang) ->
get_user_resources(JID) -> get_user_resources(JID) ->
Rs = ejabberd_sm:get_user_resources(exmpp_jid:lnode(JID), Rs = ejabberd_sm:get_user_resources(exmpp_jid:lnode(JID),
exmpp_jid:ldomain(JID)), exmpp_jid:prep_domain(JID)),
lists:map(fun(R) -> lists:map(fun(R) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [ #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
?XMLATTR('jid', ?XMLATTR('jid',

View File

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

View File

@ -99,18 +99,18 @@ process_sm_iq(From, To, #iq{type = get} = IQ_Rec) ->
Server = exmpp_jid:ldomain_as_list(To), Server = exmpp_jid:ldomain_as_list(To),
{Subscription, _Groups} = {Subscription, _Groups} =
ejabberd_hooks:run_fold( ejabberd_hooks:run_fold(
roster_get_jid_info, exmpp_jid:ldomain(To), roster_get_jid_info, exmpp_jid:prep_domain(To),
{none, []}, [exmpp_jid:lnode(To), exmpp_jid:ldomain(To), From]), {none, []}, [exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), From]),
if if
(Subscription == both) or (Subscription == from) -> (Subscription == both) or (Subscription == from) ->
UserListRecord = ejabberd_hooks:run_fold( UserListRecord = ejabberd_hooks:run_fold(
privacy_get_user_list, exmpp_jid:ldomain(To), privacy_get_user_list, exmpp_jid:prep_domain(To),
#userlist{}, #userlist{},
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To)]), [exmpp_jid:lnode(To), exmpp_jid:prep_domain(To)]),
case ejabberd_hooks:run_fold( case ejabberd_hooks:run_fold(
privacy_check_packet, exmpp_jid:ldomain(To), privacy_check_packet, exmpp_jid:prep_domain(To),
allow, allow,
[exmpp_jid:lnode(To), exmpp_jid:ldomain(To), UserListRecord, [exmpp_jid:lnode(To), exmpp_jid:prep_domain(To), UserListRecord,
{From, To, {From, To,
exmpp_presence:available()}, exmpp_presence:available()},
out]) of 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, <<>>) -> can_use_nick(_Host, _JID, <<>>) ->
false; false;
can_use_nick(Host, JID, Nick) when is_binary(Host), is_binary(Nick) -> 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( case catch mnesia:dirty_select(
muc_registered, muc_registered,
[{#muc_registered{us_host = '$1', [{#muc_registered{us_host = '$1',
@ -662,7 +662,7 @@ flush() ->
iq_get_register_info(Host, From, Lang) -> iq_get_register_info(Host, From, Lang) ->
LUser = exmpp_jid:lnode(From), LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From), LServer = exmpp_jid:prep_domain(From),
LUS = {LUser, LServer}, LUS = {LUser, LServer},
{Nick, Registered} = {Nick, Registered} =
case catch mnesia:dirty_read(muc_registered, {LUS, Host}) of 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) -> iq_set_register_info(Host, From, Nick, Lang) when is_binary(Host), is_binary(Nick) ->
LUser = exmpp_jid:lnode(From), LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From), LServer = exmpp_jid:prep_domain(From),
LUS = {LUser, LServer}, LUS = {LUser, LServer},
F = fun() -> F = fun() ->
case Nick of case Nick of

View File

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

View File

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

View File

@ -660,7 +660,7 @@ is_type_match(Type, Value, JID, Subscription, Groups) ->
jid -> jid ->
{User, Server, Resource} = Value, {User, Server, Resource} = Value,
((User == undefined) orelse (User == []) orelse (User == exmpp_jid:lnode(JID))) ((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))); andalso ((Resource == undefined) orelse (Resource == []) orelse (Resource == exmpp_jid:lresource(JID)));
subscription -> subscription ->
Value == 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) -> process_iq_get(From, _To, #iq{payload = SubEl} = IQ_Rec) ->
LUser = exmpp_jid:lnode(From), LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From), LServer = exmpp_jid:prep_domain(From),
case catch get_data(LUser, case catch get_data(LUser,
LServer, LServer,
exmpp_xml:get_child_elements(SubEl)) of 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) -> process_iq_set(From, _To, #iq{payload = SubEl} = IQ_Rec) ->
LUser = exmpp_jid:lnode(From), LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From), LServer = exmpp_jid:prep_domain(From),
F = fun() -> F = fun() ->
lists:foreach( lists:foreach(
fun(El) -> fun(El) ->

View File

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