[922] in BarnOwl Developers
[D-O-H] r909 - in branches/barnowl_unicode: . owl owl/perl/modules/IRC owl/perl/modules/IRC/lib/BarnOwl/Module owl/perl/modules/IRC/lib/BarnOwl/Module/IRC
daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:11:10 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
X-Original-To: nelhage@nelhage.com
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Mon, 28 Jan 2008 13:41:56 -0500 (EST)
Author: asedeno
Date: 2008-01-28 13:41:55 -0500 (Mon, 28 Jan 2008)
New Revision: 909
Modified:
branches/barnowl_unicode/
branches/barnowl_unicode/owl/Makefile.in
branches/barnowl_unicode/owl/global.c
branches/barnowl_unicode/owl/owl.c
branches/barnowl_unicode/owl/perl/modules/IRC/
branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
branches/barnowl_unicode/owl/perlwrap.pm
branches/barnowl_unicode/owl/zephyr.c
Log:
Merged revisions 882-908 via svnmerge from
file:///afs/sipb.mit.edu/project/barnowl/src/svn/trunk
........
r889 | nelhage | 2008-01-16 22:03:00 -0500 (Wed, 16 Jan 2008) | 4 lines
Rewrite ::Connection to not subclass Net::IRC::Connection to avoid
stupid namespace conflicts
........
r890 | nelhage | 2008-01-16 22:07:42 -0500 (Wed, 16 Jan 2008) | 2 lines
svn:ignore for great justice
........
r894 | asedeno | 2008-01-17 02:13:44 -0500 (Thu, 17 Jan 2008) | 2 lines
dropping one unnecessary time(NULL) call.
........
r898 | geofft | 2008-01-18 08:58:53 -0500 (Fri, 18 Jan 2008) | 4 lines
* minor changes to IRC
* run ./svkversion only once rather than at every cc
* fix one-line style to format logouts, not just logins
........
r900 | nelhage | 2008-01-23 23:20:12 -0500 (Wed, 23 Jan 2008) | 3 lines
Fix the error messages sending to users who don't exist or aren't
signed on.
........
Property changes on: branches/barnowl_unicode
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-881
+ /trunk:1-908
Modified: branches/barnowl_unicode/owl/Makefile.in
===================================================================
--- branches/barnowl_unicode/owl/Makefile.in 2008-01-25 01:53:29 UTC (rev 908)
+++ branches/barnowl_unicode/owl/Makefile.in 2008-01-28 18:41:55 UTC (rev 909)
@@ -10,7 +10,7 @@
CC=@CC@
LIBS=@LIBS@ -L./libfaim -lfaim
-CFLAGS=@CFLAGS@ -I. -I./libfaim -DDATADIR=\"${datadir}\" -DOWL_SVN_REVNO=`./svkversion`
+CFLAGS=@CFLAGS@ -I. -I./libfaim -DDATADIR=\"${datadir}\" -DOWL_SVN_REVNO=$(shell ./svkversion)
LDFLAGS=@LDFLAGS@
XSUBPPDIR=@XSUBPPDIR@
XSUBPPFLAGS=@XSUBPPFLAGS@
Modified: branches/barnowl_unicode/owl/global.c
===================================================================
--- branches/barnowl_unicode/owl/global.c 2008-01-25 01:53:29 UTC (rev 908)
+++ branches/barnowl_unicode/owl/global.c 2008-01-28 18:41:55 UTC (rev 909)
@@ -479,8 +479,8 @@
return(g->lastinputtime);
}
-void owl_global_update_lastinputtime(owl_global *g) {
- g->lastinputtime = time(NULL);
+void owl_global_set_lastinputtime(owl_global *g, time_t time) {
+ g->lastinputtime = time;
}
time_t owl_global_get_idletime(owl_global *g) {
Modified: branches/barnowl_unicode/owl/owl.c
===================================================================
--- branches/barnowl_unicode/owl/owl.c 2008-01-25 01:53:29 UTC (rev 908)
+++ branches/barnowl_unicode/owl/owl.c 2008-01-28 18:41:55 UTC (rev 909)
@@ -586,7 +586,7 @@
j.uch = j.ch;
}
- owl_global_update_lastinputtime(&g);
+ owl_global_set_lastinputtime(&g, now);
/* find and activate the current keymap.
* TODO: this should really get fixed by activating
* keymaps as we switch between windows...
Property changes on: branches/barnowl_unicode/owl/perl/modules/IRC
___________________________________________________________________
Name: svn:ignore
+ IRC.par
META.yml
Makefile
pm_to_blib
blib
inc
Modified: branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm 2008-01-25 01:53:29 UTC (rev 908)
+++ branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm 2008-01-28 18:41:55 UTC (rev 909)
@@ -9,46 +9,61 @@
=head1 DESCRIPTION
-This module is a Net::IRC::Connection subclass for BarnOwl's IRC
+This module is a wrapper around Net::IRC::Connection for BarnOwl's IRC
support
=cut
-use base qw(Net::IRC::Connection Class::Accessor Exporter);
-__PACKAGE__->mk_accessors(qw(alias channels owl_connected owl_motd));
+use Net::IRC::Connection;
+
+use base qw(Class::Accessor Exporter);
+__PACKAGE__->mk_accessors(qw(conn alias channels connected motd));
our @EXPORT_OK = qw(&is_private);
use BarnOwl;
+BEGIN {
+ no strict 'refs';
+ my @delegate = qw(nick server);
+ for my $meth (@delegate) {
+ *{"BarnOwl::Module::IRC::Connection::$meth"} = sub {
+ shift->conn->$meth(@_);
+ }
+ }
+};
+
sub new {
my $class = shift;
my $irc = shift;
my $alias = shift;
my %args = (@_);
- my $self = $class->SUPER::new($irc, %args);
+ my $conn = Net::IRC::Connection->new($irc, %args);
+ my $self = bless({}, $class);
+ $self->conn($conn);
$self->alias($alias);
$self->channels([]);
- $self->owl_motd("");
- $self->owl_connected(0);
- bless($self, $class);
+ $self->motd("");
+ $self->connected(0);
- $self->add_default_handler(sub { goto &on_event; });
- $self->add_handler(['msg', 'notice', 'public', 'caction'],
- sub { goto &on_msg });
- $self->add_handler(['welcome', 'yourhost', 'created',
- 'luserclient', 'luserop', 'luserchannels', 'luserme'],
- sub { goto &on_admin_msg });
- $self->add_handler(['myinfo', 'map', 'n_local', 'n_global',
+ $self->conn->add_handler(376 => sub { shift; $self->on_connect(@_) });
+ $self->conn->add_default_handler(sub { shift; $self->on_event(@_) });
+ $self->conn->add_handler(['msg', 'notice', 'public', 'caction'],
+ sub { shift; $self->on_msg(@_) });
+ $self->conn->add_handler(['welcome', 'yourhost', 'created',
+ 'luserclient', 'luserop', 'luserchannels', 'luserme',
+ 'notice', 'error'],
+ sub { shift; $self->on_admin_msg(@_) });
+ $self->conn->add_handler(['myinfo', 'map', 'n_local', 'n_global',
'luserconns'],
sub { });
- $self->add_handler(motdstart => sub { goto &on_motdstart });
- $self->add_handler(motd => sub { goto &on_motd });
- $self->add_handler(endofmotd => sub { goto &on_endofmotd });
- $self->add_handler(join => sub { goto &on_join });
- $self->add_handler(part => sub { goto &on_part });
- $self->add_handler(disconnect => sub { goto &on_disconnect });
- $self->add_handler(nicknameinuse => sub { goto &on_nickinuse });
- $self->add_handler(cping => sub { goto &on_ping });
+ $self->conn->add_handler(motdstart => sub { shift; $self->on_motdstart(@_) });
+ $self->conn->add_handler(motd => sub { shift; $self->on_motd(@_) });
+ $self->conn->add_handler(endofmotd => sub { shift; $self->on_endofmotd(@_) });
+ $self->conn->add_handler(join => sub { shift; $self->on_join(@_) });
+ $self->conn->add_handler(part => sub { shift; $self->on_part(@_) });
+ $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(@_) });
return $self;
}
@@ -96,7 +111,7 @@
sub on_ping {
my ($self, $evt) = @_;
- $self->ctcp_reply($evt->nick, join (' ', ($evt->args)));
+ $self->conn->ctcp_reply($evt->nick, join (' ', ($evt->args)));
}
sub on_admin_msg {
@@ -109,26 +124,26 @@
sub on_motdstart {
my ($self, $evt) = @_;
- $self->owl_motd(join "\n", cdr $evt->args);
+ $self->motd(join "\n", cdr $evt->args);
}
sub on_motd {
my ($self, $evt) = @_;
- $self->owl_motd(join "\n", $self->owl_motd, cdr $evt->args);
+ $self->motd(join "\n", $self->motd, cdr $evt->args);
}
sub on_endofmotd {
my ($self, $evt) = @_;
- $self->owl_motd(join "\n", $self->owl_motd, cdr $evt->args);
- if(!$self->owl_connected) {
+ $self->motd(join "\n", $self->motd, cdr $evt->args);
+ if(!$self->connected) {
BarnOwl::admin_message("IRC", "Connected to " .
$self->server . " (" . $self->alias . ")");
- $self->owl_connected(1);
+ $self->connected(1);
}
BarnOwl::admin_message("IRC",
BarnOwl::Style::boldify('MOTD for ' . $self->alias) . "\n"
- . strip_irc_formatting($self->owl_motd));
+ . strip_irc_formatting($self->motd));
}
sub on_join {
@@ -162,8 +177,8 @@
BarnOwl::admin_message("IRC",
"[" . $self->alias . "] " .
[$evt->args]->[1] . ": Nick already in use");
- unless($self->owl_connected) {
- $self->disconnect;
+ unless($self->connected) {
+ $self->conn->disconnect;
}
}
Modified: branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-01-25 01:53:29 UTC (rev 908)
+++ branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-01-28 18:41:55 UTC (rev 909)
@@ -64,7 +64,7 @@
sub shutdown {
for my $conn (values %ircnets) {
- $conn->disconnect();
+ $conn->conn->disconnect();
}
}
@@ -161,14 +161,20 @@
SSL => $ssl
);
- $ircnets{$alias} = $conn;
+ if ($conn->connected) {
+ BarnOwl::admin_message("IRC", "Connected to $alias as $nick");
+ $ircnets{$alias} = $conn;
+ } else {
+ die("IRC::Connection->connect failed: $!");
+ }
+
return;
}
sub cmd_disconnect {
my $cmd = shift;
my $conn = get_connection(\@_);
- $conn->disconnect;
+ $conn->conn->disconnect;
delete $ircnets{$conn->alias};
}
@@ -190,7 +196,7 @@
my $body = shift;
# Strip whitespace. In the future -- send one message/line?
$body =~ tr/\n\r/ /;
- $conn->privmsg($to, $body);
+ $conn->conn->privmsg($to, $body);
my $msg = BarnOwl::Message->new(
type => 'IRC',
direction => is_private($to) ? 'out' : 'in',
@@ -213,7 +219,7 @@
my $chan = shift or die("Usage: $cmd channel\n");
$channels{$chan} ||= [];
push @{$channels{$chan}}, $conn;
- $conn->join($chan);
+ $conn->conn->join($chan);
}
sub cmd_part {
@@ -221,34 +227,34 @@
my $conn = get_connection(\@_);
my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
$channels{$chan} = [grep {$_ ne $conn} @{$channels{$chan} || []}];
- $conn->part($chan);
+ $conn->conn->part($chan);
}
sub cmd_nick {
my $cmd = shift;
my $conn = get_connection(\@_);
my $nick = shift or die("Usage: $cmd <new nick>\n");
- $conn->nick($nick);
+ $conn->conn->nick($nick);
}
sub cmd_names {
my $cmd = shift;
my $conn = get_connection(\@_);
my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
- $conn->names($chan);
+ $conn->conn->names($chan);
}
sub cmd_whois {
my $cmd = shift;
my $conn = get_connection(\@_);
my $who = shift || die("Usage: $cmd <user>\n");
- $conn->whois($who);
+ $conn->conn->whois($who);
}
sub cmd_motd {
my $cmd = shift;
my $conn = get_connection(\@_);
- $conn->motd;
+ $conn->conn->motd;
}
################################################################################
Modified: branches/barnowl_unicode/owl/perlwrap.pm
===================================================================
--- branches/barnowl_unicode/owl/perlwrap.pm 2008-01-25 01:53:29 UTC (rev 908)
+++ branches/barnowl_unicode/owl/perlwrap.pm 2008-01-28 18:41:55 UTC (rev 909)
@@ -846,7 +846,7 @@
# if ( $m->is_zephyr ) {
# return format_zephyr($m);
# }
- if ( $m->is_login ) {
+ if ( $m->is_loginout ) {
return format_login($m);
}
elsif ( $m->is_ping) {
Modified: branches/barnowl_unicode/owl/zephyr.c
===================================================================
--- branches/barnowl_unicode/owl/zephyr.c 2008-01-25 01:53:29 UTC (rev 908)
+++ branches/barnowl_unicode/owl/zephyr.c 2008-01-28 18:41:55 UTC (rev 909)
@@ -612,15 +612,18 @@
char buff[BUFFLEN];
tmp = short_zuser(retnotice->z_recipient);
owl_function_error("%s: Not logged in or subscribing.", tmp);
- snprintf(buff, BUFFLEN, "Could not send message to %s: not logged in or subscribing to", tmp);
if(strcmp(retnotice->z_class, "message")) {
snprintf(buff, BUFFLEN,
- "%s class %s, instance %s.\n", buff,
+ "Could not send message to %s: "
+ "not logged in or subscribing to class %s, instance %s.\n",
+ tmp,
retnotice->z_class,
retnotice->z_class_inst);
} else {
snprintf(buff, BUFFLEN,
- "%s messages.\n", buff);
+ "Could not send message to %s: "
+ "not logged in or subscribing to messages.\n",
+ tmp);
}
owl_function_adminmsg("", buff);
owl_log_outgoing_zephyr_error(tmp, buff);