Changeset fe8cad8 for perl


Ignore:
Timestamp:
Jan 11, 2008, 5:11:00 PM (13 years ago)
Author:
Alex Vandiver <alexmv@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
216e621
Parents:
9e02bb7
git-author:
Alex Vandiver <alexmv@mit.edu> (01/11/08 17:08:47)
git-committer:
Alex Vandiver <alexmv@mit.edu> (01/11/08 17:11:00)
Message:
Default connections on a per-channel-name basis
File:
1 edited

Legend:

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

    rb0c8011 rfe8cad8  
    2828# Hash alias -> BarnOwl::Module::IRC::Connection object
    2929our %ircnets;
     30our %channels;
    3031
    3132sub startup {
     
    210211    my $conn = get_connection(\@_);
    211212    my $chan = shift or die("Usage: $cmd channel\n");
     213    $channels{$chan} ||= [];
     214    push @{$channels{$chan}}, $conn;
    212215    $conn->join($chan);
    213216}
     
    217220    my $conn = get_connection(\@_);
    218221    my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
     222    $channels{$chan} = [grep {$_ ne $conn} @{$channels{$chan} || []}];
    219223    $conn->part($chan);
    220224}
     
    251255        return get_connection_by_alias(shift @$args);
    252256    }
     257    my $channel = $args->[-1];
     258    if ($channel =~ /^#/ and $channels{$channel} and @{$channels{$channel}} == 1) {
     259        return $channels{$channel}[0];
     260    }
    253261    my $m = BarnOwl::getcurmsg();
    254262    if($m && $m->type eq 'IRC') {
Note: See TracChangeset for help on using the changeset viewer.