3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-29 15:29:32 +01:00

MessageHistory: correct sort order for recall -A option

This commit is contained in:
Pragmatic Software 2019-07-24 09:17:16 -07:00
parent 03bed5b64a
commit 0f4eb76a4e

View File

@ -948,13 +948,13 @@ sub get_message_context {
$messages_after = eval { $messages_after = eval {
my $sth; my $sth;
if (defined $context_id) { 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(1, $context_id);
$sth->bind_param(2, $message->{channel}); $sth->bind_param(2, $message->{channel});
$sth->bind_param(3, $message->{timestamp}); $sth->bind_param(3, $message->{timestamp});
$sth->bind_param(4, $after); $sth->bind_param(4, $after);
} else { } 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(1, $message->{channel});
$sth->bind_param(2, $message->{timestamp}); $sth->bind_param(2, $message->{timestamp});
$sth->bind_param(3, $after); $sth->bind_param(3, $after);