[871] in BarnOwl Developers

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

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

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:10:36 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:08:17 -0500 (EST)

Author: nelhage
Date: 2008-01-13 18:08:14 -0500 (Sun, 13 Jan 2008)
New Revision: 860

Modified:
   trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
Log:
Kill a uninitialized warning


Modified: trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm	2008-01-13 02:01:20 UTC (rev 859)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm	2008-01-13 23:08:14 UTC (rev 860)
@@ -103,6 +103,7 @@
     BarnOwl::new_command('irc-nick'       => \&cmd_nick);
     BarnOwl::new_command('irc-names'      => \&cmd_names);
     BarnOwl::new_command('irc-whois'      => \&cmd_whois);
+    BarnOwl::new_command('irc-motd'       => \&cmd_motd);
 }
 
 $BarnOwl::Hooks::startup->add(\&startup);
@@ -244,6 +245,12 @@
     $conn->whois($who);
 }
 
+sub cmd_motd {
+    my $cmd = shift;
+    my $conn = get_connection(\@_);
+    $conn->motd;
+}
+
 ################################################################################
 ########################### Utilities/Helpers ##################################
 ################################################################################
@@ -255,7 +262,8 @@
         return get_connection_by_alias(shift @$args);
     }
     my $channel = $args->[-1];
-    if ($channel =~ /^#/ and $channels{$channel} and @{$channels{$channel}} == 1) {
+    if (defined($channel) && $channel =~ /^#/
+        and $channels{$channel} and @{$channels{$channel}} == 1) {
         return $channels{$channel}[0];
     }
     my $m = BarnOwl::getcurmsg();


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