line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alice::InfoWindow; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use Any::Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
23
|
|
4
|
2
|
|
|
2
|
|
1129
|
use Encode; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
201
|
|
5
|
2
|
|
|
2
|
|
11
|
use IRC::Formatting::HTML qw/irc_to_html/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
90
|
|
6
|
2
|
|
|
2
|
|
12
|
use Text::MicroTemplate qw/encoded_string/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
646
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
extends 'Alice::Window'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has '+title' => (required => 0, default => 'info'); |
11
|
|
|
|
|
|
|
has 'topic' => (is => 'ro', isa => 'HashRef', default => sub {{string => ''}}); |
12
|
|
|
|
|
|
|
has '+network' => (is => 'ro', default => ""); |
13
|
|
|
|
|
|
|
has '+type' => (is => 'ro', default => "info"); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# DO NOT override the 'id' property, it is built in App/Alice.pm |
17
|
|
|
|
|
|
|
# using the user-id, which is important for multiuser systems. |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
2
|
0
|
23
|
sub is_channel {0} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub hashtag { |
23
|
1
|
|
|
1
|
0
|
9
|
my $self = shift; |
24
|
1
|
|
|
|
|
14
|
return "/info"; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub format_message { |
28
|
1
|
|
|
1
|
0
|
10
|
my ($self, $from, $body, %options) = @_; |
29
|
1
|
50
|
|
|
|
58
|
my $html = irc_to_html($body, classes => 1, ($options{monospaced} ? () : (invert => "italic"))); |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
|
|
|
279
|
my $message = { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
32
|
|
|
|
|
|
|
type => "message", |
33
|
|
|
|
|
|
|
event => "say", |
34
|
|
|
|
|
|
|
nick => $from, |
35
|
|
|
|
|
|
|
window => $self->serialized, |
36
|
|
|
|
|
|
|
($options{source} ? (source => $options{source}) : ()), |
37
|
|
|
|
|
|
|
html => encoded_string($html), |
38
|
|
|
|
|
|
|
self => $options{self} ? 1 : 0, |
39
|
|
|
|
|
|
|
hightlight => $options{highlight} ? 1 : 0, |
40
|
|
|
|
|
|
|
msgid => $self->buffer->next_msgid, |
41
|
|
|
|
|
|
|
timestamp => time, |
42
|
|
|
|
|
|
|
monospaced => $options{mono} ? 1 : 0, |
43
|
|
|
|
|
|
|
consecutive => $from eq $self->buffer->previous_nick ? 1 : 0, |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
34
|
$message->{html} = $self->render->("message", $message); |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
4536
|
$self->buffer->add($message); |
49
|
1
|
|
|
|
|
4
|
return $message; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
53
|
|
|
|
|
|
|
1; |