[1144] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r1093 - in trunk/owl/perl/modules/IRC/lib/BarnOwl: Message Module/IRC

daemon@ATHENA.MIT.EDU (geofft@MIT.EDU)
Thu Oct 29 18:13:28 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
Date: Fri, 25 Jul 2008 23:59:40 -0400 (EDT)
To: dirty-owl-hackers@mit.edu
From: geofft@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU

Author: geofft
Date: 2008-07-25 23:59:40 -0400 (Fri, 25 Jul 2008)
New Revision: 1093

Modified:
   trunk/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm
   trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
Log:
IRC: Add /quit display support


Modified: trunk/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm
===================================================================
--- trunk/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm	2008-07-24 05:55:35 UTC (rev 1092)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm	2008-07-26 03:59:40 UTC (rev 1093)
@@ -55,6 +55,8 @@
 sub server {shift->{server}}
 sub network {shift->{network}}
 sub channel {shift->{channel}}
+sub action {shift->{action}}
+sub reason {shift->{reason}}
 
 # display
 sub context {shift->{network};}
@@ -64,10 +66,16 @@
 
 sub login_type {
     my $self = shift;
-    return " (" . ($self->is_login ? "JOIN" : "PART") . ")";
+    return " (" . uc $self->action . ")";
 }
 
-sub login_extra { shift->channel; }
+sub login_extra { 
+    my $self = shift;
+    if ($self->action eq "quit") {
+        return $self->reason;
+    } else {
+        return $self->channel;
+    }
+}
 
-
 1;

Modified: trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
===================================================================
--- trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm	2008-07-24 05:55:35 UTC (rev 1092)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm	2008-07-26 03:59:40 UTC (rev 1093)
@@ -63,6 +63,7 @@
     $self->conn->add_handler(endofmotd => sub { shift; $self->on_endofmotd(@_) });
     $self->conn->add_handler(join      => sub { shift; $self->on_join(@_) });
     $self->conn->add_handler(part      => sub { shift; $self->on_part(@_) });
+    $self->conn->add_handler(quit      => sub { shift; $self->on_quit(@_) });
     $self->conn->add_handler(disconnect => sub { shift; $self->on_disconnect(@_) });
     $self->conn->add_handler(nicknameinuse => sub { shift; $self->on_nickinuse(@_) });
     $self->conn->add_handler(cping     => sub { shift; $self->on_ping(@_) });
@@ -163,6 +164,7 @@
     my ($self, $evt) = @_;
     my $msg = $self->new_message($evt,
         loginout   => 'login',
+        action     => 'join',
         channel    => $evt->to,
         replycmd => 'irc-msg -a ' . $self->alias . ' ' . join(' ', $evt->to),
         replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick
@@ -174,6 +176,7 @@
     my ($self, $evt) = @_;
     my $msg = $self->new_message($evt,
         loginout   => 'logout',
+        action     => 'part',
         channel    => $evt->to,
         replycmd => 'irc-msg -a ' . $self->alias . ' ' . join(' ', $evt->to),
         replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick
@@ -181,6 +184,19 @@
     BarnOwl::queue_message($msg);
 }
 
+sub on_quit {
+    my ($self, $evt) = @_;
+    my $msg = $self->new_message($evt,
+        loginout   => 'logout',
+        action     => 'quit',
+        from       => $evt->to,
+        reason     => [$evt->args]->[0],
+        replycmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick,
+        replysendercmd => 'irc-msg -a ' . $self->alias . ' ' . $evt->nick
+        );
+    BarnOwl::queue_message($msg);
+}
+
 sub on_disconnect {
     my $self = shift;
     delete $BarnOwl::Module::IRC::ircnets{$self->alias};


home help back first fref pref prev next nref lref last post