debianrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change
on this file since 4789b17 was
4789b17,
checked in by Geoffrey Thomas <geofft@mit.edu>, 16 years ago
|
IRC: Add /quit display support
|
-
Property mode set to
100644
|
File size:
1.9 KB
|
Line | |
---|
1 | use warnings; |
---|
2 | use strict; |
---|
3 | |
---|
4 | =head1 NAME |
---|
5 | |
---|
6 | BarnOwl::Message::IRC |
---|
7 | |
---|
8 | =head1 DESCRIPTION |
---|
9 | |
---|
10 | A subclass of BarnOwl::Message for IRC messages |
---|
11 | |
---|
12 | =cut |
---|
13 | |
---|
14 | package BarnOwl::Message::IRC; |
---|
15 | |
---|
16 | use base qw( BarnOwl::Message ); |
---|
17 | |
---|
18 | sub 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 filter personal and } |
---|
34 | . qq{( ( direction ^in\$ and sender ^$who\$ ) or ( direction ^out\$ and recipient ^$who\$ ) ) ) }; |
---|
35 | BarnOwl::filter("$filter $ftext"); |
---|
36 | return $filter; |
---|
37 | } else { |
---|
38 | # To a Channel |
---|
39 | my $network = $self->network; |
---|
40 | my $channel = $self->channel; |
---|
41 | my $sender = $self->sender; |
---|
42 | my ($filter, $ftext); |
---|
43 | if ($inst && $self->body =~ /^(\S+):/) { |
---|
44 | $filter = "irc-$network-channel-$channel-$sender-$1"; |
---|
45 | $ftext = qq{type ^irc\$ and network ^$network\$ and channel ^$channel\$ and ( sender ^$sender\$ or sender ^$1\$ )}; |
---|
46 | } else { |
---|
47 | $filter = "irc-$network-channel-$channel"; |
---|
48 | $ftext = qq{type ^irc\$ and network ^$network\$ and channel ^$channel\$}; |
---|
49 | } |
---|
50 | BarnOwl::filter("$filter $ftext"); |
---|
51 | return $filter; |
---|
52 | } |
---|
53 | } |
---|
54 | |
---|
55 | sub server {shift->{server}} |
---|
56 | sub network {shift->{network}} |
---|
57 | sub channel {shift->{channel}} |
---|
58 | sub action {shift->{action}} |
---|
59 | sub reason {shift->{reason}} |
---|
60 | |
---|
61 | # display |
---|
62 | sub context {shift->{network};} |
---|
63 | sub subcontext {shift->{recipient};} |
---|
64 | |
---|
65 | sub long_sender {shift->{from} || ""}; |
---|
66 | |
---|
67 | sub login_type { |
---|
68 | my $self = shift; |
---|
69 | return " (" . uc $self->action . ")"; |
---|
70 | } |
---|
71 | |
---|
72 | sub login_extra { |
---|
73 | my $self = shift; |
---|
74 | if ($self->action eq "quit") { |
---|
75 | return $self->reason; |
---|
76 | } else { |
---|
77 | return $self->channel; |
---|
78 | } |
---|
79 | } |
---|
80 | |
---|
81 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.