mirror of https://github.com/pragma-/pbot.git
Show only chat messages in `recall` surrounding context (no joins/quits/etc)
This commit is contained in:
parent
340cf07558
commit
f8b6b19398
|
@ -450,13 +450,13 @@ sub get_message_context {
|
||||||
$messages_before = eval {
|
$messages_before = 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 != 1 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 DESC 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, $before);
|
$sth->bind_param(4, $before);
|
||||||
} else {
|
} else {
|
||||||
$sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE channel = ? AND timestamp < ? AND mode != 1 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 DESC 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, $before);
|
$sth->bind_param(3, $before);
|
||||||
|
@ -471,13 +471,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 != 1 LIMIT ?');
|
$sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE id = ? AND channel = ? AND timestamp > ? AND mode = 0 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 != 1 LIMIT ?');
|
$sth = $self->{dbh}->prepare('SELECT id, msg, mode, timestamp, channel FROM Messages WHERE channel = ? AND timestamp > ? AND mode = 0 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);
|
||||||
|
|
Loading…
Reference in New Issue