[893] in BarnOwl Developers

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

[D-O-H] r880 - in branches/barnowl_sqlite: . owl owl/perl/modules/IRC/lib/BarnOwl/Message owl/perl/modules/IRC/lib/BarnOwl/Module owl/perl/modules/IRC/lib/BarnOwl/Module/IRC owl/perl/modules/Jabber/lib/BarnOwl/Module

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:10:50 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: Tue, 15 Jan 2008 22:19:44 -0500 (EST)

Author: nelhage
Date: 2008-01-15 22:19:43 -0500 (Tue, 15 Jan 2008)
New Revision: 880

Modified:
   branches/barnowl_sqlite/
   branches/barnowl_sqlite/owl/README
   branches/barnowl_sqlite/owl/editwin.c
   branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm
   branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
   branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
   branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
   branches/barnowl_sqlite/owl/perlconfig.c
Log:
Merged revisions 838-879 via svnmerge from 
svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/trunk

........
  r841 | nelhage | 2008-01-11 22:40:17 -0500 (Fri, 11 Jan 2008) | 2 lines
  
  Nuke a warning
........
  r845 | nelhage | 2008-01-12 01:11:53 -0500 (Sat, 12 Jan 2008) | 2 lines
  
  I'm tired of those stupid warning.
........
  r848 | nelhage | 2008-01-12 02:00:53 -0500 (Sat, 12 Jan 2008) | 2 lines
  
  Adding a note about IRC deps
........
  r853 | asedeno | 2008-01-12 11:56:20 -0500 (Sat, 12 Jan 2008) | 2 lines
  
  Fixing a pet peeve.
  Clearing the line should preserve the echochar.
........
  r854 | asedeno | 2008-01-12 15:07:20 -0500 (Sat, 12 Jan 2008) | 3 lines
  
  Jabber - 
  * fix logins to jabber.org - reported by gendalia
........
  r860 | nelhage | 2008-01-13 18:08:14 -0500 (Sun, 13 Jan 2008) | 2 lines
  
  Kill a uninitialized warning
........
  r861 | nelhage | 2008-01-13 18:10:13 -0500 (Sun, 13 Jan 2008) | 1 line
  
  Show JOIN and PART for login/outs
........
  r862 | nelhage | 2008-01-13 18:10:44 -0500 (Sun, 13 Jan 2008) | 1 line
  
  'motd' is a method of Net::IRC::Connection, don't clobber it
........
  r863 | nelhage | 2008-01-13 22:08:52 -0500 (Sun, 13 Jan 2008) | 2 lines
  
  Don't clober our parent's connected() method, either.
........
  r864 | nelhage | 2008-01-14 00:24:43 -0500 (Mon, 14 Jan 2008) | 3 lines
  
  Right, _connected doesn't work either. I think I need to refactor this
  to not be a subclass...
........
  r875 | nelhage | 2008-01-15 14:40:02 -0500 (Tue, 15 Jan 2008) | 2 lines
  
  Actually free the right thing when freeing perl commands
........



Property changes on: branches/barnowl_sqlite
___________________________________________________________________
Name: svnmerge-integrated
   - /trunk:1-837
   + /trunk:1-879

Modified: branches/barnowl_sqlite/owl/README
===================================================================
--- branches/barnowl_sqlite/owl/README	2008-01-15 22:03:01 UTC (rev 879)
+++ branches/barnowl_sqlite/owl/README	2008-01-16 03:19:43 UTC (rev 880)
@@ -27,3 +27,8 @@
 (Note that these are all available as Debian packages)
 We plan to soon add targets to the Makefile to check for and install
 these for you.
+
+The IRC module requires:
+
+Net::IRC
+Class::Accessor

Modified: branches/barnowl_sqlite/owl/editwin.c
===================================================================
--- branches/barnowl_sqlite/owl/editwin.c	2008-01-15 22:03:01 UTC (rev 879)
+++ branches/barnowl_sqlite/owl/editwin.c	2008-01-16 03:19:43 UTC (rev 880)
@@ -196,6 +196,7 @@
   int lock;
   int dotsend=e->dotsend;
   char *locktext=NULL;
+  char echochar=e->echochar;
 
   lock=0;
   if (e->lock > 0) {
@@ -215,6 +216,9 @@
   if (dotsend) {
     owl_editwin_set_dotsend(e);
   }
+  if (echochar) {
+    owl_editwin_set_echochar(e, echochar);
+  }
 
   if (locktext) owl_free(locktext);
   owl_editwin_adjust_for_locktext(e);

Modified: branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm	2008-01-15 22:03:01 UTC (rev 879)
+++ branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm	2008-01-16 03:19:43 UTC (rev 880)
@@ -55,6 +55,11 @@
 
 sub long_sender {shift->{from} || ""};
 
+sub login_type {
+    my $self = shift;
+    return " (" . ($self->is_login ? "JOIN" : "PART") . ")";
+}
+
 sub login_extra { shift->channel; }
 
 

Modified: branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm	2008-01-15 22:03:01 UTC (rev 879)
+++ branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm	2008-01-16 03:19:43 UTC (rev 880)
@@ -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 owl_connected owl_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->owl_motd("");
+    $self->owl_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->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);
+    $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->owl_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->owl_motd));
 }
 
 sub on_join {
@@ -161,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 {

Modified: branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm	2008-01-15 22:03:01 UTC (rev 879)
+++ branches/barnowl_sqlite/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm	2008-01-16 03:19:43 UTC (rev 880)
@@ -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();

Modified: branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm
===================================================================
--- branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm	2008-01-15 22:03:01 UTC (rev 879)
+++ branches/barnowl_sqlite/owl/perl/modules/Jabber/lib/BarnOwl/Module/Jabber.pm	2008-01-16 03:19:43 UTC (rev 880)
@@ -369,7 +369,7 @@
             my @result = $client->AuthSend( %{ $vars{jlogin_authhash} } );
 
             if ( !@result || $result[0] ne 'ok' ) {
-                if ( !$vars{jlogin_havepass} && ( !@result || $result[0] eq '401' ) ) {
+                if ( !$vars{jlogin_havepass} && ( !@result || $result[0] eq '401' || $result[0] eq 'error') ) {
                     $vars{jlogin_havepass} = 1;
                     $conn->removeConnection($jidStr);
                     BarnOwl::start_password( "Password for $jidStr: ", \&do_login );

Modified: branches/barnowl_sqlite/owl/perlconfig.c
===================================================================
--- branches/barnowl_sqlite/owl/perlconfig.c	2008-01-15 22:03:01 UTC (rev 879)
+++ branches/barnowl_sqlite/owl/perlconfig.c	2008-01-16 03:19:43 UTC (rev 880)
@@ -330,7 +330,7 @@
 
 void owl_perlconfig_cmd_free(owl_cmd *cmd)
 {
-  SvREFCNT_dec(cmd);
+  SvREFCNT_dec(cmd->cmd_perl);
 }
 
 void owl_perlconfig_edit_callback(owl_editwin *e)


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