source: perl/modules/IRC/lib/BarnOwl/Message/IRC.pm @ 2c40dc0

barnowl_perlaimdebianrelease-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 2c40dc0 was 2c40dc0, checked in by Geoffrey Thomas <geofft@mit.edu>, 13 years ago
Added support for channels in IRC. After you :irc-connect to a server, you can :irc-join #channel, and then :irc-msg either a user or a #channel. Replies, isprivate, and context should work vaguely as expected.
  • Property mode set to 100644
File size: 995 bytes
Line 
1use warnings;
2use strict;
3
4=head1 NAME
5
6BarnOwl::Message::IRC
7
8=head1 DESCRIPTION
9
10A subclass of BarnOwl::Message for IRC messages
11
12=cut
13
14package BarnOwl::Message::IRC;
15
16use base qw( BarnOwl::Message );
17
18sub smartfilter {
19    my $self = shift;
20    my $inst = shift;
21
22    my ($filter, $ftext);
23
24    if($self->is_private) {
25        my $who;
26        if($self->direction eq 'out') {
27            $who = $self->recipient;
28        } else {
29            $who = $self->sender;
30        }
31        $filter = "irc-user-$who";
32        my $ftext  =
33             qq{type ^irc\$ and ( ( direction ^in\$ and sender ^$who\$ ) }
34           . qq{or ( direction ^out\$ and recipient ^$who\$ ) ) };
35        BarnOwl::filter("$filter $ftext");
36        return $filter;
37    } else {
38        # Unimplemented
39        return undef;
40    }
41}
42
43sub server {shift->{server}}
44sub network {shift->{network}}
45
46# display
47sub context {shift->{network};}
48sub subcontext {shift->{recipient};}
49
50sub long_sender {shift->{from} || ""};
51
52
531;
Note: See TracBrowser for help on using the repository browser.