]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Add discard subcommand to drop messages
authormartin f. krafft <redacted>
Sat, 4 Feb 2017 01:11:54 +0000 (02:11 +0100)
committermartin f. krafft <redacted>
Sat, 4 Feb 2017 01:14:23 +0000 (02:14 +0100)
Signed-off-by: martin f. krafft <redacted>
scripts/postpone.pl

index 72e0a900403e4c5a3312025e00f85b0926b32422..11011f2c7ee7bb6a996691c47027a74943982649 100644 (file)
@@ -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 <nick>
     Flush postponed messages to <nick>
+/postpone discard <nick>
+    Discard postponed messages to <nick>
 /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;
git clone https://git.99rst.org/PROJECT