From eae3efb813b4864c532c5728880cac45a3263333 Mon Sep 17 00:00:00 2001 From: martin f. krafft Date: Sat, 4 Feb 2017 02:11:54 +0100 Subject: Add discard subcommand to drop messages Signed-off-by: martin f. krafft --- scripts/postpone.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/postpone.pl b/scripts/postpone.pl index 72e0a90..11011f2 100644 --- a/scripts/postpone.pl +++ b/scripts/postpone.pl @@ -5,7 +5,7 @@ use strict; use vars qw($VERSION %IRSSI); -$VERSION = "20030208"; +$VERSION = "20170204"; %IRSSI = ( authors => "Stefan 'tommie' Tomanek", contact => "stefan\@pico.ruhr.de", @@ -37,6 +37,8 @@ sub show_help() { Display this help /postpone flush Flush postponed messages to +/postpone discard + Discard postponed messages to /postpone list List postponed messages "; @@ -85,11 +87,11 @@ sub cmd_postpone ($$$) { my @arg = split(/ /, $args); if (scalar(@arg) < 1) { #foo - } elsif ($arg[0] eq 'flush' && defined $arg[1]) { + } elsif (($arg[0] eq 'discard' || $arg[0] eq 'flush') && defined $arg[1]) { return unless ($witem && $witem->{type} eq "CHANNEL"); while (scalar(@{$messages{$server->{tag}}{$witem->{name}}{$arg[1]}}) > 0) { my $msg = pop @{$messages{$server->{tag}}{$witem->{name}}{$arg[1]}}; - $server->command('MSG '.$witem->{name}.' '.$msg); + $server->command('MSG '.$witem->{name}.' '.$msg) if $arg[0] eq 'flush'; } } elsif ($arg[0] eq 'list') { my $text; -- cgit v1.2.3