Changeset 60b49a7


Ignore:
Timestamp:
Apr 3, 2011, 3:06:01 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
0ccf5ab
Parents:
5d4262c
git-author:
Nelson Elhage <nelhage@mit.edu> (03/03/11 10:58:42)
git-committer:
Nelson Elhage <nelhage@mit.edu> (04/03/11 15:06:01)
Message:
Make nick-change events LOGIN messages instead of ADMIN.
Location:
perl/modules/IRC/lib/BarnOwl
Files:
2 edited

Legend:

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

    re04b7a1 r60b49a7  
    6666sub action {shift->{action}}
    6767sub reason {shift->{reason}}
     68sub old_nick {shift->{old_nick}};
    6869
    6970# display
     
    8081}
    8182
    82 sub login_extra { 
     83sub login_extra {
    8384    my $self = shift;
    8485    if ($self->action eq "quit") {
    8586        return $self->reason;
     87    } elsif ($self->action eq 'nick change') {
     88        return "was: " . $self->old_nick;
    8689    } else {
    8790        return $self->channel;
  • perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm

    r5d4262c r60b49a7  
    122122    my $self = shift;
    123123    my $evt = shift;
    124     my ($nick, $user, $host) = split_prefix($evt);
    125     return BarnOwl::Message->new(
     124    my %args = (
    126125        type        => 'IRC',
    127126        server      => $self->server,
    128127        network     => $self->alias,
    129         sender      => $nick,
    130         defined($host) ? (hostname    => $host) : (),
    131         from        => $evt->{prefix},
    132128        @_
    133129       );
     130    if ($evt) {
     131        my ($nick, $user, $host) = split_prefix($evt);
     132        $args{sender}   ||= $nick;
     133        $args{hostname} ||= $host if defined($host);
     134        $args{from}     ||= $evt->{prefix};
     135        $args{params}   ||= join(' ', @{$evt->{params}})
     136    }
     137    return BarnOwl::Message->new(%args);
    134138}
    135139
     
    274278                               "You are now known as $new_nick");
    275279    } else {
    276         BarnOwl::admin_message("IRC",
    277                                "[" . $self->alias . "] " .
    278                                "$old_nick is now known as $new_nick");
     280        my $msg = $self->new_message('',
     281            loginout   => 'login',
     282            action     => 'nick change',
     283            from       => $new_nick,
     284            sender     => $new_nick,
     285            replycmd   => BarnOwl::quote('irc-msg', '-a', $self->alias,
     286                                         $new_nick),
     287            replysendercmd => BarnOwl::quote('irc-msg', '-a', $self->alias,
     288                                             $new_nick),
     289            old_nick   => $old_nick);
     290        BarnOwl::queue_message($msg);
    279291    }
    280292}
Note: See TracChangeset for help on using the changeset viewer.