]> granicus.if.org Git - ejabberd/commitdiff
Name and groups must be binaries, not strings
authorBadlop <badlop@process-one.net>
Thu, 28 Jul 2011 14:58:58 +0000 (16:58 +0200)
committerBadlop <badlop@process-one.net>
Thu, 28 Jul 2011 14:58:58 +0000 (16:58 +0200)
src/mod_roster.erl

index 7dc9e54fdcde57965f4d1fd872b0b884771953b3..68d1c413f6a1192abb75c6125490549895145798 100644 (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)
             when USJ =:= USJ1 ->
                  %% 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];
             (_, R) ->
                  R
@@ -392,14 +392,14 @@ storageroster_to_roster(#rosteritem{user_host_jid = {U, S, JID} = USJ,
     #roster{usj = {U, S, JID},
            us = US,
            jid = JID,
-           name = convert_to_string(Name),
+           name = convert_to_binary(Name),
            subscription = Subscription,
            ask = Ask,
            askmessage = AskMessage,
            groups = Groups}.
 
-convert_to_string(A) when is_binary(A) -> binary_to_list(A);
-convert_to_string(A) when is_list(A) -> A.
+convert_to_binary(A) when is_list(A) -> list_to_binary(A);
+convert_to_binary(A) when is_binary(A) -> A.
 
 %% @spec (Item) -> XML
 %%     Item = rosteritem()