Changeset 4789b17 for perl


Ignore:
Timestamp:
Jul 25, 2008, 11:59:40 PM (16 years ago)
Author:
Geoffrey Thomas <geofft@mit.edu>
Branches:
master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
a1a2036
Parents:
d264c6d
Message:
IRC: Add /quit display support
Location:
perl/modules/IRC/lib/BarnOwl
Files:
2 edited

Legend:

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

    rf151757 r4789b17  
    5656sub network {shift->{network}}
    5757sub channel {shift->{channel}}
     58sub action {shift->{action}}
     59sub reason {shift->{reason}}
    5860
    5961# display
     
    6567sub login_type {
    6668    my $self = shift;
    67     return " (" . ($self->is_login ? "JOIN" : "PART") . ")";
     69    return " (" . uc $self->action . ")";
    6870}
    6971
    70 sub login_extra { shift->channel; }
    71 
     72sub login_extra {
     73    my $self = shift;
     74    if ($self->action eq "quit") {
     75        return $self->reason;
     76    } else {
     77        return $self->channel;
     78    }
     79}
    7280
    73811;
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm

    rd264c6d r4789b17  
    6464    $self->conn->add_handler(join      => sub { shift; $self->on_join(@_) });
    6565    $self->conn->add_handler(part      => sub { shift; $self->on_part(@_) });
     66    $self->conn->add_handler(quit      => sub { shift; $self->on_quit(@_) });
    6667    $self->conn->add_handler(disconnect => sub { shift; $self->on_disconnect(@_) });
    6768    $self->conn->add_handler(nicknameinuse => sub { shift; $self->on_nickinuse(@_) });
     
    164165    my $msg = $self->new_message($evt,
    165166        loginout   => 'login',
     167        action     => 'join',
    166168        channel    => $evt->to,
    167169        replycmd => 'irc-msg -a ' . $self->alias . ' ' . join(' ', $evt->to),
     
    175177    my $msg = $self->new_message($evt,
    176178        loginout   => 'logout',
     179        action     => 'part',
    177180        channel    => $evt->to,
    178181        replycmd => 'irc-msg -a ' . $self->alias . ' ' . join(' ', $evt->to),
     182        replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick
     183        );
     184    BarnOwl::queue_message($msg);
     185}
     186
     187sub on_quit {
     188    my ($self, $evt) = @_;
     189    my $msg = $self->new_message($evt,
     190        loginout   => 'logout',
     191        action     => 'quit',
     192        from       => $evt->to,
     193        reason     => [$evt->args]->[0],
     194        replycmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick,
    179195        replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick
    180196        );
Note: See TracChangeset for help on using the changeset viewer.