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