Ignore:
Timestamp:
Oct 3, 2009, 5:48:21 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
7cfb1df
Parents:
0e8a0fc
Message:
IRC: Fix '-a' with commands that take a channel.

Previously, the use of -a prevented the code from even trying to look
for a channel in the command line, meaning that commands that expected
a channel name would fail.
File:
1 edited

Legend:

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

    r744769e recee82f  
    545545            $conn = get_connection_by_alias($alias);
    546546        }
    547         if(!$conn && $use_channel) {
     547        if($use_channel) {
    548548            $channel = $ARGV[0];
    549549            if(defined($channel) && $channel =~ /^#/) {
    550550                if($channels{$channel} && @{$channels{$channel}} == 1) {
    551551                    shift @ARGV;
    552                     $conn = $channels{$channel}[0];
    553                 } 
     552                    $conn = $channels{$channel}[0] unless $conn;
     553                }
     554            } elsif ($m && $m->type eq 'IRC' && !$m->is_private) {
     555                $channel = $m->channel;
    554556            } else {
    555                 if($m && $m->type eq 'IRC' && !$m->is_private) {
    556                     $channel = $m->channel;
    557                 } else {
    558                     undef $channel;
    559                 }
     557                undef $channel;
    560558            }
    561559        }
     560
    562561        if(!$channel && $use_channel == REQUIRE_CHANNEL) {
    563562            die("Usage: $cmd <channel>\n");
Note: See TracChangeset for help on using the changeset viewer.