mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
API renaming : ldomain_as_list -> prep_domain_as_list
SVN Revision: 2124
This commit is contained in:
parent
19d7d79229
commit
7eb395b87d
@ -232,7 +232,7 @@ match_acl(ACLName, JID, Host) ->
|
||||
none -> false;
|
||||
_ ->
|
||||
User = exmpp_jid:lnode_as_list(JID),
|
||||
Server = exmpp_jid:ldomain_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
Resource = exmpp_jid:lresource_as_list(JID),
|
||||
lists:any(fun(#acl{aclspec = Spec}) ->
|
||||
case Spec of
|
||||
|
@ -352,7 +352,7 @@ do_route(OrigFrom, OrigTo, OrigPacket) ->
|
||||
drop
|
||||
end;
|
||||
Rs ->
|
||||
LDstDomain = exmpp_jid:ldomain_as_list(To),
|
||||
LDstDomain = exmpp_jid:prep_domain_as_list(To),
|
||||
Value = case ejabberd_config:get_local_option(
|
||||
{domain_balancing, LDstDomain}) of
|
||||
undefined -> now();
|
||||
|
@ -303,8 +303,8 @@ do_route(From, To, Packet) ->
|
||||
end.
|
||||
|
||||
find_connection(From, To) ->
|
||||
MyServer = exmpp_jid:ldomain_as_list(From),
|
||||
Server = exmpp_jid:ldomain_as_list(To),
|
||||
MyServer = exmpp_jid:prep_domain_as_list(From),
|
||||
Server = exmpp_jid:prep_domain_as_list(To),
|
||||
FromTo = {MyServer, Server},
|
||||
MaxS2SConnectionsNumber = max_s2s_connections_number(FromTo),
|
||||
MaxS2SConnectionsNumberPerNode =
|
||||
@ -432,12 +432,12 @@ needed_connections_number(Ls, MaxS2SConnectionsNumber,
|
||||
%% service.
|
||||
%% --------------------------------------------------------------------
|
||||
is_service(From, To) ->
|
||||
LFromDomain = exmpp_jid:ldomain_as_list(From),
|
||||
LFromDomain = exmpp_jid:prep_domain_as_list(From),
|
||||
case ejabberd_config:get_local_option({route_subdomains, LFromDomain}) of
|
||||
s2s -> % bypass RFC 3920 10.3
|
||||
false;
|
||||
_ ->
|
||||
LDstDomain = exmpp_jid:ldomain_as_list(To),
|
||||
LDstDomain = exmpp_jid:prep_domain_as_list(To),
|
||||
P = fun(Domain) -> is_subdomain(LDstDomain, Domain) end,
|
||||
lists:any(P, ?MYHOSTS)
|
||||
end.
|
||||
|
@ -390,8 +390,8 @@ stream_established({xmlstreamelement, El}, StateData) ->
|
||||
% This is handled by C2S and S2S send_element functions.
|
||||
if
|
||||
(To /= error) and (From /= error) ->
|
||||
LFrom = exmpp_jid:ldomain_as_list(From),
|
||||
LTo = exmpp_jid:ldomain_as_list(To),
|
||||
LFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:prep_domain_as_list(To),
|
||||
if
|
||||
StateData#state.authenticated ->
|
||||
case (LFrom == StateData#state.auth_domain)
|
||||
@ -643,7 +643,7 @@ get_cert_domains(Cert) ->
|
||||
D /= error ->
|
||||
JID = exmpp_jid:parse(D),
|
||||
case {exmpp_jid:lnode_as_list(JID),
|
||||
exmpp_jid:ldomain_as_list(JID),
|
||||
exmpp_jid:prep_domain_as_list(JID),
|
||||
exmpp_jid:lresource_as_list(JID)} of
|
||||
{undefined, LD, undefined} ->
|
||||
[LD];
|
||||
@ -679,7 +679,7 @@ get_cert_domains(Cert) ->
|
||||
{ok, D} when is_binary(D) ->
|
||||
JID2 = exmpp_jid:parse(binary_to_list(D)),
|
||||
case {exmpp_jid:lnode_as_list(JID2),
|
||||
exmpp_jid:ldomain_as_list(JID2),
|
||||
exmpp_jid:prep_domain_as_list(JID2),
|
||||
exmpp_jid:lresource_as_list(JID2)} of
|
||||
{ undefined, LD, undefined} ->
|
||||
case idna:domain_utf8_to_ascii(LD) of
|
||||
@ -697,7 +697,7 @@ get_cert_domains(Cert) ->
|
||||
({dNSName, D}) when is_list(D) ->
|
||||
JID3 = exmpp_jid:parse(D),
|
||||
case {exmpp_jid:lnode_as_list(JID3),
|
||||
exmpp_jid:ldomain_as_list(JID3),
|
||||
exmpp_jid:prep_domain_as_list(JID3),
|
||||
exmpp_jid:lresource_as_list(JID3)} of
|
||||
{undefined, LD, undefined} ->
|
||||
[LD];
|
||||
|
@ -576,7 +576,7 @@ route_message(From, To, Packet) ->
|
||||
bounce_offline_message(From, To, Packet);
|
||||
_ ->
|
||||
case ejabberd_auth:is_user_exists(exmpp_jid:lnode_as_list(To),
|
||||
exmpp_jid:ldomain_as_list(To)) of
|
||||
exmpp_jid:prep_domain_as_list(To)) of
|
||||
true ->
|
||||
ejabberd_hooks:run(offline_message_hook,
|
||||
exmpp_jid:prep_domain(To),
|
||||
@ -678,7 +678,7 @@ check_max_sessions(JID) ->
|
||||
%% Defaults to infinity
|
||||
get_max_user_sessions(JID) ->
|
||||
case acl:match_rule(
|
||||
exmpp_jid:ldomain_as_list(JID), max_user_sessions, exmpp_jid:bare(JID)) of
|
||||
exmpp_jid:prep_domain_as_list(JID), max_user_sessions, exmpp_jid:bare(JID)) of
|
||||
Max when is_integer(Max) -> Max;
|
||||
infinity -> infinity;
|
||||
_ -> ?MAX_USER_SESSIONS
|
||||
|
@ -83,7 +83,7 @@ stop(Host) ->
|
||||
|
||||
get_local_commands(Acc, _From, To, <<>>, Lang) ->
|
||||
Server = exmpp_jid:domain(To),
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
Display = gen_mod:get_module_opt(LServer, ?MODULE, report_commands_node, false),
|
||||
case Display of
|
||||
false ->
|
||||
@ -114,7 +114,7 @@ get_local_commands(Acc, _From, _To, _Node, _Lang) ->
|
||||
%-------------------------------------------------------------------------
|
||||
|
||||
get_sm_commands(Acc, _From, To, <<>>, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
Display = gen_mod:get_module_opt(LServer, ?MODULE, report_commands_node, false),
|
||||
case Display of
|
||||
false ->
|
||||
|
@ -136,7 +136,7 @@ announce(From, To, Packet) ->
|
||||
case {exmpp_jid:lnode(To), exmpp_jid:lresource(To)} of
|
||||
{undefined, Res} ->
|
||||
Name = Packet#xmlel.name,
|
||||
Proc = gen_mod:get_module_proc(exmpp_jid:ldomain_as_list(To), ?PROCNAME),
|
||||
Proc = gen_mod:get_module_proc(exmpp_jid:prep_domain_as_list(To), ?PROCNAME),
|
||||
case {Res, Name} of
|
||||
{<<"announce/all">>, 'message'} ->
|
||||
Proc ! {announce_all, From, To, Packet},
|
||||
@ -221,7 +221,7 @@ disco_identity(Acc, _From, _To, Node, Lang) ->
|
||||
end).
|
||||
|
||||
disco_features(Acc, From, To, <<"announce">>, _Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -238,7 +238,7 @@ disco_features(Acc, From, To, <<"announce">>, _Lang) ->
|
||||
end;
|
||||
|
||||
disco_features(Acc, From, To, Node, _Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -290,7 +290,7 @@ disco_features(Acc, From, To, Node, _Lang) ->
|
||||
end).
|
||||
|
||||
disco_items(Acc, From, To, <<>>, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
Server = exmpp_jid:domain(To),
|
||||
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
@ -314,7 +314,7 @@ disco_items(Acc, From, To, <<>>, Lang) ->
|
||||
end;
|
||||
|
||||
disco_items(Acc, From, To, <<"announce">>, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -323,7 +323,7 @@ disco_items(Acc, From, To, <<"announce">>, Lang) ->
|
||||
end;
|
||||
|
||||
disco_items(Acc, From, To, Node, _Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -361,7 +361,7 @@ disco_items(Acc, From, To, Node, _Lang) ->
|
||||
%%-------------------------------------------------------------------------
|
||||
|
||||
announce_items(Acc, From, To, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
Server = exmpp_jid:domain(To),
|
||||
Access1 = gen_mod:get_module_opt(LServer, ?MODULE, access, none),
|
||||
Nodes1 = case acl:match_rule(LServer, Access1, From) of
|
||||
@ -408,7 +408,7 @@ commands_result(Allow, From, To, Request) ->
|
||||
|
||||
|
||||
announce_commands(Acc, From, To, #adhoc_request{ node = Node} = Request) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
LNode = tokenize(Node),
|
||||
F = fun() ->
|
||||
Access = gen_mod:get_module_opt(global, ?MODULE, access, none),
|
||||
@ -463,7 +463,7 @@ announce_commands(From, To,
|
||||
#adhoc_response{status = canceled});
|
||||
XData == false, ActionIsExecute ->
|
||||
%% User requests form
|
||||
Elements = generate_adhoc_form(Lang, Node, exmpp_jid:ldomain_as_list(To)),
|
||||
Elements = generate_adhoc_form(Lang, Node, exmpp_jid:prep_domain_as_list(To)),
|
||||
adhoc:produce_response(
|
||||
Request,
|
||||
#adhoc_response{status = executing,
|
||||
@ -542,7 +542,7 @@ handle_adhoc_form(From, To,
|
||||
node = Node,
|
||||
sessionid = SessionID},
|
||||
Fields) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
Confirm = case lists:keysearch("confirm", 1, Fields) of
|
||||
{value, {"confirm", ["true"]}} ->
|
||||
true;
|
||||
@ -664,7 +664,7 @@ get_title(Lang, <<?NS_ADMIN_s , "#delete-motd-allhosts">>) ->
|
||||
%%-------------------------------------------------------------------------
|
||||
|
||||
announce_all(From, To, Packet) ->
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
Access = gen_mod:get_module_opt(Host, ?MODULE, access, none),
|
||||
case acl:match_rule(Host, Access, From) of
|
||||
deny ->
|
||||
@ -695,7 +695,7 @@ announce_all_hosts_all(From, To, Packet) ->
|
||||
end.
|
||||
|
||||
announce_online(From, To, Packet) ->
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
Access = gen_mod:get_module_opt(Host, ?MODULE, access, none),
|
||||
case acl:match_rule(Host, Access, From) of
|
||||
deny ->
|
||||
@ -728,7 +728,7 @@ announce_online1(Sessions, Server, Packet) ->
|
||||
end, Sessions).
|
||||
|
||||
announce_motd(From, To, Packet) ->
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
Access = gen_mod:get_module_opt(Host, ?MODULE, access, none),
|
||||
case acl:match_rule(Host, Access, From) of
|
||||
deny ->
|
||||
@ -762,7 +762,7 @@ announce_motd(Host, Packet) ->
|
||||
mnesia:transaction(F).
|
||||
|
||||
announce_motd_update(From, To, Packet) ->
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
Access = gen_mod:get_module_opt(Host, ?MODULE, access, none),
|
||||
case acl:match_rule(Host, Access, From) of
|
||||
deny ->
|
||||
@ -791,7 +791,7 @@ announce_motd_update(LServer, Packet) ->
|
||||
mnesia:transaction(F).
|
||||
|
||||
announce_motd_delete(From, To, Packet) ->
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
Access = gen_mod:get_module_opt(Host, ?MODULE, access, none),
|
||||
case acl:match_rule(Host, Access, From) of
|
||||
deny ->
|
||||
@ -828,7 +828,7 @@ announce_motd_delete(LServer) ->
|
||||
mnesia:transaction(F).
|
||||
|
||||
send_motd(JID) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(JID),
|
||||
LServer = exmpp_jid:prep_domain_as_list(JID),
|
||||
LUser = exmpp_jid:lnode_as_list(JID),
|
||||
case catch mnesia:dirty_read({motd, LServer}) of
|
||||
[#motd{packet = Packet}] ->
|
||||
|
@ -218,7 +218,7 @@ receive_packet(From, To, Packet) when ?IS_PRESENCE(Packet) ->
|
||||
%% anymore until he login again.
|
||||
%% This is tracked in EJAB-943
|
||||
_ ->
|
||||
ServerString = exmpp_jid:ldomain_as_list(To),
|
||||
ServerString = exmpp_jid:prep_domain_as_list(To),
|
||||
Els = Packet#xmlel.children,
|
||||
note_caps(ServerString, From, read_caps(Els))
|
||||
end;
|
||||
@ -229,7 +229,7 @@ receive_packet(_JID, From, To, Packet) ->
|
||||
receive_packet(From, To, Packet).
|
||||
|
||||
presence_probe(From, To, _) ->
|
||||
ServerString = exmpp_jid:ldomain_as_list(To),
|
||||
ServerString = exmpp_jid:prep_domain_as_list(To),
|
||||
wait_caps(ServerString, From).
|
||||
|
||||
remove_connection(_SID, JID, _Info) ->
|
||||
@ -424,7 +424,7 @@ handle_cast(visit_feature_queries, #state{feature_queries = FeatureQueries} = St
|
||||
{noreply, State#state{feature_queries = NewFeatureQueries}}.
|
||||
|
||||
handle_disco_response(From, To, IQ_Rec) ->
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||
gen_server:cast(Proc, {disco_response, From, To, IQ_Rec}).
|
||||
|
||||
|
@ -184,7 +184,7 @@ get_local_identity(Acc, _From, _To, Node, Lang) ->
|
||||
end).
|
||||
|
||||
get_sm_features(Acc, From, To, Node, _Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -199,7 +199,7 @@ get_sm_features(Acc, From, To, Node, _Lang) ->
|
||||
end.
|
||||
|
||||
get_local_features(Acc, From, To, Node, _Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -255,7 +255,7 @@ get_local_features(Acc, From, To, Node, _Lang) ->
|
||||
%%%-----------------------------------------------------------------------
|
||||
|
||||
adhoc_sm_items(Acc, From, To, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case acl:match_rule(LServer, configure, From) of
|
||||
allow ->
|
||||
Items = case Acc of
|
||||
@ -274,7 +274,7 @@ adhoc_sm_items(Acc, From, To, Lang) ->
|
||||
%%%-----------------------------------------------------------------------
|
||||
|
||||
get_sm_items(Acc, From, To, Node, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -312,7 +312,7 @@ get_user_resources(BareJID) ->
|
||||
%%%-----------------------------------------------------------------------
|
||||
|
||||
adhoc_local_items(Acc, From, To, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case acl:match_rule(LServer, configure, From) of
|
||||
allow ->
|
||||
Items = case Acc of
|
||||
@ -391,7 +391,7 @@ get_permission_level(JID) ->
|
||||
end).
|
||||
|
||||
get_local_items(Acc, From, To, <<>>, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -417,7 +417,7 @@ get_local_items(Acc, From, To, <<>>, Lang) ->
|
||||
end;
|
||||
|
||||
get_local_items(Acc, From, To, Node, Lang) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case gen_mod:is_loaded(LServer, mod_adhoc) of
|
||||
false ->
|
||||
Acc;
|
||||
@ -744,7 +744,7 @@ get_stopped_nodes(_Lang) ->
|
||||
end).
|
||||
|
||||
adhoc_local_commands(Acc, From, To, #adhoc_request{node = Node} = Request) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
LNode = tokenize(Node),
|
||||
case LNode of
|
||||
["running nodes", _ENode, "DB"] ->
|
||||
@ -773,7 +773,7 @@ adhoc_local_commands(From, To,
|
||||
sessionid = SessionID,
|
||||
action = Action,
|
||||
xdata = XData} = Request) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
LNode = tokenize(Node),
|
||||
%% If the "action" attribute is not present, it is
|
||||
%% understood as "execute". If there was no <actions/>
|
||||
@ -1564,7 +1564,7 @@ set_form(From, Host, ?NS_ADMINL("add-user"), _Lang, XData) ->
|
||||
Password = get_value("password-verify", XData),
|
||||
AccountJID = exmpp_jid:parse(AccountString),
|
||||
User = exmpp_jid:lnode_as_list(AccountJID),
|
||||
Server = exmpp_jid:ldomain_as_list(AccountJID),
|
||||
Server = exmpp_jid:prep_domain_as_list(AccountJID),
|
||||
true = lists:member(Server, ?MYHOSTS),
|
||||
true = (Server == Host) orelse (get_permission_level(From) == global),
|
||||
ejabberd_auth:try_register(User, Server, Password),
|
||||
@ -1577,7 +1577,7 @@ set_form(From, Host, ?NS_ADMINL("delete-user"), _Lang, XData) ->
|
||||
fun(AccountString) ->
|
||||
JID = exmpp_jid:parse(AccountString),
|
||||
User = [_|_] = exmpp_jid:lnode_as_list(JID),
|
||||
Server = exmpp_jid:ldomain_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
true = (Server == Host) orelse (get_permission_level(From) == global),
|
||||
true = ejabberd_auth:is_user_exists(User, Server),
|
||||
{User, Server}
|
||||
@ -1590,7 +1590,7 @@ set_form(From, Host, ?NS_ADMINL("end-user-session"), _Lang, XData) ->
|
||||
AccountString = get_value("accountjid", XData),
|
||||
JID = exmpp_jid:parse(AccountString),
|
||||
LUser = [_|_] = exmpp_jid:lnode_as_list(JID),
|
||||
LServer = exmpp_jid:ldomain_as_list(JID),
|
||||
LServer = exmpp_jid:prep_domain_as_list(JID),
|
||||
true = (LServer == Host) orelse (get_permission_level(From) == global),
|
||||
%% Code copied from ejabberd_sm.erl
|
||||
case exmpp_jid:lresource_as_list(JID) of
|
||||
@ -1609,7 +1609,7 @@ set_form(From, Host, ?NS_ADMINL("get-user-password"), Lang, XData) ->
|
||||
AccountString = get_value("accountjid", XData),
|
||||
JID = exmpp_jid:parse(AccountString),
|
||||
User = [_|_] = exmpp_jid:lnode_as_list(JID),
|
||||
Server = exmpp_jid:ldomain_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
true = (Server == Host) orelse (get_permission_level(From) == global),
|
||||
Password = ejabberd_auth:get_password(User, Server),
|
||||
true = is_list(Password),
|
||||
@ -1624,7 +1624,7 @@ set_form(From, Host, ?NS_ADMINL("change-user-password"), _Lang, XData) ->
|
||||
Password = get_value("password", XData),
|
||||
JID = exmpp_jid:parse(AccountString),
|
||||
User = [_|_] = exmpp_jid:lnode_as_list(JID),
|
||||
Server = exmpp_jid:ldomain_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
true = (Server == Host) orelse (get_permission_level(From) == global),
|
||||
true = ejabberd_auth:is_user_exists(User, Server),
|
||||
ejabberd_auth:set_password(User, Server, Password),
|
||||
@ -1634,7 +1634,7 @@ set_form(From, Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) ->
|
||||
AccountString = get_value("accountjid", XData),
|
||||
JID = exmpp_jid:parse(AccountString),
|
||||
User = [_|_] = exmpp_jid:lnode_as_list(JID),
|
||||
Server = exmpp_jid:ldomain_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
true = (Server == Host) orelse (get_permission_level(From) == global),
|
||||
|
||||
%% Code copied from web/ejabberd_web_admin.erl
|
||||
@ -1672,7 +1672,7 @@ set_form(From, Host, ?NS_ADMINL("user-stats"), Lang, XData) ->
|
||||
AccountString = get_value("accountjid", XData),
|
||||
JID = exmpp_jid:parse(AccountString),
|
||||
User = [_|_] = exmpp_jid:lnode_as_list(JID),
|
||||
Server = exmpp_jid:ldomain_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
true = (Server == Host) orelse (get_permission_level(From) == global),
|
||||
|
||||
Resources = ejabberd_sm:get_user_resources(exmpp_jid:lnode(JID),
|
||||
@ -1771,7 +1771,7 @@ adhoc_sm_commands(_Acc, From, To,
|
||||
xdata = XData} = Request) ->
|
||||
User = exmpp_jid:node_as_list(To),
|
||||
Server = exmpp_jid:domain_as_list(To),
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case acl:match_rule(LServer, configure, From) of
|
||||
deny ->
|
||||
{error, 'forbidden'};
|
||||
|
@ -71,7 +71,7 @@ stop(Host) ->
|
||||
|
||||
|
||||
process_local_iq(From, To, #iq{type = Type, payload = Request} = IQ_Rec) ->
|
||||
case acl:match_rule(exmpp_jid:ldomain_as_list(To), configure, From) of
|
||||
case acl:match_rule(exmpp_jid:prep_domain_as_list(To), configure, From) of
|
||||
deny ->
|
||||
exmpp_iq:error(IQ_Rec, 'not-allowed');
|
||||
allow ->
|
||||
|
@ -196,7 +196,7 @@ get_local_features(Acc, _From, To, <<>>, _Lang) ->
|
||||
{result, Features} -> Features;
|
||||
empty -> []
|
||||
end,
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
{result,
|
||||
ets:select(disco_features, [{{{'_', Host}}, [], ['$_']}]) ++ Feats};
|
||||
|
||||
@ -239,7 +239,7 @@ get_local_services(Acc, _From, To, <<>>, _Lang) ->
|
||||
{result, Its} -> Its;
|
||||
empty -> []
|
||||
end,
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
{result,
|
||||
lists:usort(
|
||||
lists:map(fun domain_to_xml/1,
|
||||
@ -290,9 +290,9 @@ process_sm_iq_items(From, To, #iq{type = get, payload = SubEl,
|
||||
end;
|
||||
process_sm_iq_items(From, To, #iq{type = set, payload = SubEl} = IQ_Rec) ->
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
ToServer = exmpp_jid:ldomain_as_list(To),
|
||||
ToServer = exmpp_jid:prep_domain_as_list(To),
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
Self = (LTo == LFrom) andalso (ToServer == LServer),
|
||||
Node = exmpp_xml:get_attribute_as_list(SubEl, 'node', ""),
|
||||
if
|
||||
@ -315,9 +315,9 @@ get_sm_items({error, _Error} = Acc, _From, _To, _Node, _Lang) ->
|
||||
|
||||
get_sm_items(Acc, From, To, <<>>, _Lang) ->
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LSFrom = exmpp_jid:ldomain_as_list(From),
|
||||
LSFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LSTo = exmpp_jid:ldomain_as_list(To),
|
||||
LSTo = exmpp_jid:prep_domain_as_list(To),
|
||||
|
||||
Items = case Acc of
|
||||
{result, Its} -> Its;
|
||||
@ -334,9 +334,9 @@ get_sm_items({result, _} = Acc, _From, _To, _Node, _Lang) ->
|
||||
|
||||
get_sm_items(empty, From, To, _Node, _Lang) ->
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LSFrom = exmpp_jid:ldomain_as_list(From),
|
||||
LSFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LSTo = exmpp_jid:ldomain_as_list(To),
|
||||
LSTo = exmpp_jid:prep_domain_as_list(To),
|
||||
case {LFrom, LSFrom} of
|
||||
{LTo, LSTo} ->
|
||||
{error, 'item-not-found'};
|
||||
@ -376,9 +376,9 @@ get_sm_identity(Acc, _From, _To, _Node, _Lang) ->
|
||||
|
||||
get_sm_features(empty, From, To, _Node, _Lang) ->
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LSFrom = exmpp_jid:ldomain_as_list(From),
|
||||
LSFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LSTo = exmpp_jid:ldomain_as_list(To),
|
||||
LSTo = exmpp_jid:prep_domain_as_list(To),
|
||||
case {LFrom, LSFrom} of
|
||||
{LTo, LSTo} ->
|
||||
{error, 'item-not-found'};
|
||||
@ -405,9 +405,9 @@ get_user_resources(JID) ->
|
||||
|
||||
get_publish_items(empty, From, To, Node, _Lang) ->
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LSFrom = exmpp_jid:ldomain_as_list(From),
|
||||
LSFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LSTo = exmpp_jid:ldomain_as_list(To),
|
||||
LSTo = exmpp_jid:prep_domain_as_list(To),
|
||||
if
|
||||
(LFrom == LTo) and (LSFrom == LSTo) ->
|
||||
retrieve_disco_publish({LTo, LSTo}, binary_to_list(Node));
|
||||
|
@ -404,7 +404,7 @@ get_form(Host, From, [], Lang, DefEnc) ->
|
||||
User = exmpp_jid:node_as_list(From),
|
||||
Server = exmpp_jid:domain_as_list(From),
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
US = {LUser, LServer},
|
||||
Customs =
|
||||
case catch mnesia:dirty_read({irc_custom, {US, Host}}) of
|
||||
@ -489,7 +489,7 @@ get_form(_Host, _, _, _Lang, _) ->
|
||||
|
||||
set_form(Host, From, [], _Lang, XData) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
US = {LUser, LServer},
|
||||
case {lists:keysearch("username", 1, XData),
|
||||
lists:keysearch("encodings", 1, XData)} of
|
||||
@ -535,7 +535,7 @@ set_form(_Host, _, _, _Lang, _XData) ->
|
||||
get_user_and_encoding(Host, From, IRCServer, DefEnc) ->
|
||||
User = exmpp_jid:node_as_list(From),
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
US = {LUser, LServer},
|
||||
case catch mnesia:dirty_read({irc_custom, {US, Host}}) of
|
||||
{'EXIT', _Reason} ->
|
||||
|
@ -96,7 +96,7 @@ now_to_seconds({MegaSecs, Secs, _MicroSecs}) ->
|
||||
%%%
|
||||
process_sm_iq(From, To, #iq{type = get} = IQ_Rec) ->
|
||||
User = exmpp_jid:lnode_as_list(To),
|
||||
Server = exmpp_jid:ldomain_as_list(To),
|
||||
Server = exmpp_jid:prep_domain_as_list(To),
|
||||
{Subscription, _Groups} =
|
||||
ejabberd_hooks:run_fold(
|
||||
roster_get_jid_info, exmpp_jid:prep_domain(To),
|
||||
|
@ -162,7 +162,7 @@ store_packet(From, To, Packet) ->
|
||||
case check_event(From, To, Packet) of
|
||||
true ->
|
||||
LUser = exmpp_jid:lnode_as_list(To),
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
TimeStamp = now(),
|
||||
Expire = find_x_expire(TimeStamp, Packet#xmlel.children),
|
||||
gen_mod:get_module_proc(LServer, ?PROCNAME) !
|
||||
|
@ -172,7 +172,7 @@ store_packet(From, To, Packet) ->
|
||||
LUser = exmpp_jid:lnode_as_list(To),
|
||||
TimeStamp = now(),
|
||||
Expire = find_x_expire(TimeStamp, Packet#xmlel.children),
|
||||
gen_mod:get_module_proc(exmpp_jid:ldomain_as_list(To), ?PROCNAME) !
|
||||
gen_mod:get_module_proc(exmpp_jid:prep_domain_as_list(To), ?PROCNAME) !
|
||||
#offline_msg{user = LUser,
|
||||
timestamp = TimeStamp,
|
||||
expire = Expire,
|
||||
|
@ -88,7 +88,7 @@ process_iq(_From, _To, IQ_Rec) ->
|
||||
process_iq_get(_, From, _To, #iq{payload = SubEl},
|
||||
#userlist{name = Active}) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case exmpp_xml:get_child_elements(SubEl) of
|
||||
[] ->
|
||||
process_lists_get(LUser, LServer, Active);
|
||||
@ -247,7 +247,7 @@ list_to_action(S) ->
|
||||
|
||||
process_iq_set(_, From, _To, #iq{payload = SubEl}) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case exmpp_xml:get_child_elements(SubEl) of
|
||||
[#xmlel{name = Name} = Child] ->
|
||||
ListName = exmpp_xml:get_attribute_as_list(Child, 'name', false),
|
||||
|
@ -84,7 +84,7 @@ process_iq(_From, _To, IQ_Rec) ->
|
||||
process_iq_get(_, From, _To, #iq{payload = SubEl},
|
||||
#userlist{name = Active}) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case exmpp_xml:get_child_elements(SubEl) of
|
||||
[] ->
|
||||
process_lists_get(LUser, LServer, Active);
|
||||
@ -253,7 +253,7 @@ list_to_action(S) ->
|
||||
|
||||
process_iq_set(_, From, _To, #iq{payload = SubEl}) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case exmpp_xml:get_child_elements(SubEl) of
|
||||
[#xmlel{name = Name} = Child] ->
|
||||
ListName = exmpp_xml:get_attribute_as_list(Child, 'name', false),
|
||||
|
@ -113,7 +113,7 @@ check_packet(From, To, IQ_Rec, [F | R]) ->
|
||||
end.
|
||||
|
||||
check_domain(From, _To, _IQ_Rec) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case lists:member(LServer, ?MYHOSTS) of
|
||||
true -> ok;
|
||||
false -> {error, 'not-allowed'}
|
||||
|
@ -68,7 +68,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_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case catch get_data(LUser,
|
||||
LServer,
|
||||
exmpp_xml:get_child_elements(SubEl)) of
|
||||
@ -83,7 +83,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_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
F = fun() ->
|
||||
lists:foreach(
|
||||
fun(El) ->
|
||||
@ -107,7 +107,7 @@ check_packet(From, To, IQ_Rec, [F | R]) ->
|
||||
end.
|
||||
|
||||
check_domain(From, _To, _IQ_Rec) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case lists:member(LServer, ?MYHOSTS) of
|
||||
true -> ok;
|
||||
false -> {error, 'not-allowed'}
|
||||
|
@ -521,12 +521,12 @@ identity(Host) ->
|
||||
#xmlel{ns = ?NS_DISCO_INFO, name = 'identity', attrs = Identity}.
|
||||
|
||||
disco_local_identity(Acc, _From, To, <<>>, _Lang) ->
|
||||
Acc ++ [identity(exmpp_jid:ldomain_as_list(To))];
|
||||
Acc ++ [identity(exmpp_jid:prep_domain_as_list(To))];
|
||||
disco_local_identity(Acc, _From, _To, _Node, _Lang) ->
|
||||
Acc.
|
||||
|
||||
disco_local_features(Acc, _From, To, <<>>, _Lang) ->
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
Feats = case Acc of
|
||||
{result, I} -> I;
|
||||
_ -> []
|
||||
@ -543,7 +543,7 @@ disco_local_items(Acc, _From, _To, _Node, _Lang) ->
|
||||
Acc.
|
||||
|
||||
disco_sm_identity(Acc, _From, To, <<>>, _Lang) ->
|
||||
Acc ++ [identity(exmpp_jid:ldomain_as_list(To))];
|
||||
Acc ++ [identity(exmpp_jid:prep_domain_as_list(To))];
|
||||
disco_sm_identity(Acc, From, To, Node, _Lang) ->
|
||||
LOwner = jlib:short_prepd_bare_jid(To),
|
||||
Acc ++ case node_disco_identity(LOwner, From, Node) of
|
||||
@ -567,7 +567,7 @@ disco_sm_features(Acc, From, To, Node, _Lang) ->
|
||||
|
||||
disco_sm_items(Acc, From, To, <<>>, _Lang) ->
|
||||
%% TODO, use iq_disco_items(Host, [], From)
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
LJID = jlib:short_prepd_bare_jid(To),
|
||||
case tree_action(Host, get_subnodes, [Host, [], From]) of
|
||||
[] ->
|
||||
@ -589,7 +589,7 @@ disco_sm_items(Acc, From, To, <<>>, _Lang) ->
|
||||
disco_sm_items(Acc, From, To, NodeB, _Lang) ->
|
||||
Node = binary_to_list(NodeB),
|
||||
%% TODO, use iq_disco_items(Host, Node, From)
|
||||
Host = exmpp_jid:ldomain_as_list(To),
|
||||
Host = exmpp_jid:prep_domain_as_list(To),
|
||||
LJID = jlib:short_prepd_bare_jid(To),
|
||||
Action = fun(#pubsub_node{type = Type, id = NodeId}) ->
|
||||
case node_call(Type, get_items, [NodeId, From]) of
|
||||
@ -625,13 +625,13 @@ disco_sm_items(Acc, From, To, NodeB, _Lang) ->
|
||||
|
||||
presence_probe(JID, JID, Pid) ->
|
||||
{U, S, R} = jlib:short_prepd_jid(JID),
|
||||
Host = S, % exmpp_jid:ldomain_as_list(JID),
|
||||
Host = S, % exmpp_jid:prep_domain_as_list(JID),
|
||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||
gen_server:cast(Proc, {presence, JID, Pid}),
|
||||
gen_server:cast(Proc, {presence, U, S, [R], JID});
|
||||
presence_probe(Peer, JID, _Pid) ->
|
||||
{U, S, R} = jlib:short_prepd_jid(Peer),
|
||||
Host = exmpp_jid:ldomain_as_list(JID),
|
||||
Host = exmpp_jid:prep_domain_as_list(JID),
|
||||
Proc = gen_mod:get_module_proc(Host, ?PROCNAME),
|
||||
gen_server:cast(Proc, {presence, U, S, [R], JID}).
|
||||
|
||||
@ -765,7 +765,7 @@ handle_info({route, From, To, Packet},
|
||||
#state{server_host = ServerHost,
|
||||
access = Access,
|
||||
plugins = Plugins} = State) ->
|
||||
case catch do_route(ServerHost, Access, Plugins, exmpp_jid:ldomain_as_list(To), From, To, Packet) of
|
||||
case catch do_route(ServerHost, Access, Plugins, exmpp_jid:prep_domain_as_list(To), From, To, Packet) of
|
||||
{'EXIT', Reason} -> ?ERROR_MSG("~p", [Reason]);
|
||||
_ -> ok
|
||||
end,
|
||||
@ -1048,8 +1048,8 @@ iq_disco_items(Host, Item, From) ->
|
||||
end.
|
||||
|
||||
iq_local(From, To, #iq{type = Type, payload = SubEl, ns = XMLNS, lang = Lang} = IQ_Rec) ->
|
||||
ServerHost = exmpp_jid:ldomain_as_list(To),
|
||||
FromHost = exmpp_jid:ldomain_as_list(To),
|
||||
ServerHost = exmpp_jid:prep_domain_as_list(To),
|
||||
FromHost = exmpp_jid:prep_domain_as_list(To),
|
||||
%% Accept IQs to server only from our own users.
|
||||
if
|
||||
FromHost /= ServerHost ->
|
||||
@ -1068,7 +1068,7 @@ iq_local(From, To, #iq{type = Type, payload = SubEl, ns = XMLNS, lang = Lang} =
|
||||
end.
|
||||
|
||||
iq_sm(From, To, #iq{type = Type, payload = SubEl, ns = XMLNS, lang = Lang} = IQ_Rec) ->
|
||||
ServerHost = exmpp_jid:ldomain_as_list(To),
|
||||
ServerHost = exmpp_jid:prep_domain_as_list(To),
|
||||
LOwner = jlib:short_prepd_bare_jid(To),
|
||||
Res = case XMLNS of
|
||||
?NS_PUBSUB -> iq_pubsub(LOwner, ServerHost, From, Type, SubEl, Lang);
|
||||
|
@ -135,7 +135,7 @@ get_subnodes_tree(_Host, _Node) ->
|
||||
%% <p>default allowed nodes: /home/host/user/any/node/name</p>
|
||||
create_node(Host, Node, _Type, Owner, _Options) ->
|
||||
UserName = exmpp_jid:lnode_as_list(Owner),
|
||||
UserHost = exmpp_jid:ldomain_as_list(Owner),
|
||||
UserHost = exmpp_jid:prep_domain_as_list(Owner),
|
||||
case Node of
|
||||
["home", UserHost, UserName | _] -> {error, {virtual, {Host, Node}}};
|
||||
_ -> {error, 'not-allowed'}
|
||||
|
@ -88,7 +88,7 @@ unauthenticated_iq_register(Acc, _Server, _IQ, _IP) ->
|
||||
|
||||
process_iq(From, To, IQ) ->
|
||||
process_iq(From, To, IQ, {exmpp_jid:lnode_as_list(From),
|
||||
exmpp_jid:ldomain_as_list(From),
|
||||
exmpp_jid:prep_domain_as_list(From),
|
||||
exmpp_jid:lresource_as_list(From)}).
|
||||
|
||||
process_iq(From, To,
|
||||
@ -99,11 +99,11 @@ process_iq(From, To,
|
||||
UTag = exmpp_xml:get_element(SubEl, 'username'),
|
||||
PTag = exmpp_xml:get_element(SubEl, 'password'),
|
||||
RTag = exmpp_xml:get_element(SubEl, 'remove'),
|
||||
Server = exmpp_jid:ldomain_as_list(To),
|
||||
Server = exmpp_jid:prep_domain_as_list(To),
|
||||
if
|
||||
(UTag /= undefined) and (RTag /= undefined) ->
|
||||
User = exmpp_xml:get_cdata_as_list(UTag),
|
||||
case {exmpp_jid:node_as_list(From), exmpp_jid:ldomain_as_list(From)} of
|
||||
case {exmpp_jid:node_as_list(From), exmpp_jid:prep_domain_as_list(From)} of
|
||||
{User, Server} ->
|
||||
ejabberd_auth:remove_user(User, Server),
|
||||
exmpp_iq:result(IQ_Rec, SubEl);
|
||||
@ -138,7 +138,7 @@ process_iq(From, To,
|
||||
end;
|
||||
(UTag == undefined) and (RTag /= undefined) ->
|
||||
case {exmpp_jid:node_as_list(From),
|
||||
exmpp_jid:ldomain_as_list(From),
|
||||
exmpp_jid:prep_domain_as_list(From),
|
||||
exmpp_jid:resource_as_list(From)}of
|
||||
{User, Server, Resource} ->
|
||||
ResIQ = exmpp_iq:result(IQ_Rec, SubEl),
|
||||
@ -158,7 +158,7 @@ process_iq(From, To,
|
||||
(UTag /= undefined) and (PTag /= undefined) ->
|
||||
User = exmpp_xml:get_cdata_as_list(UTag),
|
||||
Password = exmpp_xml:get_cdata_as_list(PTag),
|
||||
case {exmpp_jid:node_as_list(From), exmpp_jid:ldomain_as_list(From)} of
|
||||
case {exmpp_jid:node_as_list(From), exmpp_jid:prep_domain_as_list(From)} of
|
||||
{User, Server} ->
|
||||
try_set_password(User, Server, Password, IQ_Rec, SubEl);
|
||||
_ ->
|
||||
@ -241,7 +241,7 @@ try_register(User, Server, Password, Source, Lang) ->
|
||||
|
||||
|
||||
send_welcome_message(JID) ->
|
||||
Host = exmpp_jid:ldomain_as_list(JID),
|
||||
Host = exmpp_jid:prep_domain_as_list(JID),
|
||||
case gen_mod:get_module_opt(Host, ?MODULE, welcome_message, {"", ""}) of
|
||||
{"", ""} ->
|
||||
ok;
|
||||
@ -255,7 +255,7 @@ send_welcome_message(JID) ->
|
||||
end.
|
||||
|
||||
send_registration_notifications(UJID) ->
|
||||
Host = exmpp_jid:ldomain_as_list(UJID),
|
||||
Host = exmpp_jid:prep_domain_as_list(UJID),
|
||||
case gen_mod:get_module_opt(Host, ?MODULE, registration_watchers, []) of
|
||||
[] -> ok;
|
||||
JIDs when is_list(JIDs) ->
|
||||
|
@ -135,7 +135,7 @@ stop(Host) when is_list(Host) ->
|
||||
|
||||
process_iq(From, To, IQ_Rec)
|
||||
when ?IS_JID(From), ?IS_JID(To), ?IS_IQ_RECORD(IQ_Rec) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case lists:member(LServer, ?MYHOSTS) of
|
||||
true ->
|
||||
process_local_iq(From, To, IQ_Rec);
|
||||
|
@ -103,7 +103,7 @@ stop(Host) ->
|
||||
|
||||
|
||||
process_iq(From, To, IQ_Rec) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case lists:member(LServer, ?MYHOSTS) of
|
||||
true ->
|
||||
process_local_iq(From, To, IQ_Rec);
|
||||
@ -756,7 +756,7 @@ get_in_pending_subscriptions(Ls, User, Server)
|
||||
when is_binary(User), is_binary(Server) ->
|
||||
JID = exmpp_jid:make(User, Server),
|
||||
LUser = exmpp_jid:lnode(JID),
|
||||
LServer = exmpp_jid:ldomain_as_list(JID),
|
||||
LServer = exmpp_jid:prep_domain_as_list(JID),
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
case catch odbc_queries:get_roster(LServer, Username) of
|
||||
{selected, ["username", "jid", "nick", "subscription", "ask",
|
||||
|
@ -55,10 +55,10 @@ stop(Host) ->
|
||||
ok.
|
||||
|
||||
log_user_send(From, To, Packet) ->
|
||||
log_packet(From, To, Packet, exmpp_jid:ldomain_as_list(From)).
|
||||
log_packet(From, To, Packet, exmpp_jid:prep_domain_as_list(From)).
|
||||
|
||||
log_user_receive(_JID, From, To, Packet) ->
|
||||
log_packet(From, To, Packet, exmpp_jid:ldomain_as_list(To)).
|
||||
log_packet(From, To, Packet, exmpp_jid:prep_domain_as_list(To)).
|
||||
|
||||
|
||||
log_packet(From, To, Packet, Host) ->
|
||||
|
@ -941,7 +941,7 @@ shared_roster_group_parse_query(Host, Group, Query) ->
|
||||
_ ->
|
||||
try
|
||||
JID = exmpp_jid:parse(SJID),
|
||||
[{exmpp_jid:lnode_as_list(JID), exmpp_jid:ldomain_as_list(JID)} | USs]
|
||||
[{exmpp_jid:lnode_as_list(JID), exmpp_jid:prep_domain_as_list(JID)} | USs]
|
||||
catch
|
||||
_ ->
|
||||
error
|
||||
|
@ -170,7 +170,7 @@ process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||
|
||||
process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
||||
LUser = exmpp_jid:lnode_as_list(To),
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
US = {LUser, LServer},
|
||||
F = fun() ->
|
||||
mnesia:read({vcard, US})
|
||||
@ -191,7 +191,7 @@ process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
||||
end;
|
||||
process_sm_iq(From, _To, #iq{type = set, payload = Request} = IQ_Rec) ->
|
||||
User = exmpp_jid:node_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case lists:member(LServer, ?MYHOSTS) of
|
||||
true ->
|
||||
set_vcard(User, LServer, Request),
|
||||
|
@ -240,7 +240,7 @@ process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||
exmpp_iq:error(IQ_Rec, 'not-allowed').
|
||||
|
||||
process_sm_iq(_From, To, #iq{} = IQ_Rec) ->
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
case catch process_vcard_ldap(To, IQ_Rec, LServer) of
|
||||
{'EXIT', _} ->
|
||||
exmpp_iq:error(IQ_Rec, 'internal-server-error');
|
||||
|
@ -132,7 +132,7 @@ process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
|
||||
|
||||
process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
||||
LUser = exmpp_jid:lnode_as_list(To),
|
||||
LServer = exmpp_jid:ldomain_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
Username = ejabberd_odbc:escape(LUser),
|
||||
case catch odbc_queries:get_vcard(LServer, Username) of
|
||||
{selected, ["vcard"], [{SVCARD}]} ->
|
||||
@ -153,7 +153,7 @@ process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
|
||||
end;
|
||||
process_sm_iq(From, _To, #iq{type = set, payload = Request} = IQ_Rec) ->
|
||||
User = exmpp_jid:node_as_list(From),
|
||||
LServer = exmpp_jid:ldomain_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case lists:member(LServer, ?MYHOSTS) of
|
||||
true ->
|
||||
set_vcard(User, LServer, Request),
|
||||
|
@ -1178,7 +1178,7 @@ string_to_spec("server_regexp", Val) ->
|
||||
string_to_spec("node_regexp", Val) ->
|
||||
JID = exmpp_jid:parse(Val),
|
||||
U = exmpp_jid:lnode_as_list(JID),
|
||||
S = exmpp_jid:ldomain_as_list(JID),
|
||||
S = exmpp_jid:prep_domain_as_list(JID),
|
||||
undefined = exmpp_jid:resource(JID),
|
||||
{node_regexp, U, S};
|
||||
string_to_spec("user_glob", Val) ->
|
||||
@ -1188,7 +1188,7 @@ string_to_spec("server_glob", Val) ->
|
||||
string_to_spec("node_glob", Val) ->
|
||||
JID = exmpp_jid:parse(Val),
|
||||
U = exmpp_jid:lnode_as_list(JID),
|
||||
S = exmpp_jid:ldomain_as_list(JID),
|
||||
S = exmpp_jid:prep_domain_as_list(JID),
|
||||
undefined = exmpp_jid:resource(JID),
|
||||
{node_glob, U, S};
|
||||
string_to_spec("all", _) ->
|
||||
@ -1201,7 +1201,7 @@ string_to_spec("raw", Val) ->
|
||||
string_to_spec2(ACLName, Val) ->
|
||||
JID = exmpp_jid:parse(Val),
|
||||
U = exmpp_jid:lnode_as_list(JID),
|
||||
S = exmpp_jid:ldomain_as_list(JID),
|
||||
S = exmpp_jid:prep_domain_as_list(JID),
|
||||
undefined = exmpp_jid:resource(JID),
|
||||
case U of
|
||||
undefined ->
|
||||
|
Loading…
Reference in New Issue
Block a user