mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01: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:
parent
2f1397c50e
commit
376ee2ed90
@ -9,6 +9,10 @@
|
|||||||
* src/mod_pubsub/nodetree_virtual.erl (create_node/5): Use string()
|
* src/mod_pubsub/nodetree_virtual.erl (create_node/5): Use string()
|
||||||
version of UserName and UserHost.
|
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>
|
2009-01-19 Pablo Polvorin <pablo.polvorin@process-one.net>
|
||||||
|
|
||||||
* src/cyrsasl_digest.erl: Typo (prolists -> proplists).
|
* src/cyrsasl_digest.erl: Typo (prolists -> proplists).
|
||||||
|
@ -73,8 +73,8 @@ process_sm_iq(From, To, #iq{type = Type} = IQ_Rec) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
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(From),
|
||||||
LServer = exmpp_jid:ldomain_as_list(From),
|
LServer = exmpp_jid:ldomain(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
|
||||||
@ -88,8 +88,8 @@ 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(From),
|
||||||
LServer = exmpp_jid:ldomain_as_list(From),
|
LServer = exmpp_jid:ldomain(From),
|
||||||
F = fun() ->
|
F = fun() ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(El) ->
|
fun(El) ->
|
||||||
@ -240,27 +240,25 @@ convert_to_exmpp() ->
|
|||||||
case mnesia:first(private_storage) of
|
case mnesia:first(private_storage) of
|
||||||
'$end_of_table' ->
|
'$end_of_table' ->
|
||||||
none;
|
none;
|
||||||
Key ->
|
{U, _S, _NS} when is_binary(U) ->
|
||||||
case mnesia:read({private_storage, Key}) of
|
|
||||||
[#private_storage{xml = #xmlel{}}] ->
|
|
||||||
none;
|
none;
|
||||||
[#private_storage{xml = #xmlelement{}}] ->
|
{U, _S, _NS} when is_list(U) ->
|
||||||
mnesia:foldl(fun convert_to_exmpp2/2,
|
mnesia:foldl(fun convert_to_exmpp2/2,
|
||||||
done, private_storage, write)
|
done, private_storage, write)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
mnesia:transaction(Fun).
|
mnesia:transaction(Fun).
|
||||||
|
|
||||||
convert_to_exmpp2(#private_storage{usns = {U, S, NS} = Key, xml = El} = R,
|
convert_to_exmpp2(#private_storage{usns = {U, S, NS} = Key, xml = El} = R,
|
||||||
Acc) ->
|
Acc) ->
|
||||||
mnesia:delete({private_storage, Key}),
|
mnesia:delete({private_storage, Key}),
|
||||||
|
U1 = list_to_binary(U),
|
||||||
|
S1 = list_to_binary(S),
|
||||||
NS1 = list_to_atom(NS),
|
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}]),
|
[?NS_PRIVATE], [{?NS_XMPP, ?NS_XMPP_pfx}]),
|
||||||
El1 = exmpp_xml:remove_whitespaces_deeply(El0),
|
|
||||||
New_R = R#private_storage{
|
New_R = R#private_storage{
|
||||||
usns = {U, S, NS1},
|
usns = {U1, S1, NS1},
|
||||||
xml = El1},
|
xml = El1},
|
||||||
mnesia:write(New_R),
|
mnesia:write(New_R),
|
||||||
Acc.
|
Acc.
|
||||||
|
Loading…
Reference in New Issue
Block a user