]> granicus.if.org Git - ejabberd/commitdiff
Prevent case_clause error when ejabber_odbc:sql_query returns {error, Reason}
authorChristophe Romain <christophe.romain@process-one.net>
Mon, 25 Aug 2008 13:36:34 +0000 (13:36 +0000)
committerChristophe Romain <christophe.romain@process-one.net>
Mon, 25 Aug 2008 13:36:34 +0000 (13:36 +0000)
SVN Revision: 1540

ChangeLog
src/mod_last_odbc.erl
src/mod_offline_odbc.erl

index 376f0a48cf2ea07403bebde365d7db59bd1266fe..80d2478a0ef8e0035c679e9433685ca4888cf66c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
        * src/mod_privacy_odbc.erl: Prevent case_clause error when
        ejabber_odbc:sql_query returns {error, Reason}
        * src/mod_vcard_odbc.erl: Likewise
+       * src/mod_last_odbc.erl: Likewise
+       * src/mod_offline_odbc.erl: Likewise
 
 2008-08-25  Badlop  <badlop@process-one.net>
 
index e0b0f77615bcc7e87f48e4eff31dd15b881f7cf1..9253c09e1717491280a4ac9dcce601150d65a040 100644 (file)
@@ -114,8 +114,6 @@ process_sm_iq(From, To, #iq{type = Type, sub_el = SubEl} = IQ) ->
 get_last(IQ, SubEl, LUser, LServer) ->
     Username = ejabberd_odbc:escape(LUser),
     case catch odbc_queries:get_last(LServer, Username) of
-       {'EXIT', _Reason} ->
-           IQ#iq{type = error, sub_el = [SubEl, ?ERR_INTERNAL_SERVER_ERROR]};
        {selected, ["seconds","state"], []} ->
            IQ#iq{type = error, sub_el = [SubEl, ?ERR_SERVICE_UNAVAILABLE]};
        {selected, ["seconds","state"], [{STimeStamp, Status}]} ->
@@ -132,7 +130,9 @@ get_last(IQ, SubEl, LUser, LServer) ->
                _ ->
                    IQ#iq{type = error,
                          sub_el = [SubEl, ?ERR_INTERNAL_SERVER_ERROR]}
-           end
+           end;
+       _ ->
+           IQ#iq{type = error, sub_el = [SubEl, ?ERR_INTERNAL_SERVER_ERROR]}
     end.
 
 on_presence_update(User, Server, _Resource, Status) ->
@@ -152,8 +152,6 @@ store_last_info(User, Server, TimeStamp, Status) ->
 get_last_info(LUser, LServer) ->
     Username = ejabberd_odbc:escape(LUser),
     case catch odbc_queries:get_last(LServer, Username) of
-       {'EXIT', _Reason} ->
-           not_found;
        {selected, ["seconds","state"], []} ->
            not_found;
        {selected, ["seconds","state"], [{STimeStamp, Status}]} ->
@@ -162,7 +160,9 @@ get_last_info(LUser, LServer) ->
                    {ok, TimeStamp, Status};
                _ ->
                    not_found
-           end
+           end;
+       _ ->
+           not_found
     end.
 
 remove_user(User, Server) ->
index c1b8b41fc37831040bf85df828f2f53f90dfddaf..80452d8afc1b31452335ef0ac69a81b51762ba68 100644 (file)
@@ -116,6 +116,8 @@ loop(Host, MaxOfflineMsgs) ->
                    case catch odbc_queries:add_spool(Host, Query) of
                        {'EXIT', Reason} ->
                            ?ERROR_MSG("~p~n", [Reason]);
+                       {error, Reason} ->
+                           ?ERROR_MSG("~p~n", [Reason]);
                        _ ->
                            ok
                    end