[1056] in BarnOwl Developers
[D-O-H] r1038 - in branches/barnowl_unicode: . owl owl/perl/modules/IRC/lib/BarnOwl/Message owl/perl/modules/IRC/lib/BarnOwl/Module
daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:12:33 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: nelhage@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Fri, 9 May 2008 20:01:05 -0400 (EDT)
Author: nelhage
Date: 2008-05-09 20:01:05 -0400 (Fri, 09 May 2008)
New Revision: 1038
Modified:
branches/barnowl_unicode/
branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm
branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm
branches/barnowl_unicode/owl/perlwrap.pm
Log:
Merged revisions 1033-1037 via svnmerge from
svn+ssh://lunatique.mit.edu/mit/barnowl/src/svn/trunk
........
r1034 | geofft | 2008-05-05 14:56:52 -0400 (Mon, 05 May 2008) | 1 line
IRC: /list, /who, and /stats commands
........
r1035 | geofft | 2008-05-06 01:37:29 -0400 (Tue, 06 May 2008) | 1 line
IRC: Make M-N mostly, rather than completely, useless.
........
r1036 | nelhage | 2008-05-06 20:10:17 -0400 (Tue, 06 May 2008) | 2 lines
Fix two small bugs in styling pointed out by broder
........
r1037 | nelhage | 2008-05-06 20:32:23 -0400 (Tue, 06 May 2008) | 2 lines
Document create_style
........
Property changes on: branches/barnowl_unicode
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-1032
+ /trunk:1-1037
Modified: branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm
===================================================================
--- branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm 2008-05-07 00:32:23 UTC (rev 1037)
+++ branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Message/IRC.pm 2008-05-10 00:01:05 UTC (rev 1038)
@@ -38,8 +38,15 @@
# To a Channel
my $network = $self->network;
my $channel = $self->channel;
- my $filter = "irc-$network-channel-$channel";
- my $ftext = qq{type ^irc\$ and network ^$network\$ and channel ^$channel\$};
+ my $sender = $self->sender;
+ my ($filter, $ftext);
+ if ($inst && $self->body =~ /^(\S+):/) {
+ $filter = "irc-$network-channel-$channel-$sender-$1";
+ $ftext = qq{type ^irc\$ and network ^$network\$ and channel ^$channel\$ and ( sender ^$sender\$ or sender ^$1\$ )};
+ } else {
+ $filter = "irc-$network-channel-$channel";
+ $ftext = qq{type ^irc\$ and network ^$network\$ and channel ^$channel\$};
+ }
BarnOwl::filter("$filter $ftext");
return $filter;
}
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-05-07 00:32:23 UTC (rev 1037)
+++ branches/barnowl_unicode/owl/perl/modules/IRC/lib/BarnOwl/Module/IRC.pm 2008-05-10 00:01:05 UTC (rev 1038)
@@ -113,6 +113,9 @@
BarnOwl::new_command('irc-names' => \&cmd_names);
BarnOwl::new_command('irc-whois' => \&cmd_whois);
BarnOwl::new_command('irc-motd' => \&cmd_motd);
+ BarnOwl::new_command('irc-list' => \&cmd_list);
+ BarnOwl::new_command('irc-who' => \&cmd_who);
+ BarnOwl::new_command('irc-stats' => \&cmd_stats);
}
$BarnOwl::Hooks::startup->add(\&startup);
@@ -145,14 +148,14 @@
);
$host = shift @ARGV or die("Usage: $cmd HOST\n");
if(!$alias) {
- if($host =~ /^(?:irc[.])?(\w+)[.]\w+$/) {
+ if($host =~ /^(?:irc[.])?([\w-]+)[.]\w+$/) {
$alias = $1;
} else {
$alias = $host;
}
}
- $port = shift @ARGV || 6667;
$ssl ||= 0;
+ $port = shift @ARGV || ($ssl ? 6697 : 6667);
}
if(exists $ircnets{$alias}) {
@@ -274,6 +277,29 @@
$conn->conn->motd;
}
+sub cmd_list {
+ my $cmd = shift;
+ my $message = BarnOwl::Style::boldify('Current IRC networks:') . "\n";
+ while (my ($alias, $conn) = each %ircnets) {
+ $message .= ' ' . $alias . ' => ' . $conn->nick . '@' . $conn->server . "\n";
+ }
+ BarnOwl::popless_ztext($message);
+}
+
+sub cmd_who {
+ my $cmd = shift;
+ my $conn = get_connection(\@_);
+ my $who = shift || die("Usage: $cmd <user>\n");
+ $conn->conn->who($who);
+}
+
+sub cmd_stats {
+ my $cmd = shift;
+ my $conn = get_connection(\@_);
+ my $type = shift || die("Usage: $cmd <chiklmouy> [server] \n");
+ $conn->conn->stats($type, @_);
+}
+
################################################################################
########################### Utilities/Helpers ##################################
################################################################################
Modified: branches/barnowl_unicode/owl/perlwrap.pm
===================================================================
--- branches/barnowl_unicode/owl/perlwrap.pm 2008-05-07 00:32:23 UTC (rev 1037)
+++ branches/barnowl_unicode/owl/perlwrap.pm 2008-05-10 00:01:05 UTC (rev 1038)
@@ -132,6 +132,14 @@
Remove a file descriptor previously registered via C<add_dispatch>
+=head2 create_style NAME OBJECT
+
+Creates a new barnowl style with the given NAME defined by the given
+object. The object must have a C<description> method which returns a
+string description of the style, and a and C<format_message> method
+which accepts a C<BarnOwl::Message> object and returns a string that
+is the result of formatting the message for display.
+
=cut
@@ -823,7 +831,7 @@
sub format_ping {
my $self = shift;
my $m = shift;
- return "\@b(PING) from \@b(" . $m->pretty_sender . ")\n";
+ return "\@b(PING) from \@b(" . $m->pretty_sender . ")";
}
sub format_admin {
@@ -922,6 +930,7 @@
}
sub format_ping($) {
+ my $self = shift;
my $m = shift;
return sprintf(
BASE_FORMAT,