mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
API renaming : lnode_as_list -> prep_node_as_list
SVN Revision: 2126
This commit is contained in:
parent
d5f2c41f26
commit
d51d9e9fff
@ -231,7 +231,7 @@ match_acl(ACLName, JID, Host) ->
|
||||
all -> true;
|
||||
none -> false;
|
||||
_ ->
|
||||
User = exmpp_jid:lnode_as_list(JID),
|
||||
User = exmpp_jid:prep_node_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
Resource = exmpp_jid:lresource_as_list(JID),
|
||||
lists:any(fun(#acl{aclspec = Spec}) ->
|
||||
|
@ -642,7 +642,7 @@ get_cert_domains(Cert) ->
|
||||
if
|
||||
D /= error ->
|
||||
JID = exmpp_jid:parse(D),
|
||||
case {exmpp_jid:lnode_as_list(JID),
|
||||
case {exmpp_jid:prep_node_as_list(JID),
|
||||
exmpp_jid:prep_domain_as_list(JID),
|
||||
exmpp_jid:lresource_as_list(JID)} of
|
||||
{undefined, LD, undefined} ->
|
||||
@ -678,7 +678,7 @@ get_cert_domains(Cert) ->
|
||||
'XmppAddr', XmppAddr) of
|
||||
{ok, D} when is_binary(D) ->
|
||||
JID2 = exmpp_jid:parse(binary_to_list(D)),
|
||||
case {exmpp_jid:lnode_as_list(JID2),
|
||||
case {exmpp_jid:prep_node_as_list(JID2),
|
||||
exmpp_jid:prep_domain_as_list(JID2),
|
||||
exmpp_jid:lresource_as_list(JID2)} of
|
||||
{ undefined, LD, undefined} ->
|
||||
@ -696,7 +696,7 @@ get_cert_domains(Cert) ->
|
||||
end;
|
||||
({dNSName, D}) when is_list(D) ->
|
||||
JID3 = exmpp_jid:parse(D),
|
||||
case {exmpp_jid:lnode_as_list(JID3),
|
||||
case {exmpp_jid:prep_node_as_list(JID3),
|
||||
exmpp_jid:prep_domain_as_list(JID3),
|
||||
exmpp_jid:lresource_as_list(JID3)} of
|
||||
{undefined, LD, undefined} ->
|
||||
|
@ -575,7 +575,7 @@ route_message(From, To, Packet) ->
|
||||
'headline' ->
|
||||
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:prep_node_as_list(To),
|
||||
exmpp_jid:prep_domain_as_list(To)) of
|
||||
true ->
|
||||
ejabberd_hooks:run(offline_message_hook,
|
||||
|
@ -829,7 +829,7 @@ announce_motd_delete(LServer) ->
|
||||
|
||||
send_motd(JID) ->
|
||||
LServer = exmpp_jid:prep_domain_as_list(JID),
|
||||
LUser = exmpp_jid:lnode_as_list(JID),
|
||||
LUser = exmpp_jid:prep_node_as_list(JID),
|
||||
case catch mnesia:dirty_read({motd, LServer}) of
|
||||
[#motd{packet = Packet}] ->
|
||||
US = {LUser, LServer},
|
||||
|
@ -1563,7 +1563,7 @@ set_form(From, Host, ?NS_ADMINL("add-user"), _Lang, XData) ->
|
||||
Password = get_value("password", XData),
|
||||
Password = get_value("password-verify", XData),
|
||||
AccountJID = exmpp_jid:parse(AccountString),
|
||||
User = exmpp_jid:lnode_as_list(AccountJID),
|
||||
User = exmpp_jid:prep_node_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),
|
||||
@ -1576,7 +1576,7 @@ set_form(From, Host, ?NS_ADMINL("delete-user"), _Lang, XData) ->
|
||||
ASL2 = lists:map(
|
||||
fun(AccountString) ->
|
||||
JID = exmpp_jid:parse(AccountString),
|
||||
User = [_|_] = exmpp_jid:lnode_as_list(JID),
|
||||
User = [_|_] = exmpp_jid:prep_node_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),
|
||||
@ -1589,7 +1589,7 @@ set_form(From, Host, ?NS_ADMINL("delete-user"), _Lang, XData) ->
|
||||
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),
|
||||
LUser = [_|_] = exmpp_jid:prep_node_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
|
||||
@ -1608,7 +1608,7 @@ set_form(From, Host, ?NS_ADMINL("end-user-session"), _Lang, XData) ->
|
||||
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),
|
||||
User = [_|_] = exmpp_jid:prep_node_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),
|
||||
@ -1623,7 +1623,7 @@ set_form(From, Host, ?NS_ADMINL("change-user-password"), _Lang, XData) ->
|
||||
AccountString = get_value("accountjid", XData),
|
||||
Password = get_value("password", XData),
|
||||
JID = exmpp_jid:parse(AccountString),
|
||||
User = [_|_] = exmpp_jid:lnode_as_list(JID),
|
||||
User = [_|_] = exmpp_jid:prep_node_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),
|
||||
@ -1633,7 +1633,7 @@ set_form(From, Host, ?NS_ADMINL("change-user-password"), _Lang, XData) ->
|
||||
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),
|
||||
User = [_|_] = exmpp_jid:prep_node_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
true = (Server == Host) orelse (get_permission_level(From) == global),
|
||||
|
||||
@ -1671,7 +1671,7 @@ set_form(From, Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) ->
|
||||
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),
|
||||
User = [_|_] = exmpp_jid:prep_node_as_list(JID),
|
||||
Server = exmpp_jid:prep_domain_as_list(JID),
|
||||
true = (Server == Host) orelse (get_permission_level(From) == global),
|
||||
|
||||
|
@ -289,9 +289,9 @@ process_sm_iq_items(From, To, #iq{type = get, payload = SubEl,
|
||||
exmpp_iq:error(IQ_Rec, Error)
|
||||
end;
|
||||
process_sm_iq_items(From, To, #iq{type = set, payload = SubEl} = IQ_Rec) ->
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LTo = exmpp_jid:prep_node_as_list(To),
|
||||
ToServer = exmpp_jid:prep_domain_as_list(To),
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LFrom = exmpp_jid:prep_node_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', ""),
|
||||
@ -314,9 +314,9 @@ get_sm_items({error, _Error} = Acc, _From, _To, _Node, _Lang) ->
|
||||
Acc;
|
||||
|
||||
get_sm_items(Acc, From, To, <<>>, _Lang) ->
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LFrom = exmpp_jid:prep_node_as_list(From),
|
||||
LSFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LTo = exmpp_jid:prep_node_as_list(To),
|
||||
LSTo = exmpp_jid:prep_domain_as_list(To),
|
||||
|
||||
Items = case Acc of
|
||||
@ -333,9 +333,9 @@ get_sm_items({result, _} = Acc, _From, _To, _Node, _Lang) ->
|
||||
Acc;
|
||||
|
||||
get_sm_items(empty, From, To, _Node, _Lang) ->
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LFrom = exmpp_jid:prep_node_as_list(From),
|
||||
LSFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LTo = exmpp_jid:prep_node_as_list(To),
|
||||
LSTo = exmpp_jid:prep_domain_as_list(To),
|
||||
case {LFrom, LSFrom} of
|
||||
{LTo, LSTo} ->
|
||||
@ -375,9 +375,9 @@ get_sm_identity(Acc, _From, _To, _Node, _Lang) ->
|
||||
Acc.
|
||||
|
||||
get_sm_features(empty, From, To, _Node, _Lang) ->
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LFrom = exmpp_jid:prep_node_as_list(From),
|
||||
LSFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LTo = exmpp_jid:prep_node_as_list(To),
|
||||
LSTo = exmpp_jid:prep_domain_as_list(To),
|
||||
case {LFrom, LSFrom} of
|
||||
{LTo, LSTo} ->
|
||||
@ -404,9 +404,9 @@ get_user_resources(JID) ->
|
||||
|
||||
|
||||
get_publish_items(empty, From, To, Node, _Lang) ->
|
||||
LFrom = exmpp_jid:lnode_as_list(From),
|
||||
LFrom = exmpp_jid:prep_node_as_list(From),
|
||||
LSFrom = exmpp_jid:prep_domain_as_list(From),
|
||||
LTo = exmpp_jid:lnode_as_list(To),
|
||||
LTo = exmpp_jid:prep_node_as_list(To),
|
||||
LSTo = exmpp_jid:prep_domain_as_list(To),
|
||||
if
|
||||
(LFrom == LTo) and (LSFrom == LSTo) ->
|
||||
|
@ -403,7 +403,7 @@ process_irc_register(Host, From, _To, _DefEnc,
|
||||
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),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
US = {LUser, LServer},
|
||||
Customs =
|
||||
@ -488,7 +488,7 @@ get_form(_Host, _, _, _Lang, _) ->
|
||||
|
||||
|
||||
set_form(Host, From, [], _Lang, XData) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
US = {LUser, LServer},
|
||||
case {lists:keysearch("username", 1, XData),
|
||||
@ -534,7 +534,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),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
US = {LUser, LServer},
|
||||
case catch mnesia:dirty_read({irc_custom, {US, Host}}) of
|
||||
|
@ -95,7 +95,7 @@ now_to_seconds({MegaSecs, Secs, _MicroSecs}) ->
|
||||
%%% Serve queries about user last online
|
||||
%%%
|
||||
process_sm_iq(From, To, #iq{type = get} = IQ_Rec) ->
|
||||
User = exmpp_jid:lnode_as_list(To),
|
||||
User = exmpp_jid:prep_node_as_list(To),
|
||||
Server = exmpp_jid:prep_domain_as_list(To),
|
||||
{Subscription, _Groups} =
|
||||
ejabberd_hooks:run_fold(
|
||||
|
@ -161,7 +161,7 @@ store_packet(From, To, Packet) ->
|
||||
(Type /= <<"headline">>) ->
|
||||
case check_event(From, To, Packet) of
|
||||
true ->
|
||||
LUser = exmpp_jid:lnode_as_list(To),
|
||||
LUser = exmpp_jid:prep_node_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
TimeStamp = now(),
|
||||
Expire = find_x_expire(TimeStamp, Packet#xmlel.children),
|
||||
|
@ -103,7 +103,7 @@ loop(Host, MaxOfflineMsgs) ->
|
||||
fun(M) ->
|
||||
Username =
|
||||
ejabberd_odbc:escape(
|
||||
exmpp_jid:lnode_as_list(M#offline_msg.to)),
|
||||
exmpp_jid:prep_node_as_list(M#offline_msg.to)),
|
||||
From = M#offline_msg.from,
|
||||
To = M#offline_msg.to,
|
||||
Packet0 = exmpp_stanza:set_jids(
|
||||
@ -169,7 +169,7 @@ store_packet(From, To, Packet) ->
|
||||
(Type /= <<"headline">>) ->
|
||||
case check_event(From, To, Packet) of
|
||||
true ->
|
||||
LUser = exmpp_jid:lnode_as_list(To),
|
||||
LUser = exmpp_jid:prep_node_as_list(To),
|
||||
TimeStamp = now(),
|
||||
Expire = find_x_expire(TimeStamp, Packet#xmlel.children),
|
||||
gen_mod:get_module_proc(exmpp_jid:prep_domain_as_list(To), ?PROCNAME) !
|
||||
|
@ -87,7 +87,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),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case exmpp_xml:get_child_elements(SubEl) of
|
||||
[] ->
|
||||
@ -246,7 +246,7 @@ list_to_action(S) ->
|
||||
|
||||
|
||||
process_iq_set(_, From, _To, #iq{payload = SubEl}) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case exmpp_xml:get_child_elements(SubEl) of
|
||||
[#xmlel{name = Name} = Child] ->
|
||||
|
@ -83,7 +83,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),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case exmpp_xml:get_child_elements(SubEl) of
|
||||
[] ->
|
||||
@ -252,7 +252,7 @@ list_to_action(S) ->
|
||||
|
||||
|
||||
process_iq_set(_, From, _To, #iq{payload = SubEl}) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case exmpp_xml:get_child_elements(SubEl) of
|
||||
[#xmlel{name = Name} = Child] ->
|
||||
|
@ -67,7 +67,7 @@ process_sm_iq(From, To, #iq{type = Type} = IQ_Rec) ->
|
||||
end.
|
||||
|
||||
process_iq_get(From, _To, #iq{payload = SubEl} = IQ_Rec) ->
|
||||
LUser = exmpp_jid:lnode_as_list(From),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
case catch get_data(LUser,
|
||||
LServer,
|
||||
@ -82,7 +82,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),
|
||||
LUser = exmpp_jid:prep_node_as_list(From),
|
||||
LServer = exmpp_jid:prep_domain_as_list(From),
|
||||
F = fun() ->
|
||||
lists:foreach(
|
||||
|
@ -134,7 +134,7 @@ get_subnodes_tree(_Host, _Node) ->
|
||||
%% is considered as already created.</p>
|
||||
%% <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),
|
||||
UserName = exmpp_jid:prep_node_as_list(Owner),
|
||||
UserHost = exmpp_jid:prep_domain_as_list(Owner),
|
||||
case Node of
|
||||
["home", UserHost, UserName | _] -> {error, {virtual, {Host, Node}}};
|
||||
|
@ -87,7 +87,7 @@ unauthenticated_iq_register(Acc, _Server, _IQ, _IP) ->
|
||||
Acc.
|
||||
|
||||
process_iq(From, To, IQ) ->
|
||||
process_iq(From, To, IQ, {exmpp_jid:lnode_as_list(From),
|
||||
process_iq(From, To, IQ, {exmpp_jid:prep_node_as_list(From),
|
||||
exmpp_jid:prep_domain_as_list(From),
|
||||
exmpp_jid:lresource_as_list(From)}).
|
||||
|
||||
|
@ -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:prep_domain_as_list(JID)} | USs]
|
||||
[{exmpp_jid:prep_node_as_list(JID), exmpp_jid:prep_domain_as_list(JID)} | USs]
|
||||
catch
|
||||
_ ->
|
||||
error
|
||||
|
@ -169,7 +169,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),
|
||||
LUser = exmpp_jid:prep_node_as_list(To),
|
||||
LServer = exmpp_jid:prep_domain_as_list(To),
|
||||
US = {LUser, LServer},
|
||||
F = fun() ->
|
||||
|
@ -254,7 +254,7 @@ process_vcard_ldap(To, IQ_Rec, Server) ->
|
||||
set ->
|
||||
exmpp_iq:error(IQ_Rec, 'not-allowed');
|
||||
get ->
|
||||
LUser = exmpp_jid:lnode_as_list(To),
|
||||
LUser = exmpp_jid:prep_node_as_list(To),
|
||||
LServer = State#state.serverhost,
|
||||
case ejabberd_auth:is_user_exists(LUser, LServer) of
|
||||
true ->
|
||||
|
@ -131,7 +131,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),
|
||||
LUser = exmpp_jid:prep_node_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
|
||||
|
@ -1177,7 +1177,7 @@ string_to_spec("server_regexp", Val) ->
|
||||
{server_regexp, Val};
|
||||
string_to_spec("node_regexp", Val) ->
|
||||
JID = exmpp_jid:parse(Val),
|
||||
U = exmpp_jid:lnode_as_list(JID),
|
||||
U = exmpp_jid:prep_node_as_list(JID),
|
||||
S = exmpp_jid:prep_domain_as_list(JID),
|
||||
undefined = exmpp_jid:resource(JID),
|
||||
{node_regexp, U, S};
|
||||
@ -1187,7 +1187,7 @@ string_to_spec("server_glob", Val) ->
|
||||
{server_glob, Val};
|
||||
string_to_spec("node_glob", Val) ->
|
||||
JID = exmpp_jid:parse(Val),
|
||||
U = exmpp_jid:lnode_as_list(JID),
|
||||
U = exmpp_jid:prep_node_as_list(JID),
|
||||
S = exmpp_jid:prep_domain_as_list(JID),
|
||||
undefined = exmpp_jid:resource(JID),
|
||||
{node_glob, U, S};
|
||||
@ -1200,7 +1200,7 @@ string_to_spec("raw", Val) ->
|
||||
|
||||
string_to_spec2(ACLName, Val) ->
|
||||
JID = exmpp_jid:parse(Val),
|
||||
U = exmpp_jid:lnode_as_list(JID),
|
||||
U = exmpp_jid:prep_node_as_list(JID),
|
||||
S = exmpp_jid:prep_domain_as_list(JID),
|
||||
undefined = exmpp_jid:resource(JID),
|
||||
case U of
|
||||
|
Loading…
Reference in New Issue
Block a user