mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 10:59:29 +01:00
Er, use OR instead of AND...
This commit is contained in:
parent
9eca3d5adc
commit
a4d23bc445
@ -801,15 +801,15 @@ sub get_recent_messages {
|
|||||||
|
|
||||||
my $ids;
|
my $ids;
|
||||||
my %seen_id;
|
my %seen_id;
|
||||||
my $and = '';
|
my $or = '';
|
||||||
foreach my $aka (keys %akas) {
|
foreach my $aka (keys %akas) {
|
||||||
next if $akas{$aka}->{type} == $self->{alias_type}->{WEAK};
|
next if $akas{$aka}->{type} == $self->{alias_type}->{WEAK};
|
||||||
next if $akas{$aka}->{nickchange} == 1;
|
next if $akas{$aka}->{nickchange} == 1;
|
||||||
next if exists $seen_id{$akas{$aka}->{id}};
|
next if exists $seen_id{$akas{$aka}->{id}};
|
||||||
$seen_id{$akas{$aka}->{id}} = 1;
|
$seen_id{$akas{$aka}->{id}} = 1;
|
||||||
|
|
||||||
$ids .= "${and}id = ?";
|
$ids .= "${or}id = ?";
|
||||||
$and = ' AND ';
|
$or = ' OR ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= "$ids AND channel = ? $mode_query ORDER BY timestamp ASC LIMIT ? OFFSET (SELECT COUNT(*) FROM Messages WHERE $ids AND channel = ? $mode_query) - ?";
|
$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 $ids;
|
||||||
my %seen_id;
|
my %seen_id;
|
||||||
my $and = '';
|
my $or = '';
|
||||||
foreach my $aka (keys %akas) {
|
foreach my $aka (keys %akas) {
|
||||||
next if $akas{$aka}->{type} == $self->{alias_type}->{WEAK};
|
next if $akas{$aka}->{type} == $self->{alias_type}->{WEAK};
|
||||||
next if $akas{$aka}->{nickchange} == 1;
|
next if $akas{$aka}->{nickchange} == 1;
|
||||||
next if exists $seen_id{$akas{$aka}->{id}};
|
next if exists $seen_id{$akas{$aka}->{id}};
|
||||||
$seen_id{$akas{$aka}->{id}} = 1;
|
$seen_id{$akas{$aka}->{id}} = 1;
|
||||||
|
|
||||||
$ids .= "${and}id = ?";
|
$ids .= "${or}id = ?";
|
||||||
$and = ' AND ';
|
$or = ' OR ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= $ids;
|
$sql .= $ids;
|
||||||
|
Loading…
Reference in New Issue
Block a user