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

Update to use the new names used in exmpp_jid.

SVN Revision: 1515
This commit is contained in:
Jean-Sébastien Pédron 2008-08-06 13:51:42 +00:00
parent cb20c9b0d7
commit 85c2097ece
13 changed files with 60 additions and 54 deletions

View File

@ -8,6 +8,12 @@
src/mod_disco.erl, src/mod_caps.erl: Update to use the new src/mod_disco.erl, src/mod_caps.erl: Update to use the new
exmpp_xml:get_attribute/{3,4} API. exmpp_xml:get_attribute/{3,4} API.
* src/ejabberd_c2s.erl, src/ejabberd_s2s_in.erl,
src/ejabberd_s2s_out.erl, src/ejabberd_service.erl, src/mod_adhoc.erl,
src/mod_caps.erl, src/mod_configure.erl, src/mod_disco.erl,
src/mod_echo.erl, src/mod_offline.erl, src/mod_roster.erl,
src/mod_vcard.erl: Update to use the new names used in exmpp_jid.
2008-07-25 Jean-Sébastien Pédron <js.pedron@meetic-corp.com> 2008-07-25 Jean-Sébastien Pédron <js.pedron@meetic-corp.com>
* src/adhoc.erl, src/mod_configure.erl, src/mod_announce.erl, * src/adhoc.erl, src/mod_configure.erl, src/mod_announce.erl,

View File

