AOL-TOC

 view release on metacpan or  search on metacpan

tocbot/do.pl  view on Meta::CPAN

#
# do.pl
#

sub do_init {
  tocbot_register_command("do", \&do_func);
}

sub do_func {
  my ($nickname, $cmd, @args) = @_;

  if ($cmd eq "send_im") {
    ($nickname, @message) = @args;
    print "tocbot: do: send_im($nickname, @message)\n";
    $toc->send_im($nickname, "@message");
  }

tocbot/fortune.pl  view on Meta::CPAN

#
# fortune.pl
#

sub fortune_init {
  tocbot_register_command("fortune", \&fortune_func);
}

sub fortune_func {
  my ($nickname, $relayto, @message) = @_;
  my @fortune;

  print "tocbot: fortune: $nickname requested a fortune!\n";

  open (ff, "/bin/fortune|");
  @fortune = <ff>;

tocbot/ident.pl  view on Meta::CPAN

#
# ident.pl
#

sub ident_init {
  tocbot_register_command("ident", \&ident_identify);
  tocbot_register_command("unident", \&ident_unidentify);
}

sub ident_identify {
  my ($nickname, @args) = @_;

  print "tocbot: ident: identified user $nickname\n";
  $toc->add_buddy($nickname);
}

sub ident_unidentify {

tocbot/relay.pl  view on Meta::CPAN

#
# relay.pl
#

sub relay_init {
  tocbot_register_command("relay", \&relay_func);
}

sub relay_func {
  my ($nickname, $relayto, @message) = @_;

  print "tocbot: relay: relay message \"@message\" to $relayto\n";

  $toc->send_im($relayto, "Message relayed from $nickname: @message");
}

tocbot/tocbot.pl  view on Meta::CPAN

  my $cmd, $args;

  print "tocbot: $nickname says \"$message\"\n";

  if ($autoresponse eq "T") {
    print "tocbot: $nickname is away, ignoring.\n";
    return;
  }

  ($cmd, $args) = ($message =~ /bot\((\w+)\b(.*)\)/i);
  if ($cmd && do_command($nickname, $cmd, $args)) {
    return;
  }

  if ($message =~ /HELP/i) {
    send_help($nickname);
    return;
  }

  $toc->send_im($nickname, "Hi, I'm a bot. Do you need 'HELP'?");
}

tocbot/tocbot.pl  view on Meta::CPAN

  my ($nickname) = @_;

  $toc->send_im($nickname, "I'm a bot. I have the following modules installed:");
  sleep(1);
  $toc->send_im($nickname, "    @tocbot_modules");
  sleep(1);
  $toc->send_im($nickname, "You can invoke a module by telling me 'bot(module ...)'");
}


sub do_command {
  my ($nickname, $cmd, $args) = @_;
  my @eargs = split(' ', $args);

  tocbot_exec_command($cmd, $nickname, @eargs);

  return 1;
}


sub client_signon {
  $toc->add_buddy("jamersepoo", "jamers20VA");
  $toc->send_im("jamersepoo", "tocbot online");
}

tocbot/tocbot.pl  view on Meta::CPAN

}


sub client_buddy {
  my ($self, $nickname, $online, $evil, $signon_time, $idle_time, $class) = @_;

  print "tocbot: buddy $nickname signed on\n";
}


sub tocbot_register_command {
  my ($cmd, $func, @args) = @_;

  print "Registered command '$cmd'\n";
  $tocbot_commands{$cmd}  = $func;
}

sub tocbot_exec_command {
  my ($cmd, @args) = @_;

  eval { &{$tocbot_commands{$cmd}} (@args) };
}



( run in 0.892 second using v1.01-cache-2.11-cpan-d8267643d1d )