Ignore:
Timestamp:
Apr 3, 2011, 3:06:01 PM (11 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
5d4262c
Parents:
59425a3
git-author:
Nelson Elhage <nelhage@mit.edu> (02/26/11 20:43:58)
git-committer:
Nelson Elhage <nelhage@mit.edu> (04/03/11 15:06:01)
Message:
IRC: Remove the %reconnect hash.

Keep everything in the %ircnets hash, always. This should hopefully help fix
some really confusing bugs where we get multiple connections that think they
have the same alias.
File:
1 edited

Legend:

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

    r851a0e0 r3713b86  
    3131our %ircnets;
    3232our %channels;
    33 our %reconnect;
    3433
    3534sub startup {
     
    398397    if ($conn->conn->{socket}) {
    399398        $conn->conn->disconnect("Goodbye!");
    400     } elsif ($reconnect{$conn->alias}) {
     399    } elsif ($conn->{reconnect_timer}) {
    401400        BarnOwl::admin_message('IRC',
    402401                               "[" . $conn->alias . "] Reconnect cancelled");
    403402        $conn->cancel_reconnect;
     403        delete $ircnets{$conn->alias};
    404404    }
    405405}
     
    620620    my $allow_disconnected = shift;
    621621
    622     return $ircnets{$key} if exists $ircnets{$key};
    623     return $reconnect{$key} if $allow_disconnected && exists $reconnect{$key};
    624     die("No such ircnet: $key\n")
     622    my $conn = $ircnets{$key};
     623    die("No such ircnet: $key\n") unless $conn;
     624    if ($conn->conn->{registered} || $allow_disconnected) {
     625        return $conn;
     626    }
     627    die("[@{[$conn->alias]}] Not currently connected.");
    625628}
    626629
Note: See TracChangeset for help on using the changeset viewer.