[873] in BarnOwl Developers
[D-O-H] r862 - trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC
daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:10:38 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: Sun, 13 Jan 2008 18:10:44 -0500 (EST)
Author: nelhage
Date: 2008-01-13 18:10:44 -0500 (Sun, 13 Jan 2008)
New Revision: 862
Modified:
trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
Log:
'motd' is a method of Net::IRC::Connection, don't clobber it
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-13 23:10:13 UTC (rev 861)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm 2008-01-13 23:10:44 UTC (rev 862)
@@ -15,7 +15,7 @@
=cut
use base qw(Net::IRC::Connection Class::Accessor Exporter);
-__PACKAGE__->mk_accessors(qw(alias channels motd));
+__PACKAGE__->mk_accessors(qw(alias channels connected _motd));
our @EXPORT_OK = qw(&is_private);
use BarnOwl;
@@ -28,11 +28,11 @@
my $self = $class->SUPER::new($irc, %args);
$self->alias($alias);
$self->channels([]);
- $self->motd("");
+ $self->_motd("");
+ $self->connected(0);
bless($self, $class);
$self->add_default_handler(sub { goto &on_event; });
- $self->add_handler(376 => sub { goto &on_connect });
$self->add_handler(['msg', 'notice', 'public', 'caction'],
sub { goto &on_msg });
$self->add_handler(['welcome', 'yourhost', 'created',
@@ -57,11 +57,6 @@
############################### IRC callbacks ##################################
################################################################################
-sub on_connect {
- my ($self, $evt) = @_;
- BarnOwl::admin_message("IRC", "Connected to " . $self->server . " (" . $self->alias . ")");
-}
-
sub new_message {
my $self = shift;
my $evt = shift;
@@ -114,20 +109,26 @@
sub on_motdstart {
my ($self, $evt) = @_;
- $self->motd(join "\n", cdr $evt->args);
+ $self->_motd(join "\n", cdr $evt->args);
}
sub on_motd {
my ($self, $evt) = @_;
- $self->motd(join "\n", $self->motd, cdr $evt->args);
+ $self->_motd(join "\n", $self->_motd, cdr $evt->args);
}
sub on_endofmotd {
my ($self, $evt) = @_;
- $self->motd(join "\n", $self->motd, cdr $evt->args);
+ $self->_motd(join "\n", $self->_motd, cdr $evt->args);
+ if(!$self->connected) {
+ BarnOwl::admin_message("IRC", "Connected to " .
+ $self->server . " (" . $self->alias . ")");
+ $self->connected(1);
+
+ }
BarnOwl::admin_message("IRC",
- BarnOwl::Style::boldify('MOTD for ' . $evt->alias) . "\n"
- . strip_irc_formatting($self->motd));
+ BarnOwl::Style::boldify('MOTD for ' . $self->alias) . "\n"
+ . strip_irc_formatting($self->_motd));
}
sub on_join {