if ($what =~ /^(for|add)\s+(.*)$/i) {
&add( split(/\s+/, $2, 2) );
- } elsif ($what =~ /^check(\s+(.*))?$/i) {
- &check( split(/\s+/, $1, 2) );
+ } elsif ($what =~ /^check?$/i) {
+ &check( $1, 1);
} elsif ($what =~ /^(read|next)$/i) {
# TODO: read specific items? nah, will make this too complex.
}
#####
-# Usage: botmail::check($recipient)
+# Usage: botmail::check($recipient, [$always])
sub check {
- my($recipient) = @_;
+ my($recipient, $always) = @_;
$recipient ||= $::who;
# todo: simplify this select (use a diff function)
my $from = join(", ", keys %from);
if ($t == 0) {
- &::msg($recipient, "You have no botmail.");
+ &::msg($recipient, "You have no botmail.") if ($always);
} else {
&::msg($recipient, "You have $t messages awaiting, from: $from");
}