@ -398,7 +398,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
?INFO_MSG( ?INFO_MSG(
"(~w) Accepted legacy authentication for ~s", "(~w) Accepted legacy authentication for ~s",
[StateData#state.socket, [StateData#state.socket,
exmpp_jid:jid_to_string(JID)]), exmpp_jid:jid_to_list(JID)]),
SID = {now(), self()}, SID = {now(), self()},
Conn = get_conn_type(StateData), Conn = get_conn_type(StateData),
Info = [{ip, StateData#state.ip}, {conn, Conn}, Info = [{ip, StateData#state.ip}, {conn, Conn},
@ -435,7 +435,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
?INFO_MSG( ?INFO_MSG(
"(~w) Failed legacy authentication for ~s", "(~w) Failed legacy authentication for ~s",
[StateData#state.socket, [StateData#state.socket,
exmpp_jid:jid_to_string(JID)]), exmpp_jid:jid_to_list(JID)]),
Res = exmpp_iq:error_without_original(El, Res = exmpp_iq:error_without_original(El,
'not-authorized'), 'not-authorized'),
send_element(StateData, Res), send_element(StateData, Res),
@ -445,7 +445,7 @@ wait_for_auth({xmlstreamelement, El}, StateData) ->
?INFO_MSG( ?INFO_MSG(
"(~w) Forbidden legacy authentication for ~s", "(~w) Forbidden legacy authentication for ~s",
[StateData#state.socket, [StateData#state.socket,
exmpp_jid:jid_to_string(JID)]), exmpp_jid:jid_to_list(JID)]),
Res = exmpp_iq:error_without_original(El, Res = exmpp_iq:error_without_original(El,
'not-allowed'), 'not-allowed'),
send_element(StateData, Res), send_element(StateData, Res),
@ -713,7 +713,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
allow -> allow ->
?INFO_MSG("(~w) Opened session for ~s", ?INFO_MSG("(~w) Opened session for ~s",
[StateData#state.socket, [StateData#state.socket,
exmpp_jid:jid_to_string(JID)]), exmpp_jid:jid_to_list(JID)]),
SID = {now(), self()}, SID = {now(), self()},
Conn = get_conn_type(StateData), Conn = get_conn_type(StateData),
Info = [{ip, StateData#state.ip}, {conn, Conn}, Info = [{ip, StateData#state.ip}, {conn, Conn},
@ -750,7 +750,7 @@ wait_for_session({xmlstreamelement, El}, StateData) ->
StateData#state.server, [JIDOld]), StateData#state.server, [JIDOld]),
?INFO_MSG("(~w) Forbidden session for ~s", ?INFO_MSG("(~w) Forbidden session for ~s",
[StateData#state.socket, [StateData#state.socket,
exmpp_jid:jid_to_string(JID)]), exmpp_jid:jid_to_list(JID)]),
Err = exmpp_server_session:error(El, 'not-allowed'), Err = exmpp_server_session:error(El, 'not-allowed'),
send_element(StateData, Err), send_element(StateData, Err),
fsm_next_state(wait_for_session, StateData) fsm_next_state(wait_for_session, StateData)
@ -787,7 +787,7 @@ session_established({xmlstreamelement, El}, StateData) ->
undefined -> undefined ->
exmpp_jid:make_bare_jid(User, Server); exmpp_jid:make_bare_jid(User, Server);
_ -> _ ->
exmpp_jid:string_to_jid(To) exmpp_jid:list_to_jid(To)
end, end,
NewEl = case exmpp_stanza:get_lang(El) of NewEl = case exmpp_stanza:get_lang(El) of
undefined -> undefined ->
@ -1237,7 +1237,7 @@ terminate(_Reason, StateName, StateData) ->
replaced -> replaced ->
?INFO_MSG("(~w) Replaced session for ~s", ?INFO_MSG("(~w) Replaced session for ~s",
[StateData#state.socket, [StateData#state.socket,
exmpp_jid:jid_to_string(StateData#state.jid)]), exmpp_jid:jid_to_list(StateData#state.jid)]),
From = StateData#state.jid, From = StateData#state.jid,
Packet = exmpp_presence:unavailable(), Packet = exmpp_presence:unavailable(),
Packet1 = exmpp_presence:set_status(Packet, Packet1 = exmpp_presence:set_status(Packet,
@ -1255,7 +1255,7 @@ terminate(_Reason, StateName, StateData) ->
_ -> _ ->
?INFO_MSG("(~w) Close session for ~s", ?INFO_MSG("(~w) Close session for ~s",
[StateData#state.socket, [StateData#state.socket,
exmpp_jid:jid_to_string(StateData#state.jid)]), exmpp_jid:jid_to_list(StateData#state.jid)]),
EmptySet = ?SETS:new(), EmptySet = ?SETS:new(),
case StateData of case StateData of

View File

@ -371,7 +371,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
error; error;
F -> F ->
try try
exmpp_jid:string_to_jid(F) exmpp_jid:list_to_jid(F)
catch catch
_Exception1 -> error _Exception1 -> error
end end
@ -381,7 +381,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
error; error;
T -> T ->
try try
exmpp_jid:string_to_jid(T) exmpp_jid:list_to_jid(T)
catch catch
_Exception2 -> error _Exception2 -> error
end end
@ -621,7 +621,7 @@ get_cert_domains(Cert) ->
end, end,
if if
D /= error -> D /= error ->
case exmpp_jid:string_to_jid(D) of case exmpp_jid:list_to_jid(D) of
#jid{lnode = undefined, #jid{lnode = undefined,
ldomain = LD, ldomain = LD,
lresource = undefined} -> lresource = undefined} ->
@ -674,7 +674,7 @@ get_cert_domains(Cert) ->
[] []
end; end;
({dNSName, D}) when is_list(D) -> ({dNSName, D}) when is_list(D) ->
case exmpp_jid:string_to_jid(D) of case exmpp_jid:list_to_jid(D) of
#jid{lnode = undefined, #jid{lnode = undefined,
ldomain = LD, ldomain = LD,
lresource = undefined} -> lresource = undefined} ->

View File

@ -809,8 +809,8 @@ bounce_element(El, Condition) ->
"result" -> ok; "result" -> ok;
_ -> _ ->
Err = exmpp_stanza:reply_with_error(El, Condition), Err = exmpp_stanza:reply_with_error(El, Condition),
From = exmpp_jid:string_to_jid(exmpp_stanza:get_sender(El)), From = exmpp_jid:list_to_jid(exmpp_stanza:get_sender(El)),
To = exmpp_jid:string_to_jid(exmpp_stanza:get_recipient(El)), To = exmpp_jid:list_to_jid(exmpp_stanza:get_recipient(El)),
% No namespace conversion (:server <-> :client) is done. % No namespace conversion (:server <-> :client) is done.
% This is handled by C2S and S2S send_element functions. % This is handled by C2S and S2S send_element functions.
ejabberd_router:route(To, From, Err) ejabberd_router:route(To, From, Err)

View File

@ -223,7 +223,7 @@ stream_established({xmlstreamelement, El}, StateData) ->
%% when accept packets from any address. %% when accept packets from any address.
%% In this case, the component can send packet of %% In this case, the component can send packet of
%% behalf of the server users. %% behalf of the server users.
false -> exmpp_jid:string_to_jid(From); false -> exmpp_jid:list_to_jid(From);
%% The default is the standard behaviour in XEP-0114 %% The default is the standard behaviour in XEP-0114
_ -> _ ->
FromJID1 = exmpp_jib:string_to_jid(From), FromJID1 = exmpp_jib:string_to_jid(From),

View File

@ -124,7 +124,7 @@ get_sm_commands(Acc, _From, #jid{ldomain = LServer} = To, "", Lang) ->
end, end,
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS, Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS,
name = 'item', attrs = name = 'item', attrs =
[#xmlattr{name = 'jid', value = exmpp_jid:jid_to_string(To)}, [#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(To)},
#xmlattr{name = 'node', value = ?NS_ADHOC_s}, #xmlattr{name = 'node', value = ?NS_ADHOC_s},
#xmlattr{name = 'name', value = translate:translate(Lang, "Commands")}] #xmlattr{name = 'name', value = translate:translate(Lang, "Commands")}]
}], }],

View File

@ -254,9 +254,9 @@ handle_cast({disco_response, From, _To, IQ},
?ERROR_MSG("ID '~s' matches no query", [ID]) ?ERROR_MSG("ID '~s' matches no query", [ID])
end; end;
%gen_server:cast(self(), visit_feature_queries), %gen_server:cast(self(), visit_feature_queries),
%?DEBUG("Error IQ reponse from ~s:~n~p", [exmpp_jid:jid_to_string(From), SubEls]); %?DEBUG("Error IQ reponse from ~s:~n~p", [exmpp_jid:jid_to_list(From), SubEls]);
{result, _} -> {result, _} ->
?DEBUG("Invalid IQ contents from ~s:~n~p", [exmpp_jid:jid_to_string(From), IQ#xmlel.children]); ?DEBUG("Invalid IQ contents from ~s:~n~p", [exmpp_jid:jid_to_list(From), IQ#xmlel.children]);
_ -> _ ->
%% Can't do anything about errors %% Can't do anything about errors
ok ok

View File

@ -98,7 +98,7 @@ stop(Host) ->
-define(NODEJID(To, Name, Node), -define(NODEJID(To, Name, Node),
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[#xmlattr{name = 'jid', value = exmpp_jid:jid_to_string(To)}, [#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(To)},
#xmlattr{name = 'name', value = ?T(Lang, Name)}, #xmlattr{name = 'name', value = ?T(Lang, Name)},
#xmlattr{name = 'node', value = Node}]}). #xmlattr{name = 'node', value = Node}]}).
@ -258,7 +258,7 @@ adhoc_sm_items(Acc, From, #jid{ldomain = LServer} = To, Lang) ->
empty -> [] empty -> []
end, end,
Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = Nodes = [#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[#xmlattr{name = 'jid', value = exmpp_jid:jid_to_string(To)}, [#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(To)},
#xmlattr{name = 'name', value = ?T(Lang, "Configuration")}, #xmlattr{name = 'name', value = ?T(Lang, "Configuration")},
#xmlattr{name = 'node', value = "config"}]}], #xmlattr{name = 'node', value = "config"}]}],
{result, Items ++ Nodes}; {result, Items ++ Nodes};
@ -297,7 +297,7 @@ get_user_resources(User, Server) ->
Rs = ejabberd_sm:get_user_resources(User, Server), Rs = ejabberd_sm:get_user_resources(User, Server),
lists:map(fun(R) -> lists:map(fun(R) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[#xmlattr{name = 'jid', value = exmpp_jid:jid_to_string(User, Server, R)}, [#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(User, Server, R)},
#xmlattr{name = 'name', value = User}]} #xmlattr{name = 'name', value = User}]}
end, lists:sort(Rs)). end, lists:sort(Rs)).
@ -365,7 +365,7 @@ recursively_get_local_items(LServer, Node, Server, Lang) ->
Fallback; Fallback;
allow -> allow ->
case get_local_items(LServer, LNode, case get_local_items(LServer, LNode,
exmpp_jid:jid_to_string(To), Lang) of exmpp_jid:jid_to_list(To), Lang) of
{result, Res} -> {result, Res} ->
{result, Res}; {result, Res};
{error, Error} -> {error, Error} ->
@ -388,7 +388,7 @@ get_local_items(Acc, From, #jid{ldomain = LServer} = To, "", Lang) ->
{result, Items}; {result, Items};
allow -> allow ->
case get_local_items(LServer, [], case get_local_items(LServer, [],
exmpp_jid:jid_to_string(To), Lang) of exmpp_jid:jid_to_list(To), Lang) of
{result, Res} -> {result, Res} ->
{result, Items ++ Res}; {result, Items ++ Res};
{error, _Error} -> {error, _Error} ->
@ -507,8 +507,8 @@ get_local_items(Host, ["all users", [$@ | Diap]], _Server, _Lang) ->
Sub = lists:sublist(SUsers, N1, N2 - N1 + 1), Sub = lists:sublist(SUsers, N1, N2 - N1 + 1),
lists:map(fun({S, U}) -> lists:map(fun({S, U}) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[#xmlattr{name = 'jid', value = exmpp_jid:jid_to_string(U, S)}, [#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(U, S)},
#xmlattr{name = 'name', value = exmpp_jid:jid_to_string(U, S)}]} #xmlattr{name = 'name', value = exmpp_jid:jid_to_list(U, S)}]}
end, Sub) end, Sub)
end of end of
{'EXIT', _Reason} -> {'EXIT', _Reason} ->
@ -591,8 +591,8 @@ get_online_vh_users(Host) ->
SURs = lists:sort([{S, U, R} || {U, S, R} <- USRs]), SURs = lists:sort([{S, U, R} || {U, S, R} <- USRs]),
lists:map(fun({S, U, R}) -> lists:map(fun({S, U, R}) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[#xmlattr{name = 'jid', value = exmpp_jid:jid_to_string(U, S, R)}, [#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(U, S, R)},
#xmlattr{name = 'name', value = exmpp_jid:jid_to_string(U, S)}]} #xmlattr{name = 'name', value = exmpp_jid:jid_to_list(U, S)}]}
end, SURs) end, SURs)
end. end.
@ -606,8 +606,8 @@ get_all_vh_users(Host) ->
N when N =< 100 -> N when N =< 100 ->
lists:map(fun({S, U}) -> lists:map(fun({S, U}) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs =
[#xmlattr{name = 'jid', value = exmpp_jid:jid_to_string(U, S)}, [#xmlattr{name = 'jid', value = exmpp_jid:jid_to_list(U, S)},
#xmlattr{name = 'name', value = exmpp_jid:jid_to_string(U, S)}]} #xmlattr{name = 'name', value = exmpp_jid:jid_to_list(U, S)}]}
end, SUsers); end, SUsers);
N -> N ->
NParts = trunc(math:sqrt(N * 0.618)) + 1, NParts = trunc(math:sqrt(N * 0.618)) + 1,
@ -1534,7 +1534,7 @@ set_form(_From, _Host, ?NS_ADMINL("add-user"), _Lang, XData) ->
AccountString = get_value("accountjid", XData), AccountString = get_value("accountjid", XData),
Password = get_value("password", XData), Password = get_value("password", XData),
Password = get_value("password-verify", XData), Password = get_value("password-verify", XData),
AccountJID = exmpp_jid:string_to_jid(AccountString), AccountJID = exmpp_jid:list_to_jid(AccountString),
User = AccountJID#jid.lnode, User = AccountJID#jid.lnode,
Server = AccountJID#jid.ldomain, Server = AccountJID#jid.ldomain,
true = lists:member(Server, ?MYHOSTS), true = lists:member(Server, ?MYHOSTS),
@ -1546,7 +1546,7 @@ set_form(_From, _Host, ?NS_ADMINL("delete-user"), _Lang, XData) ->
[_|_] = AccountStringList, [_|_] = AccountStringList,
ASL2 = lists:map( ASL2 = lists:map(
fun(AccountString) -> fun(AccountString) ->
JID = exmpp_jid:string_to_jid(AccountString), JID = exmpp_jid:list_to_jid(AccountString),
[_|_] = JID#jid.lnode, [_|_] = JID#jid.lnode,
User = JID#jid.lnode, User = JID#jid.lnode,
Server = JID#jid.ldomain, Server = JID#jid.ldomain,
@ -1559,7 +1559,7 @@ set_form(_From, _Host, ?NS_ADMINL("delete-user"), _Lang, XData) ->
set_form(_From, _Host, ?NS_ADMINL("end-user-session"), _Lang, XData) -> set_form(_From, _Host, ?NS_ADMINL("end-user-session"), _Lang, XData) ->
AccountString = get_value("accountjid", XData), AccountString = get_value("accountjid", XData),
JID = exmpp_jid:string_to_jid(AccountString), JID = exmpp_jid:list_to_jid(AccountString),
[_|_] = JID#jid.lnode, [_|_] = JID#jid.lnode,
LUser = JID#jid.lnode, LUser = JID#jid.lnode,
LServer = JID#jid.ldomain, LServer = JID#jid.ldomain,
@ -1578,7 +1578,7 @@ set_form(_From, _Host, ?NS_ADMINL("end-user-session"), _Lang, XData) ->
set_form(_From, _Host, ?NS_ADMINL("get-user-password"), Lang, XData) -> set_form(_From, _Host, ?NS_ADMINL("get-user-password"), Lang, XData) ->
AccountString = get_value("accountjid", XData), AccountString = get_value("accountjid", XData),
JID = exmpp_jid:string_to_jid(AccountString), JID = exmpp_jid:list_to_jid(AccountString),
[_|_] = JID#jid.lnode, [_|_] = JID#jid.lnode,
User = JID#jid.lnode, User = JID#jid.lnode,
Server = JID#jid.ldomain, Server = JID#jid.ldomain,
@ -1593,7 +1593,7 @@ set_form(_From, _Host, ?NS_ADMINL("get-user-password"), Lang, XData) ->
set_form(_From, _Host, ?NS_ADMINL("change-user-password"), _Lang, XData) -> set_form(_From, _Host, ?NS_ADMINL("change-user-password"), _Lang, XData) ->
AccountString = get_value("accountjid", XData), AccountString = get_value("accountjid", XData),
Password = get_value("password", XData), Password = get_value("password", XData),
JID = exmpp_jid:string_to_jid(AccountString), JID = exmpp_jid:list_to_jid(AccountString),
[_|_] = JID#jid.lnode, [_|_] = JID#jid.lnode,
User = JID#jid.lnode, User = JID#jid.lnode,
Server = JID#jid.ldomain, Server = JID#jid.ldomain,
@ -1603,7 +1603,7 @@ set_form(_From, _Host, ?NS_ADMINL("change-user-password"), _Lang, XData) ->
set_form(_From, _Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) -> set_form(_From, _Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) ->
AccountString = get_value("accountjid", XData), AccountString = get_value("accountjid", XData),
JID = exmpp_jid:string_to_jid(AccountString), JID = exmpp_jid:list_to_jid(AccountString),
[_|_] = JID#jid.lnode, [_|_] = JID#jid.lnode,
User = JID#jid.lnode, User = JID#jid.lnode,
Server = JID#jid.ldomain, Server = JID#jid.ldomain,
@ -1640,7 +1640,7 @@ set_form(_From, _Host, ?NS_ADMINL("get-user-lastlogin"), Lang, XData) ->
set_form(_From, _Host, ?NS_ADMINL("user-stats"), Lang, XData) -> set_form(_From, _Host, ?NS_ADMINL("user-stats"), Lang, XData) ->
AccountString = get_value("accountjid", XData), AccountString = get_value("accountjid", XData),
JID = exmpp_jid:string_to_jid(AccountString), JID = exmpp_jid:list_to_jid(AccountString),
[_|_] = JID#jid.lnode, [_|_] = JID#jid.lnode,
User = JID#jid.lnode, User = JID#jid.lnode,
Server = JID#jid.ldomain, Server = JID#jid.ldomain,

View File

@ -418,7 +418,7 @@ get_user_resources(User, Server) ->
lists:map(fun(R) -> lists:map(fun(R) ->
#xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [ #xmlel{ns = ?NS_DISCO_ITEMS, name = 'item', attrs = [
#xmlattr{name = 'jid', value = #xmlattr{name = 'jid', value =
exmpp_jid:jid_to_string(User, Server, R)}, exmpp_jid:jid_to_list(User, Server, R)},
#xmlattr{name = 'name', value = User} #xmlattr{name = 'name', value = User}
]} ]}
end, lists:sort(Rs)). end, lists:sort(Rs)).

View File

@ -200,5 +200,5 @@ do_client_version(enabled, From, To) ->
%% Print in log %% Print in log
Values_string1 = [io_lib:format("~n~s: ~p", [N, V]) || {N, V} <- Values], Values_string1 = [io_lib:format("~n~s: ~p", [N, V]) || {N, V} <- Values],
Values_string2 = lists:concat(Values_string1), Values_string2 = lists:concat(Values_string1),
?INFO_MSG("Information of the client: ~s~s", [exmpp_jid:jid_to_string(To), Values_string2]). ?INFO_MSG("Information of the client: ~s~s", [exmpp_jid:jid_to_list(To), Values_string2]).

View File

@ -497,8 +497,8 @@ user_queue(User, Server, Query, Lang) ->
io_lib:format( io_lib:format(
"~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w", "~w-~.2.0w-~.2.0w ~.2.0w:~.2.0w:~.2.0w",
[Year, Month, Day, Hour, Minute, Second])), [Year, Month, Day, Hour, Minute, Second])),
SFrom = exmpp_jid:jid_to_string(jlib:from_old_jid(From)), SFrom = exmpp_jid:jid_to_list(jlib:from_old_jid(From)),
STo = exmpp_jid:jid_to_string(jlib:from_old_jid(To)), STo = exmpp_jid:jid_to_list(jlib:from_old_jid(To)),
Packet0 = exmpp_xml:xmlelement_to_xmlel(Packet, Packet0 = exmpp_xml:xmlelement_to_xmlel(Packet,
[?DEFAULT_NS], ?PREFIXED_NS), [?DEFAULT_NS], ?PREFIXED_NS),
Packet1 = exmpp_stanza:set_jids(Packet0, SFrom, STo), Packet1 = exmpp_stanza:set_jids(Packet0, SFrom, STo),
@ -568,7 +568,7 @@ user_queue_parse_query(US, Query) ->
end. end.
us_to_list({User, Server}) -> us_to_list({User, Server}) ->
exmpp_jid:jid_to_string(User, Server). exmpp_jid:jid_to_list(User, Server).
webadmin_user(Acc, User, Server, Lang) -> webadmin_user(Acc, User, Server, Lang) ->
US = {exmpp_stringprep:nodeprep(User), exmpp_stringprep:nameprep(Server)}, US = {exmpp_stringprep:nodeprep(User), exmpp_stringprep:nameprep(Server)},

View File

@ -156,7 +156,7 @@ get_user_roster(Acc, US) ->
item_to_xml(Item) -> item_to_xml(Item) ->
{U, S, R} = Item#roster.jid, {U, S, R} = Item#roster.jid,
Attrs1 = exmpp_xml:set_attribute_in_list([], Attrs1 = exmpp_xml:set_attribute_in_list([],
'jid', exmpp_jid:jid_to_string(U, S, R)), 'jid', exmpp_jid:jid_to_list(U, S, R)),
Attrs2 = case Item#roster.name of Attrs2 = case Item#roster.name of
"" -> "" ->
Attrs1; Attrs1;
@ -194,7 +194,7 @@ process_iq_set(From, To, IQ) ->
process_item_set(From, To, #xmlel{} = Item) -> process_item_set(From, To, #xmlel{} = Item) ->
try try
JID1 = exmpp_jid:string_to_jid(exmpp_xml:get_attribute(Item, 'jid', "")), JID1 = exmpp_jid:list_to_jid(exmpp_xml:get_attribute(Item, 'jid', "")),
% XXX OLD FORMAT: old JID (with empty strings). % XXX OLD FORMAT: old JID (with empty strings).
#jid{node = User, lnode = LUser, ldomain = LServer} = #jid{node = User, lnode = LUser, ldomain = LServer} =
jlib:to_old_jid(From), jlib:to_old_jid(From),
@ -276,7 +276,7 @@ process_item_attrs(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
case Attr of case Attr of
'jid' -> 'jid' ->
try try
JID1 = exmpp_jid:string_to_jid(Val), JID1 = exmpp_jid:list_to_jid(Val),
JID = {JID1#jid.node, JID1#jid.domain, JID1#jid.resource}, JID = {JID1#jid.node, JID1#jid.domain, JID1#jid.resource},
process_item_attrs(Item#roster{jid = JID}, Attrs) process_item_attrs(Item#roster{jid = JID}, Attrs)
catch catch
@ -587,7 +587,7 @@ set_items(User, Server, SubEl) ->
process_item_set_t(LUser, LServer, #xmlel{} = El) -> process_item_set_t(LUser, LServer, #xmlel{} = El) ->
try try
JID1 = exmpp_jid:string_to_jid(exmpp_xml:get_attribute(El, 'jid', "")), JID1 = exmpp_jid:list_to_jid(exmpp_xml:get_attribute(El, 'jid', "")),
JID = {JID1#jid.node, JID1#jid.domain, JID1#jid.resource}, JID = {JID1#jid.node, JID1#jid.domain, JID1#jid.resource},
LJID = {JID1#jid.lnode, JID1#jid.ldomain, JID1#jid.lresource}, LJID = {JID1#jid.lnode, JID1#jid.ldomain, JID1#jid.lresource},
Item = #roster{usj = {LUser, LServer, LJID}, Item = #roster{usj = {LUser, LServer, LJID},
@ -612,7 +612,7 @@ process_item_attrs_ws(Item, [#xmlattr{name = Attr, value = Val} | Attrs]) ->
case Attr of case Attr of
'jid' -> 'jid' ->
try try
JID1 = exmpp_jid:string_to_jid(Val), JID1 = exmpp_jid:list_to_jid(Val),
JID = {JID1#jid.node, JID1#jid.domain, JID1#jid.resource}, JID = {JID1#jid.node, JID1#jid.domain, JID1#jid.resource},
process_item_attrs_ws(Item#roster{jid = JID}, Attrs) process_item_attrs_ws(Item#roster{jid = JID}, Attrs)
catch catch
@ -664,9 +664,9 @@ get_in_pending_subscriptions(Ls, User, Server) ->
end, end,
{U, S, R} = R#roster.jid, {U, S, R} = R#roster.jid,
Attrs1 = exmpp_stanza:set_sender_in_list([], Attrs1 = exmpp_stanza:set_sender_in_list([],
exmpp_jid:jid_to_string(U, S, R)), exmpp_jid:jid_to_list(U, S, R)),
Attrs2 = exmpp_stanza:set_recipient_in_list(Attrs1, Attrs2 = exmpp_stanza:set_recipient_in_list(Attrs1,
exmpp_jid:jid_to_string(JID)), exmpp_jid:jid_to_list(JID)),
Pres1 = exmpp_presence:subscribe(), Pres1 = exmpp_presence:subscribe(),
Pres2 = Pres1#xmlel{attrs = Attrs2}, Pres2 = Pres1#xmlel{attrs = Attrs2},
exmpp_presence:set_status(Pres2, Status) exmpp_presence:set_status(Pres2, Status)
@ -815,7 +815,7 @@ user_roster(User, Server, Query, Lang) ->
{U, S, R} = R#roster.jid, {U, S, R} = R#roster.jid,
?XE("tr", ?XE("tr",
[?XAC("td", [{"class", "valign"}], [?XAC("td", [{"class", "valign"}],
catch exmpp_jid:jid_to_string(U, S, R)), catch exmpp_jid:jid_to_list(U, S, R)),
?XAC("td", [{"class", "valign"}], ?XAC("td", [{"class", "valign"}],
R#roster.name), R#roster.name),
?XAC("td", [{"class", "valign"}], ?XAC("td", [{"class", "valign"}],
@ -861,7 +861,7 @@ user_roster_parse_query(User, Server, Items, Query) ->
error; error;
{value, {_, SJID}} -> {value, {_, SJID}} ->
try try
JID = exmpp_jid:string_to_jid(SJID), JID = exmpp_jid:list_to_jid(SJID),
user_roster_subscribe_jid(User, Server, JID), user_roster_subscribe_jid(User, Server, JID),
ok ok
catch catch
@ -911,7 +911,7 @@ user_roster_item_parse_query(User, Server, Items, Query) ->
{value, _} -> {value, _} ->
UJID = exmpp_jid:make_bare_jid(User, Server), UJID = exmpp_jid:make_bare_jid(User, Server),
Attrs1 = exmpp_xml:set_attribute_in_list([], Attrs1 = exmpp_xml:set_attribute_in_list([],
'jid', exmpp_jid:jid_to_string(JID)), 'jid', exmpp_jid:jid_to_list(JID)),
Attrs2 = exmpp_xml:set_attribute_in_list(Attrs1, Attrs2 = exmpp_xml:set_attribute_in_list(Attrs1,
'subscription', "remove"), 'subscription', "remove"),
Item = #xmlel{ns = ?NS_ROSTER, name = 'item', Item = #xmlel{ns = ?NS_ROSTER, name = 'item',
@ -933,7 +933,7 @@ user_roster_item_parse_query(User, Server, Items, Query) ->
nothing. nothing.
us_to_list({User, Server}) -> us_to_list({User, Server}) ->
exmpp_jid:bare_jid_to_string(User, Server). exmpp_jid:bare_jid_to_list(User, Server).
webadmin_user(Acc, _User, _Server, Lang) -> webadmin_user(Acc, _User, _Server, Lang) ->
Acc ++ [?XE("h3", [?ACT("roster/", "Roster")])]. Acc ++ [?XE("h3", [?ACT("roster/", "Roster")])].

View File

@ -303,7 +303,7 @@ set_vcard(User, LServer, VCARD) ->
#xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs = #xmlel{ns = ?NS_DATA_FORMS, name = 'x', attrs =
[#xmlattr{name = 'type', value = "form"}], children = [#xmlattr{name = 'type', value = "form"}], children =
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Search users in ") ++ exmpp_jid:jid_to_string(JID))}]}, [#xmlcdata{cdata = list_to_binary(translate:translate(Lang, "Search users in ") ++ exmpp_jid:jid_to_list(JID))}]},
#xmlel{ns = ?NS_SEARCH, name = 'instructions', children = #xmlel{ns = ?NS_SEARCH, name = 'instructions', children =
[#xmlcdata{cdata = list_to_binary(translate:translate(Lang, [#xmlcdata{cdata = list_to_binary(translate:translate(Lang,
"Fill in the form to search " "Fill in the form to search "
@ -459,7 +459,7 @@ search_result(Lang, JID, ServerHost, Data) ->
[#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children = [#xmlel{ns = ?NS_DATA_FORMS, name = 'title', children =
[#xmlcdata{cdata = list_to_binary( [#xmlcdata{cdata = list_to_binary(
translate:translate(Lang, "Search Results for ") ++ translate:translate(Lang, "Search Results for ") ++
exmpp_jid:jid_to_string(JID))}]}, exmpp_jid:jid_to_list(JID))}]},
#xmlel{ns = ?NS_DATA_FORMS, name = 'reported', children = #xmlel{ns = ?NS_DATA_FORMS, name = 'reported', children =
[?TLFIELD("text-single", "Jabber ID", "jid"), [?TLFIELD("text-single", "Jabber ID", "jid"),
?TLFIELD("text-single", "Full Name", "fn"), ?TLFIELD("text-single", "Full Name", "fn"),