Changeset 618a980


Ignore:
Timestamp:
Dec 23, 2009, 5:42:08 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
36a16fc
Parents:
0cfa6ee
git-author:
Alex Vandiver <alexmv@mit.edu> (12/20/09 01:11:03)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/23/09 17:42:08)
Message:
irc-disconnect on a pending reconnect should cancel the reconnect
Location:
perl/modules/IRC/lib/BarnOwl/Module
Files:
2 edited

Legend:

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

    r6396c1e r618a980  
    167167
    168168    BarnOwl::new_command(
    169         'irc-disconnect' => mk_irc_command( \&cmd_disconnect ),
     169        'irc-disconnect' => \&cmd_disconnect,
    170170        {
    171171            summary => 'Disconnect from an IRC server',
     
    391391
    392392sub cmd_disconnect {
    393     my $cmd = shift;
    394     my $conn = shift;
    395     $conn->conn->disconnect;
    396     return;
     393    # Such a hack
     394    local *get_connection_by_alias = sub {
     395        my $key = shift;
     396        return $ircnets{$key} if exists $ircnets{$key};
     397        return $reconnect{$key}{conn} if exists $reconnect{$key};
     398        die("No such ircnet: $key\n");
     399    };
     400
     401    mk_irc_command(
     402        sub {
     403            my $cmd = shift;
     404            my $conn = shift;
     405            if ($conn->conn->connected) {
     406                $conn->conn->disconnect;
     407            } elsif ($reconnect{$conn->alias}) {
     408                BarnOwl::admin_message('IRC',
     409                                       "[" . $conn->alias . "] Reconnect cancelled");
     410                delete $reconnect{$conn->alias};
     411            }
     412        }
     413    )->(@_);
    397414}
    398415
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm

    r99c1f46 r618a980  
    322322            },
    323323        } );
     324    $BarnOwl::Module::IRC::reconnect{$self->alias}{conn} = $self;
    324325}
    325326
Note: See TracChangeset for help on using the changeset viewer.