[844] in BarnOwl Developers
[D-O-H] r834 - in trunk/owl: . perl/modules/IRC/lib/BarnOwl/Module
daemon@ATHENA.MIT.EDU (chmrr@MIT.EDU)
Thu Oct 29 18:10:19 2009
Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: chmrr@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU
Date: Fri, 11 Jan 2008 17:11:01 -0500
Author: chmrr
Date: 2008-01-11 17:11:00 -0500 (Fri, 11 Jan 2008)
New Revision: 834
Modified:
trunk/owl/
trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
Log:
r1876@utwig: chmrr | 2008-01-11 17:08:47 -0500
* Default connections on a per-channel-name basis
Property changes on: trunk/owl
___________________________________________________________________
Name: svk:merge
- 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1823
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:20981
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/branches/par:19594
fe09232e-8620-0410-8e36-e6b4839e121d:/branches/par:688
+ 06e3988a-d725-0410-af47-c5dd11e74598:/local/barnowl:1876
8baf6839-b125-0410-9df9-922793c80423:/local/barnowl:20981
8baf6839-b125-0410-9df9-922793c80423:/local/owl:15641
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/branches/par:19594
fe09232e-8620-0410-8e36-e6b4839e121d:/branches/par:688
Modified: trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
===================================================================
--- trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-01-11 20:32:14 UTC (rev 833)
+++ trunk/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-01-11 22:11:00 UTC (rev 834)
@@ -27,6 +27,7 @@
# Hash alias -> BarnOwl::Module::IRC::Connection object
our %ircnets;
+our %channels;
sub startup {
BarnOwl::new_variable_string('irc:nick', {
@@ -209,6 +210,8 @@
my $cmd = shift;
my $conn = get_connection(\@_);
my $chan = shift or die("Usage: $cmd channel\n");
+ $channels{$chan} ||= [];
+ push @{$channels{$chan}}, $conn;
$conn->join($chan);
}
@@ -216,6 +219,7 @@
my $cmd = shift;
my $conn = get_connection(\@_);
my $chan = get_channel(\@_) || die("Usage: $cmd <channel>\n");
+ $channels{$chan} = [grep {$_ ne $conn} @{$channels{$chan} || []}];
$conn->part($chan);
}
@@ -250,6 +254,10 @@
shift @$args;
return get_connection_by_alias(shift @$args);
}
+ my $channel = $args->[-1];
+ if ($channel =~ /^#/ and $channels{$channel} and @{$channels{$channel}} == 1) {
+ return $channels{$channel}[0];
+ }
my $m = BarnOwl::getcurmsg();
if($m && $m->type eq 'IRC') {
return get_connection_by_alias($m->network);