From f8b6b1939865fb17af2628d182c86cf42225347c Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Fri, 23 Jan 2015 13:50:14 -0800 Subject: [PATCH] Show only chat messages in `recall` surrounding context (no joins/quits/etc) --- PBot/MessageHistory_SQLite.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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);