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

Name and groups must be binaries, not strings

This commit is contained in:
Badlop 2011-07-28 16:58:58 +02:00
parent 92887e96bd
commit aa8c9bf0a5

View File

@ -384,7 +384,7 @@ storageroster_to_roster(#rosteritem{user_host_jid = {U, S, JID} = USJ,
fun(#rostergroup{user_host_jid = USJ1, grp = G}, R) fun(#rostergroup{user_host_jid = USJ1, grp = G}, R)
when USJ =:= USJ1 -> when USJ =:= USJ1 ->
%% G is a string when using odbc beckend, and a binary when using mnesia %% G is a string when using odbc beckend, and a binary when using mnesia
GString = convert_to_string(G), GString = convert_to_binary(G),
[GString | R]; [GString | R];
(_, R) -> (_, R) ->
R R
@ -392,14 +392,14 @@ storageroster_to_roster(#rosteritem{user_host_jid = {U, S, JID} = USJ,
#roster{usj = {U, S, JID}, #roster{usj = {U, S, JID},
us = US, us = US,
jid = JID, jid = JID,
name = convert_to_string(Name), name = convert_to_binary(Name),
subscription = Subscription, subscription = Subscription,
ask = Ask, ask = Ask,
askmessage = AskMessage, askmessage = AskMessage,
groups = Groups}. groups = Groups}.
convert_to_string(A) when is_binary(A) -> binary_to_list(A); convert_to_binary(A) when is_list(A) -> list_to_binary(A);
convert_to_string(A) when is_list(A) -> A. convert_to_binary(A) when is_binary(A) -> A.
%% @spec (Item) -> XML %% @spec (Item) -> XML
%% Item = rosteritem() %% Item = rosteritem()