Changeset dace02a for perl/modules/IRC/lib
- Timestamp:
- Apr 3, 2011, 3:06:02 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- ab6d8f0
- Parents:
- b9a642a
- git-author:
- Nelson Elhage <nelhage@mit.edu> (03/12/11 11:41:48)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (04/03/11 15:06:02)
- Location:
- perl/modules/IRC/lib/BarnOwl/Module
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
r3713b86 rdace02a 30 30 # Hash alias -> BarnOwl::Module::IRC::Connection object 31 31 our %ircnets; 32 our %channels;33 32 34 33 sub startup { … … 96 95 $list .= "\n"; 97 96 98 for my $chan (keys %channels) { 99 next unless grep $_ eq $conn, @{$channels{$chan}}; 97 for my $chan (keys %{$conn->conn->{channel_list}}) { 100 98 $list .= " $chan\n"; 101 99 } … … 466 464 my $conn = shift; 467 465 my $chan = shift or die("Usage: $cmd channel\n"); 468 $channels{$chan} ||= [];469 push @{$channels{$chan}}, $conn;470 466 $conn->conn->send_msg(join => $chan, @_); 471 467 return; … … 476 472 my $conn = shift; 477 473 my $chan = shift; 478 $channels{$chan} = [grep {$_ ne $conn} @{$channels{$chan} || []}];479 474 $conn->conn->send_msg(part => $chan); 480 475 return; … … 557 552 ########################### Utilities/Helpers ################################## 558 553 ################################################################################ 554 555 sub find_channel { 556 my $channel = shift; 557 my @found; 558 for my $conn (values %ircnets) { 559 if($conn->conn->{channel_list}{lc $channel}) { 560 push @found, $conn; 561 } 562 } 563 return $found[0] if(scalar @found == 1); 564 } 559 565 560 566 sub mk_irc_command { … … 580 586 $channel = $ARGV[0]; 581 587 if(defined($channel) && $channel =~ /^#/) { 582 if( $channels{$channel} && @{$channels{$channel}} == 1) {588 if(my $c = find_channel($channel)) { 583 589 shift @ARGV; 584 $conn = $channels{$channel}[0] unless $conn;590 $conn ||= $c; 585 591 } 586 592 } elsif ($m && $m->type eq 'IRC' && !$m->is_private) { -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Completion.pm
r955a36e rdace02a 11 11 sub complete_networks { keys %BarnOwl::Module::IRC::ircnets } 12 12 sub complete_dests { keys %users, complete_channels() } 13 sub complete_channels { keys %BarnOwl::Module::IRC::channels } 13 sub complete_channels { 14 my %channels; 15 for my $conn (values %BarnOwl::Module::IRC::ircnets) { 16 for my $chan (keys %{$conn->conn->{channel_list}}) { 17 $channels{$chan} = 1; 18 } 19 } 20 return keys %channels; 21 } 14 22 sub complete_nicks { keys %users } 15 23 sub complete_servers { keys %servers } -
perl/modules/IRC/lib/BarnOwl/Module/IRC/Connection.pm
rb9a642a rdace02a 452 452 my $backoff = shift; 453 453 454 $self->autoconnect_channels([keys(%{$self-> channel_list})]);454 $self->autoconnect_channels([keys(%{$self->{channel_list}})]); 455 455 $self->conn->connect; 456 456 if ($self->conn->connected) {
Note: See TracChangeset
for help on using the changeset viewer.