3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-20 02:49:49 +01:00

MessageHistory: recall can use -a and -b together again

This commit is contained in:
Pragmatic Software 2021-09-08 14:05:35 -07:00
parent c3e16410c2
commit a0265b4a6f
3 changed files with 11 additions and 10 deletions

View File

@ -298,9 +298,13 @@ sub cmd_recall_message {
$recall_count = 0;
}
if ($recall_before + $recall_after > 100) { return "You may only select up to 100 lines of surrounding context."; }
if ($recall_before + $recall_after > 100) {
return "You may only select up to 100 lines of surrounding context.";
}
if ($recall_count > 1 and ($recall_before > 0 or $recall_after > 0)) { return "The `count` and `before/after` options cannot be used together."; }
if ($recall_count > 1 && ($recall_before > 0 || $recall_after > 0)) {
return "The `count` and `before/after` options cannot be used together.";
}
# swap nick and channel if recall nick looks like channel and channel wasn't specified
if (not $channel_arg and $recall_nick =~ m/^#/) {

View File

@ -1021,8 +1021,7 @@ sub get_message_context {
$search =~ s/\?/_/g;
$messages_count = eval {
$sql .= 'AND msg LIKE ? ESCAPE "\" AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?';
my $sth = $self->{dbh}->prepare($sql);
my $sth = $self->{dbh}->prepare($sql . ' AND msg LIKE ? ESCAPE "\" AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?');
my $param = 1;
$sth->bind_param($param++, $message->{channel});
map { $sth->bind_param($param++, $_) } keys %seen_id;
@ -1038,8 +1037,7 @@ sub get_message_context {
if (defined $before and $before > 0) {
$messages_before = eval {
$sql .= ' AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?';
my $sth = $self->{dbh}->prepare($sql);
my $sth = $self->{dbh}->prepare($sql . ' AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?');
my $param = 1;
$sth->bind_param($param++, $message->{channel});
map { $sth->bind_param($param++, $_) } keys %seen_id;
@ -1054,8 +1052,7 @@ sub get_message_context {
if (defined $after and $after > 0) {
$messages_after = eval {
$sql .= ' AND timestamp > ? AND mode = 0 ORDER BY timestamp ASC LIMIT ?';
my $sth = $self->{dbh}->prepare($sql);
my $sth = $self->{dbh}->prepare($sql . ' AND timestamp > ? AND mode = 0 ORDER BY timestamp ASC LIMIT ?');
my $param = 1;
$sth->bind_param($param++, $message->{channel});
map { $sth->bind_param($param++, $_) } keys %seen_id;

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4381,
BUILD_DATE => "2021-09-07",
BUILD_REVISION => 4382,
BUILD_DATE => "2021-09-08",
};
sub initialize {}