3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02: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; $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 # swap nick and channel if recall nick looks like channel and channel wasn't specified
if (not $channel_arg and $recall_nick =~ m/^#/) { if (not $channel_arg and $recall_nick =~ m/^#/) {

View File

@ -1021,8 +1021,7 @@ sub get_message_context {
$search =~ s/\?/_/g; $search =~ s/\?/_/g;
$messages_count = eval { $messages_count = eval {
$sql .= 'AND msg LIKE ? ESCAPE "\" AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?'; my $sth = $self->{dbh}->prepare($sql . ' AND msg LIKE ? ESCAPE "\" AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?');
my $sth = $self->{dbh}->prepare($sql);
my $param = 1; my $param = 1;
$sth->bind_param($param++, $message->{channel}); $sth->bind_param($param++, $message->{channel});
map { $sth->bind_param($param++, $_) } keys %seen_id; map { $sth->bind_param($param++, $_) } keys %seen_id;
@ -1038,8 +1037,7 @@ sub get_message_context {
if (defined $before and $before > 0) { if (defined $before and $before > 0) {
$messages_before = eval { $messages_before = eval {
$sql .= ' AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?'; my $sth = $self->{dbh}->prepare($sql . ' AND timestamp < ? AND mode = 0 ORDER BY timestamp DESC LIMIT ?');
my $sth = $self->{dbh}->prepare($sql);
my $param = 1; my $param = 1;
$sth->bind_param($param++, $message->{channel}); $sth->bind_param($param++, $message->{channel});
map { $sth->bind_param($param++, $_) } keys %seen_id; map { $sth->bind_param($param++, $_) } keys %seen_id;
@ -1054,8 +1052,7 @@ sub get_message_context {
if (defined $after and $after > 0) { if (defined $after and $after > 0) {
$messages_after = eval { $messages_after = eval {
$sql .= ' AND timestamp > ? AND mode = 0 ORDER BY timestamp ASC LIMIT ?'; my $sth = $self->{dbh}->prepare($sql . ' AND timestamp > ? AND mode = 0 ORDER BY timestamp ASC LIMIT ?');
my $sth = $self->{dbh}->prepare($sql);
my $param = 1; my $param = 1;
$sth->bind_param($param++, $message->{channel}); $sth->bind_param($param++, $message->{channel});
map { $sth->bind_param($param++, $_) } keys %seen_id; 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 # These are set by the /misc/update_version script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 4381, BUILD_REVISION => 4382,
BUILD_DATE => "2021-09-07", BUILD_DATE => "2021-09-08",
}; };
sub initialize {} sub initialize {}