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

correct handling of SQL boolean types (EJAB-1275)

This commit is contained in:
Evgeniy Khramtsov 2010-07-14 21:23:21 +10:00
parent d7930d7f82
commit 5030f35558
2 changed files with 12 additions and 5 deletions

View File

@ -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,

View File

@ -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