Changeset e625b5e for perl/modules


Ignore:
Timestamp:
Feb 21, 2009, 11:16:58 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
f17bb2c0
Parents:
4df2568
Message:
IRC: Implement irc-mode.

We could probably be smarter about this; Right now I believe 'irc-mode
#channel +m' works, but 'irc-mode +m #channel' doesn't. But it's a start.
File:
1 edited

Legend:

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

    r33db995 re625b5e  
    111111    BarnOwl::new_command('irc-disconnect' => mk_irc_command(\&cmd_disconnect));
    112112    BarnOwl::new_command('irc-msg'        => mk_irc_command(\&cmd_msg, OPTIONAL_CHANNEL));
     113    BarnOwl::new_command('irc-mode'       => mk_irc_command(\&cmd_mode, OPTIONAL_CHANNEL));
    113114    BarnOwl::new_command('irc-join'       => mk_irc_command(\&cmd_join));
    114115    BarnOwl::new_command('irc-part'       => mk_irc_command(\&cmd_part, REQUIRE_CHANNEL));
     
    238239}
    239240
     241sub cmd_mode {
     242    my $cmd = shift;
     243    my $conn = shift;
     244    my $target = shift;
     245    $target ||= shift;
     246    $conn->conn->mode($target, @_);
     247}
     248
    240249sub cmd_join {
    241250    my $cmd = shift;
     
    343352        }
    344353        if(!$conn && $use_channel) {
    345             $channel = $ARGV[-1];
     354            $channel = $ARGV[0];
    346355            if(defined($channel) && $channel =~ /^#/) {
    347356                if($channels{$channel} && @{$channels{$channel}} == 1) {
    348                     pop @ARGV;
     357                    shift @ARGV;
    349358                    $conn = $channels{$channel}[0];
    350359                } 
Note: See TracChangeset for help on using the changeset viewer.