Changeset b0c8011 for perl/modules/IRC


Ignore:
Timestamp:
Jan 10, 2008, 11:25:27 PM (17 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
9e02bb7
Parents:
65fea01
Message:
doc nits
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/modules/IRC/lib/BarnOwl/Module/IRC.pm

    rb10f340 rb0c8011  
    8484
    8585sub register_commands {
    86     BarnOwl::new_command('irc-connect' => \&cmd_connect);
     86    BarnOwl::new_command('irc-connect' => \&cmd_connect,
     87                       {
     88                           summary      => 'Connect to an IRC server',
     89                           usage        => 'irc-connect [-a ALIAS ] [-s] [-p PASSWORD] [-n NICK] SERVER [port]',
     90                           description  =>
     91
     92                           "Connect to an IRC server. Supported options are\n\n" .
     93                           "-a <alias>          Define an alias for this server\n" .
     94                           "-s                  Use SSL\n" .
     95                           "-p <password>       Specify the password to use\n" .
     96                           "-n <nick>           Use a non-default nick"
     97                       });
    8798    BarnOwl::new_command('irc-disconnect' => \&cmd_disconnect);
    88     BarnOwl::new_command('irc-msg'     => \&cmd_msg);
    89     BarnOwl::new_command('irc-join'    => \&cmd_join);
    90     BarnOwl::new_command('irc-part'    => \&cmd_part);
    91     BarnOwl::new_command('irc-nick'    => \&cmd_nick);
    92     BarnOwl::new_command('irc-names'   => \&cmd_names);
     99    BarnOwl::new_command('irc-msg'        => \&cmd_msg);
     100    BarnOwl::new_command('irc-join'       => \&cmd_join);
     101    BarnOwl::new_command('irc-part'       => \&cmd_part);
     102    BarnOwl::new_command('irc-nick'       => \&cmd_nick);
     103    BarnOwl::new_command('irc-names'      => \&cmd_names);
     104    BarnOwl::new_command('irc-whois'      => \&cmd_whois);
    93105}
    94106
     
    119131            "ssl"        => \$ssl,
    120132            "password=s" => \$password,
    121             "port=i"     => \$port,
    122133            "nick=s"     => \$nick,
    123134        );
    124135        $host = shift @ARGV or die("Usage: $cmd HOST\n");
    125136        if(!$alias) {
    126             $alias = $1 if $host =~ /^(?:irc[.])?(\w+)[.]\w+$/;
    127             $alias ||= $host;
     137            if($host =~ /^(?:irc[.])?(\w+)[.]\w+$/) {
     138                $alias = $1;
     139            } else {
     140                $alias = $host;
     141            }
    128142        }
    129         $port ||= 6667;
     143        $port = shift @ARGV || 6667;
    130144        $ssl ||= 0;
     145    }
     146
     147    if(exists $ircnets{$alias}) {
     148        die("Already connected to a server with alias '$alias'. Either disconnect or specify an alias with -a.\n");
    131149    }
    132150
     
    198216    my $cmd = shift;
    199217    my $conn = get_connection(\@_);
    200     my $chan = get_channel(\@_) || die("Usage: $cmd <channel>");
     218    my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
    201219    $conn->part($chan);
    202220}
     
    205223    my $cmd = shift;
    206224    my $conn = get_connection(\@_);
    207     my $nick = shift or die("Usage: $cmd <new nick>");
     225    my $nick = shift or die("Usage: $cmd <new nick>\n");
    208226    $conn->nick($nick);
    209227}
     
    212230    my $cmd = shift;
    213231    my $conn = get_connection(\@_);
    214     my $chan = get_channel(\@_) || die("Usage: $cmd <channel>");
     232    my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
    215233    $conn->names($chan);
     234}
     235
     236sub cmd_whois {
     237    my $cmd = shift;
     238    my $conn = get_connection(\@_);
     239    my $who = shift || die("Usage: $cmd <user>\n");
     240    $conn->whois($who);
    216241}
    217242
Note: See TracChangeset for help on using the changeset viewer.