diff --git a/src/mod_privacy_odbc.erl b/src/mod_privacy_odbc.erl index ae572ae64..5ad2fb958 100644 --- a/src/mod_privacy_odbc.erl +++ b/src/mod_privacy_odbc.erl @@ -726,11 +726,11 @@ raw_to_item({SType, SValue, SAction, SOrder, SMatchAll, SMatchIQ, "d" -> deny end, Order = list_to_integer(SOrder), - MatchAll = SMatchAll == "1" orelse SMatchAll == "t", - MatchIQ = SMatchIQ == "1" orelse SMatchIQ == "t" , - MatchMessage = SMatchMessage == "1" orelse SMatchMessage == "t", - MatchPresenceIn = SMatchPresenceIn == "1" orelse SMatchPresenceIn == "t", - MatchPresenceOut = SMatchPresenceOut == "1" orelse SMatchPresenceOut == "t", + MatchAll = ejabberd_odbc:to_bool(SMatchAll), + MatchIQ = ejabberd_odbc:to_bool(SMatchIQ), + MatchMessage = ejabberd_odbc:to_bool(SMatchMessage), + MatchPresenceIn = ejabberd_odbc:to_bool(SMatchPresenceIn), + MatchPresenceOut = ejabberd_odbc:to_bool(SMatchPresenceOut), #listitem{type = Type, value = Value, action = Action, diff --git a/src/odbc/ejabberd_odbc.erl b/src/odbc/ejabberd_odbc.erl index 1b07fd6d9..4a6481525 100644 --- a/src/odbc/ejabberd_odbc.erl +++ b/src/odbc/ejabberd_odbc.erl @@ -39,6 +39,7 @@ sql_bloc/2, escape/1, escape_like/1, + to_bool/1, keep_alive/1]). %% gen_fsm callbacks @@ -161,6 +162,12 @@ escape_like($%) -> "\\%"; escape_like($_) -> "\\_"; escape_like(C) -> odbc_queries:escape(C). +to_bool("t") -> true; +to_bool("true") -> true; +to_bool("1") -> true; +to_bool(true) -> true; +to_bool(1) -> true; +to_bool(_) -> false. %%%---------------------------------------------------------------------- %%% Callback functions from gen_fsm