24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-14 22:00:16 +02:00

o In process_iq_get/3 and process_iq_set/3, use binary() version of

LUser and LServer.
o  In convert_to_exmpp2/2, user and server are stored as binary().

PR:		EJABP-1

SVN Revision: 1840
This commit is contained in:
Jean-Sébastien Pédron 2009-01-21 13:31:14 +00:00
parent 2f1397c50e
commit 376ee2ed90
2 changed files with 17 additions and 15 deletions

View File

@ -9,6 +9,10 @@
* src/mod_pubsub/nodetree_virtual.erl (create_node/5): Use string()
version of UserName and UserHost.
* src/mod_private.erl (process_iq_get/3, process_iq_set/3): Use
binary() version of LUser and LServer.
(convert_to_exmpp2/2): User and server are stored as binary().
2009-01-19 Pablo Polvorin <pablo.polvorin@process-one.net>
* src/cyrsasl_digest.erl: Typo (prolists -> proplists).

View File

@ -73,8 +73,8 @@ 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),
LServer = exmpp_jid:ldomain_as_list(From),
LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From),
case catch get_data(LUser,
LServer,
exmpp_xml:get_child_elements(SubEl)) of
@ -88,8 +88,8 @@ process_iq_get(From, _To, #iq{payload = SubEl} = IQ_Rec) ->
process_iq_set(From, _To, #iq{payload = SubEl} = IQ_Rec) ->
LUser = exmpp_jid:lnode_as_list(From),
LServer = exmpp_jid:ldomain_as_list(From),
LUser = exmpp_jid:lnode(From),
LServer = exmpp_jid:ldomain(From),
F = fun() ->
lists:foreach(
fun(El) ->
@ -240,14 +240,11 @@ convert_to_exmpp() ->
case mnesia:first(private_storage) of
'$end_of_table' ->
none;
Key ->
case mnesia:read({private_storage, Key}) of
[#private_storage{xml = #xmlel{}}] ->
none;
[#private_storage{xml = #xmlelement{}}] ->
mnesia:foldl(fun convert_to_exmpp2/2,
done, private_storage, write)
end
{U, _S, _NS} when is_binary(U) ->
none;
{U, _S, _NS} when is_list(U) ->
mnesia:foldl(fun convert_to_exmpp2/2,
done, private_storage, write)
end
end,
mnesia:transaction(Fun).
@ -255,12 +252,13 @@ convert_to_exmpp() ->
convert_to_exmpp2(#private_storage{usns = {U, S, NS} = Key, xml = El} = R,
Acc) ->
mnesia:delete({private_storage, Key}),
U1 = list_to_binary(U),
S1 = list_to_binary(S),
NS1 = list_to_atom(NS),
El0 = exmpp_xml:xmlelement_to_xmlel(El,
El1 = exmpp_xml:xmlelement_to_xmlel(El,
[?NS_PRIVATE], [{?NS_XMPP, ?NS_XMPP_pfx}]),
El1 = exmpp_xml:remove_whitespaces_deeply(El0),
New_R = R#private_storage{
usns = {U, S, NS1},
usns = {U1, S1, NS1},
xml = El1},
mnesia:write(New_R),
Acc.