IgnoreList: correct formatting of pasted `ignore list` output

This commit is contained in:
Pragmatic Software 2020-05-01 09:45:38 -07:00
parent b9fb3dcb7d
commit b54360485d
1 changed files with 4 additions and 3 deletions

View File

@ -134,13 +134,13 @@ sub ignore_cmd {
return "Usage: ignore <hostmask> [channel [timeout]] | ignore list" if not defined $target; return "Usage: ignore <hostmask> [channel [timeout]] | ignore list" if not defined $target;
if ($target =~ /^list$/i) { if ($target =~ /^list$/i) {
my $text = "Ignored:"; my $text = "Ignored:\n\n";
my $now = time; my $now = time;
my $ignored = 0; my $ignored = 0;
foreach my $channel (sort $self->{ignorelist}->get_keys) { foreach my $channel (sort $self->{ignorelist}->get_keys) {
$text .= $channel eq '.*' ? " global:\n" : " $channel:\n"; $text .= $channel eq '.*' ? "global:\n" : "$channel:\n";
my @list = (); my @list;
foreach my $hostmask (sort $self->{ignorelist}->get_keys($channel)) { foreach my $hostmask (sort $self->{ignorelist}->get_keys($channel)) {
my $timeout = $self->{ignorelist}->get_data($channel, $hostmask, 'timeout'); my $timeout = $self->{ignorelist}->get_data($channel, $hostmask, 'timeout');
if ($timeout == -1) { if ($timeout == -1) {
@ -151,6 +151,7 @@ sub ignore_cmd {
$ignored++; $ignored++;
} }
$text .= join ";\n", @list; $text .= join ";\n", @list;
$text .= "\n";
} }
return "Ignore list is empty." if not $ignored; return "Ignore list is empty." if not $ignored;
return "/msg $nick $text"; return "/msg $nick $text";