|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package POE::Component::IRC::Plugin::URI::Find;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 BEGIN {  | 
| 
3
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
892146
 | 
   $POE::Component::IRC::Plugin::URI::Find::VERSION = '1.10';  | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
5
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
6
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 #ABSTRACT: A POE::Component::IRC plugin that finds URIs in channel traffic  | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
8
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
10
 | 
 use strict;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
37
 | 
    | 
| 
9
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
5
 | 
 use warnings;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
46
 | 
    | 
| 
10
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
5
 | 
 use POE;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
    | 
| 
11
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
550
 | 
 use POE::Component::IRC::Plugin qw(:ALL);  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
2
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
175
 | 
    | 
| 
12
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
1097
 | 
 use URI::Find;  | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
16093
 | 
    | 
| 
 
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
743
 | 
    | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub new {  | 
| 
15
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
1
  
 | 
10192
 | 
   my $package = shift;  | 
| 
16
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4
 | 
   my %args = @_;  | 
| 
17
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
   $args{lc $_} = delete $args{$_} for keys %args;  | 
| 
18
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
   return bless \%args, $package;  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub PCI_register {  | 
| 
22
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
0
  
 | 
767
 | 
   my ($self,$irc) = @_;  | 
| 
23
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
6
 | 
   $irc->plugin_register( $self, 'SERVER', qw(public ctcp_action) );  | 
| 
24
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
50
 | 
   $self->{session_id} = POE::Session->create(  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	object_states => [   | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	   $self => [ qw(_shutdown _start _uri_find _uri_found) ],  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	],  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   )->ID();  | 
| 
29
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
124
 | 
   return 1;  | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub PCI_unregister {  | 
| 
33
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
0
  
 | 
2748
 | 
   my ($self,$irc) = splice @_, 0, 2;  | 
| 
34
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
11
 | 
   $poe_kernel->call( $self->{session_id} => '_shutdown' );  | 
| 
35
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
18
 | 
   delete $self->{irc};  | 
| 
36
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
   return 1;  | 
| 
37
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub S_public {  | 
| 
40
 | 
0
 | 
 
 | 
 
 | 
  
0
  
 | 
  
0
  
 | 
0
 | 
   my ($self,$irc) = splice @_, 0, 2;  | 
| 
41
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my $who = ${ $_[0] };  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
42
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my $channel = ${ $_[1] }->[0];  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
43
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my $what = ${ $_[2] };  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
44
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   $poe_kernel->call( $self->{session_id}, '_uri_find', $irc, $who, $channel, $what );  | 
| 
45
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   return PCI_EAT_NONE;  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
47
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub S_ctcp_action {  | 
| 
49
 | 
0
 | 
 
 | 
 
 | 
  
0
  
 | 
  
0
  
 | 
0
 | 
   my ($self,$irc) = splice @_, 0, 2;  | 
| 
50
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my $who = ${ $_[0] };  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
51
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my $channel = ${ $_[1] }->[0];  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
52
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my $what = ${ $_[2] };  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
53
 | 
0
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   my $chantypes = join('', @{ $irc->isupport('CHANTYPES') || ['#', '&']});  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
54
 | 
0
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   return PCI_EAT_NONE if $channel !~ /^[$chantypes]/;  | 
| 
55
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   $poe_kernel->call( $self->{session_id}, '_uri_find', $irc, $who, $channel, $what );  | 
| 
56
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
   return PCI_EAT_NONE;  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _start {  | 
| 
60
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
194
 | 
   my ($kernel,$self) = @_[KERNEL,OBJECT];  | 
| 
61
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
5
 | 
   $self->{session_id} = $_[SESSION]->ID();  | 
| 
62
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
10
 | 
   $kernel->refcount_increment( $self->{session_id}, __PACKAGE__ );  | 
| 
63
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
38
 | 
   undef;  | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
65
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
66
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _shutdown {  | 
| 
67
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
 
 | 
68
 | 
   my ($kernel,$self) = @_[KERNEL,OBJECT];  | 
| 
68
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
7
 | 
   $kernel->alarm_remove_all();  | 
| 
69
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
86
 | 
   $kernel->refcount_decrement( $self->{session_id}, __PACKAGE__ );  | 
| 
70
 | 
1
 | 
 
 | 
 
 | 
 
 | 
 
 | 
53
 | 
   undef;  | 
| 
71
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
73
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _uri_find {  | 
| 
74
 | 
0
 | 
 
 | 
 
 | 
  
0
  
 | 
 
 | 
 
 | 
   my ($kernel,$session,$self,$irc,$who,$channel,$what) = @_[KERNEL,SESSION,OBJECT,ARG0..ARG3];  | 
| 
75
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my $finder = URI::Find->new( $session->callback( '_uri_found', $irc, $who, $channel, $what ) );  | 
| 
76
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   $finder->find( \$what );  | 
| 
77
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   undef;  | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
79
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub _uri_found {  | 
| 
81
 | 
0
 | 
 
 | 
 
 | 
  
0
  
 | 
 
 | 
 
 | 
   my ($kernel,$self) = @_[KERNEL,OBJECT];  | 
| 
82
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my ($irc,$who,$channel,$what) = @{ $_[ARG0] };  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
83
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   my ($uriurl,$url) = @{ $_[ARG1] };  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
84
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   $irc->send_event( 'irc_urifind_uri', $who, $channel, $url, $uriurl, $what );  | 
| 
85
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
   undef;  | 
| 
86
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
87
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
88
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 q[Find this URL http://cpanidx.org/];  | 
| 
89
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
90
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
91
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |