From 7088ba88a95c94e18af59d9dde544af9c118ced4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Mon, 1 Dec 2008 12:16:41 +0000 Subject: [PATCH] o In store_last_info/4, fix a bug where the status was not converted to list before calling ejabberd_odbc:escape/1. o In get_last_info/2, fix a bug where the status was returned as a list instead of a binary. SVN Revision: 1690 --- ChangeLog | 8 ++++++++ src/mod_last_odbc.erl | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f46777ed2..c3cabe035 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-10-31 Jean-Sébastien Pédron + + * src/mod_last_odbc.erl (store_last_info/4): Fix a bug where the + status was not converted to list before calling + ejabberd_odbc:escape/1. + (get_last_info/2): Fix a bug where the status was returned as a list + instead of a binary. + 2008-10-20 Jean-Sébastien Pédron * src/mod_irc/mod_irc.erl, src/mod_irc/mod_irc_connection.erl: Convert diff --git a/src/mod_last_odbc.erl b/src/mod_last_odbc.erl index 077a6ee52..64569fd69 100644 --- a/src/mod_last_odbc.erl +++ b/src/mod_last_odbc.erl @@ -135,7 +135,7 @@ store_last_info(User, Server, TimeStamp, Status) -> LServer = exmpp_stringprep:nameprep(Server), Username = ejabberd_odbc:escape(LUser), Seconds = ejabberd_odbc:escape(integer_to_list(TimeStamp)), - State = ejabberd_odbc:escape(Status), + State = ejabberd_odbc:escape(binary_to_list(Status)), odbc_queries:set_last_t(LServer, Username, Seconds, State) catch _ -> @@ -151,7 +151,7 @@ get_last_info(LUser, LServer) -> {selected, ["seconds","state"], [{STimeStamp, Status}]} -> case catch list_to_integer(STimeStamp) of TimeStamp when is_integer(TimeStamp) -> - {ok, TimeStamp, Status}; + {ok, TimeStamp, list_to_binary(Status)}; _ -> not_found end;