[836] in BarnOwl Developers

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

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

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:10:14 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: Thu, 10 Jan 2008 23:25:27 -0500 (EST)

Author: nelhage
Date: 2008-01-10 23:25:27 -0500 (Thu, 10 Jan 2008)
New Revision: 829

Modified:
   trunk/owl/perl/lib/BarnOwl/ModuleLoader.pm
   trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
   trunk/owl/perlwrap.pm
Log:
doc nits

Modified: trunk/owl/perl/lib/BarnOwl/ModuleLoader.pm
===================================================================
--- trunk/owl/perl/lib/BarnOwl/ModuleLoader.pm	2008-01-11 02:01:27 UTC (rev 828)
+++ trunk/owl/perl/lib/BarnOwl/ModuleLoader.pm	2008-01-11 04:25:27 UTC (rev 829)
@@ -47,7 +47,7 @@
 sub register_keybindings {
     BarnOwl::new_command('reload-modules', sub {BarnOwl::ModuleLoader->reload}, {
                            summary => 'Reload all modules',
-                           usage   => 'reload',
+                           usage   => 'reload-modules',
                            description => q{Reloads all modules located in ~/.owl/modules and the system modules directory}
                           });
 }

Modified: trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm	2008-01-11 02:01:27 UTC (rev 828)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm	2008-01-11 04:25:27 UTC (rev 829)
@@ -83,13 +83,25 @@
 }
 
 sub register_commands {
-    BarnOwl::new_command('irc-connect' => \&cmd_connect);
+    BarnOwl::new_command('irc-connect' => \&cmd_connect,
+                       {
+                           summary      => 'Connect to an IRC server',
+                           usage        => 'irc-connect [-a ALIAS ] [-s] [-p PASSWORD] [-n NICK] SERVER [port]',
+                           description  =>
+
+                           "Connect to an IRC server. Supported options are\n\n" .
+                           "-a <alias>          Define an alias for this server\n" .
+                           "-s                  Use SSL\n" .
+                           "-p <password>       Specify the password to use\n" .
+                           "-n <nick>           Use a non-default nick"
+                       });
     BarnOwl::new_command('irc-disconnect' => \&cmd_disconnect);
-    BarnOwl::new_command('irc-msg'     => \&cmd_msg);
-    BarnOwl::new_command('irc-join'    => \&cmd_join);
-    BarnOwl::new_command('irc-part'    => \&cmd_part);
-    BarnOwl::new_command('irc-nick'    => \&cmd_nick);
-    BarnOwl::new_command('irc-names'   => \&cmd_names);
+    BarnOwl::new_command('irc-msg'        => \&cmd_msg);
+    BarnOwl::new_command('irc-join'       => \&cmd_join);
+    BarnOwl::new_command('irc-part'       => \&cmd_part);
+    BarnOwl::new_command('irc-nick'       => \&cmd_nick);
+    BarnOwl::new_command('irc-names'      => \&cmd_names);
+    BarnOwl::new_command('irc-whois'      => \&cmd_whois);
 }
 
 $BarnOwl::Hooks::startup->add(\&startup);
@@ -118,18 +130,24 @@
             "alias=s"    => \$alias,
             "ssl"        => \$ssl,
             "password=s" => \$password,
-            "port=i"     => \$port,
             "nick=s"     => \$nick,
         );
         $host = shift @ARGV or die("Usage: $cmd HOST\n");
         if(!$alias) {
-            $alias = $1 if $host =~ /^(?:irc[.])?(\w+)[.]\w+$/;
-            $alias ||= $host;
+            if($host =~ /^(?:irc[.])?(\w+)[.]\w+$/) {
+                $alias = $1;
+            } else {
+                $alias = $host;
+            }
         }
-        $port ||= 6667;
+        $port = shift @ARGV || 6667;
         $ssl ||= 0;
     }
 
+    if(exists $ircnets{$alias}) {
+        die("Already connected to a server with alias '$alias'. Either disconnect or specify an alias with -a.\n");
+    }
+
     my $conn = BarnOwl::Module::IRC::Connection->new($irc, $alias,
         Nick      => $nick,
         Server    => $host,
@@ -197,24 +215,31 @@
 sub cmd_part {
     my $cmd = shift;
     my $conn = get_connection(\@_);
-    my $chan = get_channel(\@_) || die("Usage: $cmd <channel>");
+    my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
     $conn->part($chan);
 }
 
 sub cmd_nick {
     my $cmd = shift;
     my $conn = get_connection(\@_);
-    my $nick = shift or die("Usage: $cmd <new nick>");
+    my $nick = shift or die("Usage: $cmd <new nick>\n");
     $conn->nick($nick);
 }
 
 sub cmd_names {
     my $cmd = shift;
     my $conn = get_connection(\@_);
-    my $chan = get_channel(\@_) || die("Usage: $cmd <channel>");
+    my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
     $conn->names($chan);
 }
 
+sub cmd_whois {
+    my $cmd = shift;
+    my $conn = get_connection(\@_);
+    my $who = shift || die("Usage: $cmd <user>\n");
+    $conn->whois($who);
+}
+
 ################################################################################
 ########################### Utilities/Helpers ##################################
 ################################################################################

Modified: trunk/owl/perlwrap.pm
===================================================================
--- trunk/owl/perlwrap.pm	2008-01-11 02:01:27 UTC (rev 828)
+++ trunk/owl/perlwrap.pm	2008-01-11 04:25:27 UTC (rev 829)
@@ -699,6 +699,10 @@
     }
 }
 
+# These are the internal hooks called by the barnowl C code, which
+# take care of dispatching to the appropriate perl hooks, and deal
+# with compatibility by calling the old, fixed-name hooks.
+
 sub _startup {
     _load_owlconf();
 


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