1 | package DC::MessageDistributor; |
1 | package DC::MessageDistributor; |
2 | use strict; |
2 | |
3 | no warnings; |
3 | use common::sense; |
4 | |
4 | |
5 | sub new { |
5 | sub new { |
6 | my $this = shift; |
6 | my $this = shift; |
7 | my $class = ref($this) || $this; |
7 | my $class = ref($this) || $this; |
8 | my $self = { @_ }; |
8 | my $self = { @_ }; |
… | |
… | |
12 | $self->{log} = DC::UI::ChatView->new ( |
12 | $self->{log} = DC::UI::ChatView->new ( |
13 | expand => 1, |
13 | expand => 1, |
14 | can_close => 0, |
14 | can_close => 0, |
15 | can_undock => 0, |
15 | can_undock => 0, |
16 | info => { |
16 | info => { |
|
|
17 | id => "", |
17 | title => "Log", |
18 | title => "Log", |
18 | tooltip => |
|
|
19 | "<b>Server Log</b>. This text viewer contains all recent message sent by the server.", |
19 | tooltip => "<b>Server Log</b>. This text viewer contains all recent message sent by the server.", |
20 | entry_tooltip => |
|
|
21 | "<b>Command Entry</b>. If you enter something and press return/enter here, " |
20 | entry_tooltip => "<b>Command Entry</b>. If you enter something and press return/enter here, " |
22 | ."the line you entered will be sent to the server as a command.", |
21 | . "the line you entered will be sent to the server as a command.", |
23 | reply => '' |
22 | reply => '' |
24 | } |
23 | } |
25 | ) |
24 | ) |
26 | ); |
25 | ); |
|
|
26 | |
|
|
27 | $self->{dockbar}->select_dockable ($self->{log}); |
27 | |
28 | |
28 | return $self |
29 | return $self |
29 | } |
30 | } |
30 | |
31 | |
31 | # called by MAPWIDGET activate console event |
32 | # called by MAPWIDGET activate console event |
… | |
… | |
41 | $self->touch_channel ($chaninfo->{id}); |
42 | $self->touch_channel ($chaninfo->{id}); |
42 | } |
43 | } |
43 | |
44 | |
44 | # set max paragraphs |
45 | # set max paragraphs |
45 | sub set_max_par { |
46 | sub set_max_par { |
46 | # nop |
47 | my ($self, $par) = @_; |
|
|
48 | for ($self->{log}, values %{$self->{chatview}}) { |
|
|
49 | $_->set_max_par ($par); |
|
|
50 | } |
47 | } |
51 | } |
48 | |
52 | |
49 | # set fontsize for all chatviews |
53 | # set fontsize for all chatviews |
50 | sub set_fontsize { |
54 | sub set_fontsize { |
51 | my ($self, $s) = @_; |
55 | my ($self, $s) = @_; |
… | |
… | |
91 | } |
95 | } |
92 | } |
96 | } |
93 | |
97 | |
94 | sub update_chat { |
98 | sub update_chat { |
95 | my ($self, $id) = @_; |
99 | my ($self, $id) = @_; |
|
|
100 | |
96 | $self->{chatview}->{$id}->update_info ($self->{info}->{$id}); |
101 | $self->{chatview}->{$id}->update_info ($self->{info}->{$id}); |
97 | } |
102 | } |
98 | |
103 | |
99 | sub init_chat { |
104 | sub init_chat { |
100 | my ($self, $id) = @_; |
105 | my ($self, $id) = @_; |