line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Alice::InfoWindow; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
23
|
use Any::Moose; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
35
|
|
4
|
4
|
|
|
4
|
|
2116
|
use Encode; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
402
|
|
5
|
4
|
|
|
4
|
|
22
|
use IRC::Formatting::HTML qw/irc_to_html/; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
263
|
|
6
|
4
|
|
|
4
|
|
20
|
use Text::MicroTemplate qw/encoded_string/; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
2100
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'App::Alice::Window'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has '+is_channel' => (lazy => 0, default => 0); |
11
|
|
|
|
|
|
|
has '+title' => (required => 0, default => 'info'); |
12
|
|
|
|
|
|
|
has '+session' => (default => ""); |
13
|
|
|
|
|
|
|
has 'topic' => (is => 'ro', isa => 'HashRef', default => sub {{string => ''}}); |
14
|
|
|
|
|
|
|
has '+type' => (lazy => 0, default => 'info'); |
15
|
|
|
|
|
|
|
has '+_irc' => (required => 0, isa => 'Any'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub irc { |
18
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
19
|
0
|
0
|
|
|
|
0
|
return ($self->app->connected_ircs)[0] if $self->app->connected_ircs == 1; |
20
|
0
|
|
|
|
|
0
|
$self->app->broadcast( |
21
|
|
|
|
|
|
|
$self->format_announcement("No server specified! /command -server args")); |
22
|
0
|
|
|
|
|
0
|
return undef; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub all_nicks { |
26
|
0
|
|
|
0
|
0
|
0
|
return []; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub format_message { |
30
|
9
|
|
|
9
|
0
|
25
|
my ($self, $from, $body, %options) = @_; |
31
|
9
|
|
|
|
|
52
|
my $html = irc_to_html($body); |
32
|
9
|
50
|
|
|
|
704
|
my $message = { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
33
|
|
|
|
|
|
|
type => "message", |
34
|
|
|
|
|
|
|
event => "say", |
35
|
|
|
|
|
|
|
nick => $from, |
36
|
|
|
|
|
|
|
window => $self->serialized, |
37
|
|
|
|
|
|
|
html => encoded_string($html), |
38
|
|
|
|
|
|
|
self => $options{self} ? 1 : 0, |
39
|
|
|
|
|
|
|
hightlight => $options{highlight} ? 1 : 0, |
40
|
|
|
|
|
|
|
msgid => $self->app->next_msgid, |
41
|
|
|
|
|
|
|
timestamp => time, |
42
|
|
|
|
|
|
|
monospaced => $options{mono} ? 1 : 0, |
43
|
|
|
|
|
|
|
consecutive => $from eq $self->buffer->previous_nick ? 1 : 0, |
44
|
|
|
|
|
|
|
}; |
45
|
9
|
|
|
|
|
134
|
$message->{html} = $self->app->render("message", $message); |
46
|
9
|
|
|
|
|
36815
|
$self->buffer->add($message); |
47
|
9
|
|
|
|
|
80
|
return $message; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub copy_message { |
51
|
0
|
|
|
0
|
0
|
|
my ($self, $msg) = @_; |
52
|
0
|
0
|
|
|
|
|
my $copy = { |
53
|
|
|
|
|
|
|
type => "message", |
54
|
|
|
|
|
|
|
event => "say", |
55
|
|
|
|
|
|
|
nick => $msg->{nick}, |
56
|
|
|
|
|
|
|
window => $self->serialized, |
57
|
|
|
|
|
|
|
html => $msg->{html}, |
58
|
|
|
|
|
|
|
self => $msg->{self}, |
59
|
|
|
|
|
|
|
highlight => $msg->{highlight}, |
60
|
|
|
|
|
|
|
msgid => $self->app->next_msgid, |
61
|
|
|
|
|
|
|
timestamp => $msg->{timestamp}, |
62
|
|
|
|
|
|
|
monospaced => $msg->{monospaced}, |
63
|
|
|
|
|
|
|
consecutive => $msg->{nick} eq $self->buffer->previous_nick ? 1 : 0, |
64
|
|
|
|
|
|
|
}; |
65
|
0
|
0
|
0
|
|
|
|
if ($msg->{consecutive} and !$copy->{consecutive}) { |
|
|
0
|
0
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$copy->{html} =~ s/(
|
67
|
|
|
|
|
|
|
} elsif (!$msg->{consecutive} and $copy->{consecutive}) { |
68
|
0
|
|
|
|
|
|
$copy->{html} =~ s/(
69
|
|
|
|
|
|
|
} |
70
|
0
|
|
|
|
|
|
$self->buffer->add($copy); |
71
|
0
|
|
|
|
|
|
return $copy; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
75
|
|
|
|
|
|
|
1; |