From 0f4eb76a4e3e091b8f131b301c9a5972dacfe9a7 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 24 Jul 2019 09:17:16 -0700 Subject: [PATCH] MessageHistory: correct sort order for `recall` -A option --- PBot/MessageHistory_SQLite.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PBot/MessageHistory_SQLite.pm b/PBot/MessageHistory_SQLite.pm index 6ce8d720..cc4e974d 100644 --- a/PBot/MessageHistory_SQLite.pm +++ b/PBot/MessageHistory_SQLite.pm @@ -948,13 +948,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 = 0 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 ASC 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 = 0 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 ASC LIMIT ?'); $sth->bind_param(1, $message->{channel}); $sth->bind_param(2, $message->{timestamp}); $sth->bind_param(3, $after);