diff --git a/PBot/AntiFlood.pm b/PBot/AntiFlood.pm index 2820cd78..b92def70 100644 --- a/PBot/AntiFlood.pm +++ b/PBot/AntiFlood.pm @@ -130,7 +130,7 @@ sub whitelist { my ($self, $from, $nick, $user, $host, $arguments) = @_; $arguments = lc $arguments; - my ($command, $args) = split / /, $arguments, 2; + my ($command, $args) = split /\s+/, $arguments, 2; return "Usage: whitelist , where commands are: list/show, add, remove, set, unset" if not defined $command; @@ -154,7 +154,7 @@ sub whitelist { return $text; } when ("set") { - my ($channel, $mask, $flag, $value) = split / /, $args, 4; + my ($channel, $mask, $flag, $value) = split /\s+/, $args, 4; return "Usage: whitelist set [flag] [value]" if not defined $channel or not defined $mask; if (not exists $self->{whitelist}->hash->{$channel}) { @@ -195,7 +195,7 @@ sub whitelist { return "Flag set."; } when ("unset") { - my ($channel, $mask, $flag) = split / /, $args, 3; + my ($channel, $mask, $flag) = split /\s+/, $args, 3; return "Usage: whitelist unset " if not defined $channel or not defined $mask or not defined $flag; if (not exists $self->{whitelist}->hash->{$channel}) { @@ -215,7 +215,7 @@ sub whitelist { return "Flag unset."; } when ("add") { - my ($channel, $mask, $mode) = split / /, $args, 3; + my ($channel, $mask, $mode) = split /\s+/, $args, 3; return "Usage: whitelist add [mode (user or ban, default: user)]" if not defined $channel or not defined $mask; $mode = 'user' if not defined $mode; @@ -232,7 +232,7 @@ sub whitelist { return "/say $mask whitelisted in channel $channel"; } when ("remove") { - my ($channel, $mask) = split / /, $args, 2; + my ($channel, $mask) = split /\s+/, $args, 2; return "Usage: whitelist remove " if not defined $channel or not defined $mask; if(not defined $self->{whitelist}->hash->{$channel}) { diff --git a/PBot/BlackList.pm b/PBot/BlackList.pm index 06c27517..2732e3b3 100644 --- a/PBot/BlackList.pm +++ b/PBot/BlackList.pm @@ -173,7 +173,7 @@ sub blacklist { my ($self, $from, $nick, $user, $host, $arguments) = @_; $arguments = lc $arguments; - my ($command, $args) = split / /, $arguments, 2; + my ($command, $args) = split /\s+/, $arguments, 2; return "Usage: blacklist , where commands are: list/show, add, remove" if not defined $command; @@ -196,7 +196,7 @@ sub blacklist { return $text; } when("add") { - my ($mask, $channel) = split / /, $args, 2; + my ($mask, $channel) = split /\s+/, $args, 2; return "Usage: blacklist add [channel]" if not defined $mask; $channel = '.*' if not defined $channel; @@ -206,7 +206,7 @@ sub blacklist { return "/say $mask blacklisted in channel $channel"; } when("remove") { - my ($mask, $channel) = split / /, $args, 2; + my ($mask, $channel) = split /\s+/, $args, 2; return "Usage: blacklist remove [channel]" if not defined $mask; $channel = '.*' if not defined $channel; diff --git a/PBot/BotAdminCommands.pm b/PBot/BotAdminCommands.pm index 77e12ca4..0d00b54e 100644 --- a/PBot/BotAdminCommands.pm +++ b/PBot/BotAdminCommands.pm @@ -86,7 +86,7 @@ sub adminadd { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($name, $channel, $hostmask, $level, $password) = split / /, $arguments, 5; + my ($name, $channel, $hostmask, $level, $password) = split /\s+/, $arguments, 5; if(not defined $name or not defined $channel or not defined $hostmask or not defined $level or not defined $password) { @@ -103,7 +103,7 @@ sub adminrem { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($channel, $hostmask) = split / /, $arguments, 2; + my ($channel, $hostmask) = split /\s+/, $arguments, 2; if(not defined $channel or not defined $hostmask) { return "/msg $nick Usage: adminrem "; @@ -135,7 +135,7 @@ sub adminrem { sub adminset { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($channel, $hostmask, $key, $value) = split / /, $arguments, 4 if defined $arguments; + my ($channel, $hostmask, $key, $value) = split /\s+/, $arguments, 4 if defined $arguments; if(not defined $channel or not defined $hostmask) { return "Usage: adminset [key] [value]"; @@ -163,7 +163,7 @@ sub adminset { sub adminunset { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($channel, $hostmask, $key) = split / /, $arguments, 3 if defined $arguments; + my ($channel, $hostmask, $key) = split /\s+/, $arguments, 3 if defined $arguments; if(not defined $channel or not defined $hostmask) { return "Usage: adminunset "; diff --git a/PBot/ChanOpCommands.pm b/PBot/ChanOpCommands.pm index b8c67141..476e3119 100644 --- a/PBot/ChanOpCommands.pm +++ b/PBot/ChanOpCommands.pm @@ -102,7 +102,7 @@ sub unban_user { return ""; } - my ($target, $channel) = split / /, $arguments; + my ($target, $channel) = split /\s+/, $arguments; if(not defined $target) { return "/msg $nick Usage: unban [channel]"; @@ -177,7 +177,7 @@ sub unmute_user { return ""; } - my ($target, $channel) = split / /, $arguments; + my ($target, $channel) = split /\s+/, $arguments; if(not defined $target) { return "/msg $nick Usage: unmute [channel]"; diff --git a/PBot/Channels.pm b/PBot/Channels.pm index 058a2425..5d4dc3b7 100644 --- a/PBot/Channels.pm +++ b/PBot/Channels.pm @@ -44,7 +44,7 @@ sub initialize { sub set { my ($self, $from, $nick, $user, $host, $arguments) = @_; - my ($channel, $key, $value) = split / /, $arguments, 3; + my ($channel, $key, $value) = split /\s+/, $arguments, 3; if(not defined $channel) { return "Usage: chanset [key [value]]"; @@ -55,7 +55,7 @@ sub set { sub unset { my ($self, $from, $nick, $user, $host, $arguments) = @_; - my ($channel, $key) = split / /, $arguments; + my ($channel, $key) = split /\s+/, $arguments; if(not defined $channel or not defined $key) { return "Usage: chanunset "; diff --git a/PBot/FactoidCommands.pm b/PBot/FactoidCommands.pm index 40340d92..82138fa5 100644 --- a/PBot/FactoidCommands.pm +++ b/PBot/FactoidCommands.pm @@ -96,7 +96,7 @@ sub initialize { sub call_factoid { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($chan, $keyword, $args) = split / /, $arguments, 3; + my ($chan, $keyword, $args) = split /\s+/, $arguments, 3; if(not defined $chan or not defined $keyword) { return "Usage: fact [arguments]"; @@ -157,7 +157,7 @@ sub log_factoid { sub find_factoid_with_optional_channel { my ($self, $from, $arguments, $command, $usage, $explicit) = @_; - my ($from_chan, $from_trigger, $remaining_args) = split / /, $arguments, 3; + my ($from_chan, $from_trigger, $remaining_args) = split /\s+/, $arguments, 3; if (not defined $from_chan or (not defined $from_chan and not defined $from_trigger)) { return "Usage: $command [channel] " if not $usage; @@ -333,7 +333,7 @@ sub factset { my ($channel, $trigger, $arguments) = $self->find_factoid_with_optional_channel($from, $args, 'factset', 'Usage: factset [channel] [key [value]]', 1); return $channel if not defined $trigger; # if $trigger is not defined, $channel is an error message - my ($key, $value) = split / /, $arguments, 2; + my ($key, $value) = split /\s+/, $arguments, 2; $channel = '.*' if $channel !~ /^#/; @@ -541,7 +541,7 @@ sub list { sub factmove { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($src_channel, $source, $target_channel, $target) = split / /, $arguments, 4 if $arguments; + my ($src_channel, $source, $target_channel, $target) = split /\s+/, $arguments, 4 if $arguments; my $usage = "Usage: factmove [target factoid]"; @@ -612,7 +612,7 @@ sub factmove { sub factalias { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($chan, $alias, $command) = split / /, $arguments, 3 if defined $arguments; + my ($chan, $alias, $command) = split /\s+/, $arguments, 3 if defined $arguments; if(not defined $command) { return "Usage: factalias "; @@ -717,7 +717,7 @@ sub factrem { my ($from, $nick, $user, $host, $arguments) = @_; my $factoids = $self->{pbot}->{factoids}->{factoids}->hash; - my ($from_chan, $from_trig) = split / /, $arguments; + my ($from_chan, $from_trig) = split /\s+/, $arguments; if (not defined $from_trig) { $from_trig = $from_chan; @@ -790,7 +790,7 @@ sub factshow { my ($from, $nick, $user, $host, $arguments) = @_; my $factoids = $self->{pbot}->{factoids}->{factoids}->hash; - my ($chan, $trig) = split / /, $arguments; + my ($chan, $trig) = split /\s+/, $arguments; if (not defined $trig) { $trig = $chan; @@ -852,7 +852,7 @@ sub factlog { my @entries; while (my $line = <$fh>) { - my ($timestamp, $hostmask, $msg) = split / /, $line, 3; + my ($timestamp, $hostmask, $msg) = split /\s+/, $line, 3; if (not $show_hostmask) { $hostmask =~ s/!.*$//; @@ -877,7 +877,7 @@ sub factinfo { my ($from, $nick, $user, $host, $arguments) = @_; my $factoids = $self->{pbot}->{factoids}->{factoids}->hash; - my ($chan, $trig) = split / /, $arguments; + my ($chan, $trig) = split /\s+/, $arguments; if (not defined $trig) { $trig = $chan; @@ -920,7 +920,7 @@ sub top20 { my $text = ""; my $i = 0; - my ($channel, $args) = split / /, $arguments, 2 if defined $arguments; + my ($channel, $args) = split /\s+/, $arguments, 2 if defined $arguments; if(not defined $channel) { return "Usage: top20 [nick or 'recent']"; diff --git a/PBot/FactoidModuleLauncher.pm b/PBot/FactoidModuleLauncher.pm index 64969270..63dcafcc 100644 --- a/PBot/FactoidModuleLauncher.pm +++ b/PBot/FactoidModuleLauncher.pm @@ -195,7 +195,7 @@ sub execute_module { sub module_pipe_reader { my ($self, $buf) = @_; - my ($channel, $text) = split / /, $buf, 2; + my ($channel, $text) = split /\s+/, $buf, 2; return if not defined $text or not length $text; $text = $self->{pbot}->{interpreter}->truncate_result($channel, $self->{pbot}->{registry}->get_value('irc', 'botnick'), 'undef', $text, $text, 0); $self->{pbot}->{antiflood}->check_flood($channel, $self->{pbot}->{registry}->get_value('irc', 'botnick'), $self->{pbot}->{registry}->get_value('irc', 'username'), 'localhost', $text, 0, 0, 0); diff --git a/PBot/Factoids.pm b/PBot/Factoids.pm index 3dda2f32..c925aa6d 100644 --- a/PBot/Factoids.pm +++ b/PBot/Factoids.pm @@ -304,7 +304,7 @@ sub find_factoid { } else { $command = $1; } - ($keyword, $arguments) = split / /, $command, 2; + ($keyword, $arguments) = split /\s+/, $command, 2; goto NEXT_DEPTH; } @@ -332,7 +332,7 @@ sub find_factoid { if($find_alias) { my $command = $self->{factoids}->hash->{$channel}->{$trigger}->{action}; - ($keyword, $arguments) = split / /, $command, 2; + ($keyword, $arguments) = split /\s+/, $command, 2; $string = $keyword . (length $arguments ? " $arguments" : ""); goto NEXT_DEPTH; } @@ -415,7 +415,7 @@ sub expand_factoid_vars { if ($self->{factoids}->hash->{$var_chan}->{$var}->{type} eq 'text') { my $change = $self->{factoids}->hash->{$var_chan}->{$var}->{action}; - my @list = split(/\s|(".*?")/, $change); + my @list = split(/\s+|(".*?")/, $change); my @mylist; for (my $i = 0; $i <= $#list; $i++) { push @mylist, $list[$i] if defined $list[$i]; diff --git a/PBot/IRCHandlers.pm b/PBot/IRCHandlers.pm index 84b31893..59641c3b 100644 --- a/PBot/IRCHandlers.pm +++ b/PBot/IRCHandlers.pm @@ -417,7 +417,7 @@ sub on_cap { if ($event->{event}->{args}->[0] eq 'ACK') { $self->{pbot}->{logger}->log("Client capabilities granted: " . $event->{event}->{args}->[1] . "\n"); - my @caps = split / /, $event->{event}->{args}->[1]; + my @caps = split /\s+/, $event->{event}->{args}->[1]; foreach my $cap (@caps) { $self->{pbot}->{capabilities}->{$cap} = 1; } diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index 53423932..71964f41 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -277,7 +277,7 @@ sub handle_result { my $use_output_queue = 0; if (defined $command) { - my ($cmd, $args) = split / /, $command, 2; + my ($cmd, $args) = split /\s+/, $command, 2; if (not $self->{pbot}->{commands}->exists($cmd)) { my ($chan, $trigger) = $self->{pbot}->{factoids}->find_factoid($from, $cmd, $args, 1, 0, 1); if(defined $trigger) { @@ -376,7 +376,7 @@ sub output_result { } } elsif($line =~ s/^\/$self->{pbot}->{secretstuff}kick\s+//) { $pbot->{antiflood}->check_flood($from, $botnick, $pbot->{registry}->get_value('irc', 'username'), 'localhost', '/kick ' . $line, 0, 0, 0) if $checkflood; - my ($victim, $reason) = split / /, $line, 2; + my ($victim, $reason) = split /\s+/, $line, 2; if (not defined $reason) { if (open my $fh, '<', $self->{pbot}->{registry}->get_value('general', 'module_dir') . '/insults.txt') { diff --git a/PBot/RegistryCommands.pm b/PBot/RegistryCommands.pm index edbe8c85..d64bc1f0 100644 --- a/PBot/RegistryCommands.pm +++ b/PBot/RegistryCommands.pm @@ -43,7 +43,7 @@ sub initialize { sub regset { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($section, $item, $key, $value) = split / /, $arguments, 4 if defined $arguments; + my ($section, $item, $key, $value) = split /\s+/, $arguments, 4 if defined $arguments; if(not defined $section or not defined $item) { return "Usage: regset
[key [value]]"; @@ -58,7 +58,7 @@ sub regset { sub regunset { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($section, $item, $key) = split / /, $arguments, 3 if defined $arguments; + my ($section, $item, $key) = split /\s+/, $arguments, 3 if defined $arguments; if(not defined $section or not defined $item or not defined $key) { return "Usage: regunset
" @@ -70,7 +70,7 @@ sub regunset { sub regadd { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($section, $item, $value) = split / /, $arguments, 3 if defined $arguments; + my ($section, $item, $value) = split /\s+/, $arguments, 3 if defined $arguments; if(not defined $section or not defined $item or not defined $value) { return "Usage: regadd
"; @@ -85,7 +85,7 @@ sub regadd { sub regrem { my $self = shift; my ($from, $nick, $user, $host, $arguments) = @_; - my ($section, $item) = split / /, $arguments if defined $arguments; + my ($section, $item) = split /\s+/, $arguments if defined $arguments; if(not defined $section or not defined $item) { return "Usage: regrem
"; @@ -109,7 +109,7 @@ sub regshow { my ($from, $nick, $user, $host, $arguments) = @_; my $registry = $self->{pbot}->{registry}->{registry}->hash; - my ($section, $item) = split / /, $arguments if defined $arguments; + my ($section, $item) = split /\s+/, $arguments if defined $arguments; if(not defined $section or not defined $item) { return "Usage: regshow
";