diff --git a/PBot/MessageHistory_SQLite.pm b/PBot/MessageHistory_SQLite.pm index d0f1c387..5c9c222e 100644 --- a/PBot/MessageHistory_SQLite.pm +++ b/PBot/MessageHistory_SQLite.pm @@ -450,13 +450,13 @@ sub get_message_context { $messages_before = eval { my $sth; if (defined $context_id) { - $sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE id = ? AND channel = ? AND timestamp < ? AND mode != 1 ORDER BY timestamp DESC LIMIT ?'); + $sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE id = ? AND channel = ? AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?'); $sth->bind_param(1, $context_id); $sth->bind_param(2, $message->{channel}); $sth->bind_param(3, $message->{timestamp}); $sth->bind_param(4, $before); } else { - $sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE channel = ? AND timestamp < ? AND mode != 1 ORDER BY timestamp DESC LIMIT ?'); + $sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE channel = ? AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?'); $sth->bind_param(1, $message->{channel}); $sth->bind_param(2, $message->{timestamp}); $sth->bind_param(3, $before); @@ -471,13 +471,13 @@ sub get_message_context { $messages_after = eval { my $sth; if (defined $context_id) { - $sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE id = ? AND channel = ? AND timestamp > ? AND mode != 1 LIMIT ?'); + $sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE id = ? AND channel = ? AND timestamp > ? AND mode = 0 LIMIT ?'); $sth->bind_param(1, $context_id); $sth->bind_param(2, $message->{channel}); $sth->bind_param(3, $message->{timestamp}); $sth->bind_param(4, $after); } else { - $sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE channel = ? AND timestamp > ? AND mode != 1 LIMIT ?'); + $sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE channel = ? AND timestamp > ? AND mode = 0 LIMIT ?'); $sth->bind_param(1, $message->{channel}); $sth->bind_param(2, $message->{timestamp}); $sth->bind_param(3, $after);