[1138] in BarnOwl Developers
[D-O-H] r1090 - in trunk/owl/perl/modules/IRC/lib/BarnOwl/Module: . IRC
daemon@ATHENA.MIT.EDU (geofft@MIT.EDU)
Thu Oct 29 18:13:24 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
Date: Wed, 23 Jul 2008 20:18:31 -0400 (EDT)
To: dirty-owl-hackers@mit.edu
From: geofft@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Author: geofft
Date: 2008-07-23 20:18:30 -0400 (Wed, 23 Jul 2008)
New Revision: 1090
Modified:
trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
Log:
IRC: Add :irc-topic support and on_topic/on_topicinfo callbacks.
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-21 03:58:54 UTC (rev 1089)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm 2008-07-24 00:18:30 UTC (rev 1090)
@@ -64,6 +64,8 @@
$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(@_) });
+ $self->conn->add_handler(topic => sub { shift; $self->on_topic(@_) });
+ $self->conn->add_handler(topicinfo => sub { shift; $self->on_topicinfo(@_) });
return $self;
}
@@ -192,6 +194,25 @@
}
}
+sub on_topic {
+ my ($self, $evt) = @_;
+ my @args = $evt->args;
+ if (scalar @args > 1) {
+ BarnOwl::admin_message("IRC",
+ "Topic for $args[1] on " . $self->alias . " is $args[2]");
+ } else {
+ BarnOwl::admin_message("IRC",
+ "Topic changed to $args[0]");
+ }
+}
+
+sub on_topicinfo {
+ my ($self, $evt) = @_;
+ my @args = $evt->args;
+ BarnOwl::admin_message("IRC",
+ "Topic for $args[1] set by $args[2] at " . localtime($args[3]));
+}
+
sub on_event {
my ($self, $evt) = @_;
BarnOwl::admin_message("IRC",
Modified: trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-07-21 03:58:54 UTC (rev 1089)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-07-24 00:18:30 UTC (rev 1090)
@@ -116,6 +116,7 @@
BarnOwl::new_command('irc-list' => \&cmd_list);
BarnOwl::new_command('irc-who' => \&cmd_who);
BarnOwl::new_command('irc-stats' => \&cmd_stats);
+ BarnOwl::new_command('irc-topic' => \&cmd_topic);
}
$BarnOwl::Hooks::startup->add(\&startup);
@@ -300,6 +301,12 @@
$conn->conn->stats($type, @_);
}
+sub cmd_topic {
+ my $cmd = shift;
+ my $conn = get_connection(\@_);
+ $conn->conn->topic(@_);
+}
+
################################################################################
########################### Utilities/Helpers ##################################
################################################################################