[876] in BarnOwl Developers

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

[D-O-H] r864 - trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:10:40 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU
Date: Mon, 14 Jan 2008 00:24:44 -0500 (EST)

Author: nelhage
Date: 2008-01-14 00:24:43 -0500 (Mon, 14 Jan 2008)
New Revision: 864

Modified:
   trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
Log:
Right, _connected doesn't work either. I think I need to refactor this
to not be a subclass...


Modified: trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
===================================================================
--- trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm	2008-01-14 03:08:52 UTC (rev 863)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm	2008-01-14 05:24:43 UTC (rev 864)
@@ -15,7 +15,7 @@
 =cut
 
 use base qw(Net::IRC::Connection Class::Accessor Exporter);
-__PACKAGE__->mk_accessors(qw(alias channels _connected _motd));
+__PACKAGE__->mk_accessors(qw(alias channels owl_connected owl_motd));
 our @EXPORT_OK = qw(&is_private);
 
 use BarnOwl;
@@ -28,8 +28,8 @@
     my $self = $class->SUPER::new($irc, %args);
     $self->alias($alias);
     $self->channels([]);
-    $self->_motd("");
-    $self->_connected(0);
+    $self->owl_motd("");
+    $self->owl_connected(0);
     bless($self, $class);
 
     $self->add_default_handler(sub { goto &on_event; });
@@ -109,26 +109,26 @@
 
 sub on_motdstart {
     my ($self, $evt) = @_;
-    $self->_motd(join "\n", cdr $evt->args);
+    $self->owl_motd(join "\n", cdr $evt->args);
 }
 
 sub on_motd {
     my ($self, $evt) = @_;
-    $self->_motd(join "\n", $self->_motd, cdr $evt->args);
+    $self->owl_motd(join "\n", $self->owl_motd, cdr $evt->args);
 }
 
 sub on_endofmotd {
     my ($self, $evt) = @_;
-    $self->_motd(join "\n", $self->_motd, cdr $evt->args);
-    if(!$self->_connected) {
+    $self->owl_motd(join "\n", $self->owl_motd, cdr $evt->args);
+    if(!$self->owl_connected) {
         BarnOwl::admin_message("IRC", "Connected to " .
                                $self->server . " (" . $self->alias . ")");
-        $self->_connected(1);
+        $self->owl_connected(1);
         
     }
     BarnOwl::admin_message("IRC",
             BarnOwl::Style::boldify('MOTD for ' . $self->alias) . "\n"
-            . strip_irc_formatting($self->_motd));
+            . strip_irc_formatting($self->owl_motd));
 }
 
 sub on_join {
@@ -162,6 +162,9 @@
     BarnOwl::admin_message("IRC",
                            "[" . $self->alias . "] " .
                            [$evt->args]->[1] . ": Nick already in use");
+    unless($self->owl_connected) {
+        $self->disconnect;
+    }
 }
 
 sub on_event {


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