Changeset 41ade7f for perl


Ignore:
Timestamp:
Apr 3, 2011, 3:06:02 PM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
b9a642a
Parents:
0b0e460
git-author:
Nelson Elhage <nelhage@mit.edu> (03/10/11 11:30:56)
git-committer:
Nelson Elhage <nelhage@mit.edu> (04/03/11 15:06:02)
Message:
Try to improve disconnection behavior
File:
1 edited

Legend:

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

    r0b0e460 r41ade7f  
    6565                        disconnect => on("disconnect"),
    6666                        publicmsg  => on("msg"),
    67                         privatemsg => on("msg"));
     67                        privatemsg => on("msg"),
     68                        irc_error  => on("error"));
    6869    for my $m (qw(welcome yourhost created
    6970                  luserclient luserop luserchannels luserme
     
    9394                        nick_change   => on("nick"),
    9495                        ctcp_action   => on("ctcp_action"),
    95                         'irc_*' => sub { BarnOwl::debug("IRC: " . $_[1]->{command}) });
     96                        'irc_*' => sub { BarnOwl::debug("IRC: " . $_[1]->{command} .
     97                                                        join(" ", @{$_[1]->{params}})) });
    9698
    9799    return $self;
     
    256258sub on_disconnect {
    257259    my ($self, $why) = @_;
    258     $self->disconnect;
    259260    BarnOwl::admin_message('IRC',
    260261                           "[" . $self->alias . "] Disconnected from server");
     262    $self->disconnect;
    261263    if ($why && $why =~ m{error in connection}) {
    262264        $self->schedule_reconnect;
    263265    }
     266}
     267
     268sub on_error {
     269    my ($self, $evt) = @_;
     270    BarnOwl::admin_message('IRC',
     271                           "[" . $self->alias . "] " .
     272                           "Error: " . join(" ", @{$evt->{params}}));
    264273}
    265274
Note: See TracChangeset for help on using the changeset viewer.