3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-23 04:19:27 +01:00

Er, use OR instead of AND...

This commit is contained in:
Pragmatic Software 2016-12-01 05:05:07 -08:00
parent 9eca3d5adc
commit a4d23bc445

View File

@ -801,15 +801,15 @@ sub get_recent_messages {
my $ids;
my %seen_id;
my $and = '';
my $or = '';
foreach my $aka (keys %akas) {
next if $akas{$aka}->{type} == $self->{alias_type}->{WEAK};
next if $akas{$aka}->{nickchange} == 1;
next if exists $seen_id{$akas{$aka}->{id}};
$seen_id{$akas{$aka}->{id}} = 1;
$ids .= "${and}id = ?";
$and = ' AND ';
$ids .= "${or}id = ?";
$or = ' OR ';
}
$sql .= "$ids AND channel = ? $mode_query ORDER BY timestamp ASC LIMIT ? OFFSET (SELECT COUNT(*) FROM Messages WHERE $ids AND channel = ? $mode_query) - ?";
@ -1040,15 +1040,15 @@ sub get_max_messages {
my $ids;
my %seen_id;
my $and = '';
my $or = '';
foreach my $aka (keys %akas) {
next if $akas{$aka}->{type} == $self->{alias_type}->{WEAK};
next if $akas{$aka}->{nickchange} == 1;
next if exists $seen_id{$akas{$aka}->{id}};
$seen_id{$akas{$aka}->{id}} = 1;
$ids .= "${and}id = ?";
$and = ' AND ';
$ids .= "${or}id = ?";
$or = ' OR ';
}
$sql .= $ids;