ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MessageDistributor.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MessageDistributor.pm (file contents):
Revision 1.1 by elmex, Sun Jan 6 16:28:49 2008 UTC vs.
Revision 1.8 by root, Sat Apr 3 02:58:25 2010 UTC

1package DC::MessageDistributor; 1package DC::MessageDistributor;
2use strict; 2
3no warnings; 3use common::sense;
4 4
5sub new { 5sub 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
32sub activate_console { 33sub activate_console {
34 # nop
33} 35}
34 36
35# adding channel 37# adding channel
36sub add_channel { 38sub add_channel {
37 my ($self, $chaninfo) = @_; 39 my ($self, $chaninfo) = @_;
39 $self->{info}->{$chaninfo->{id}} = $chaninfo; 41 $self->{info}->{$chaninfo->{id}} = $chaninfo;
40 $self->touch_channel ($chaninfo->{id}); 42 $self->touch_channel ($chaninfo->{id});
41} 43}
42 44
43# set max paragraphs 45# set max paragraphs
44sub set_max_para { 46sub set_max_par {
47 my ($self, $par) = @_;
48 for ($self->{log}, values %{$self->{chatview}}) {
49 $_->set_max_par ($par);
50 }
45} 51}
46 52
47# set fontsize 53# set fontsize for all chatviews
48sub set_fontsize { 54sub set_fontsize {
55 my ($self, $s) = @_;
56
57 for ($self->{log}, values %{$self->{chatview}}) {
58 $_->set_fontsize ($s);
59 }
49} 60}
50 61
51# push message in 62# push message in
52sub message { 63sub message {
53 my ($self, $para) = @_; 64 my ($self, $para) = @_;
84 } 95 }
85} 96}
86 97
87sub update_chat { 98sub update_chat {
88 my ($self, $id) = @_; 99 my ($self, $id) = @_;
100
89 $self->{chatview}->{$id}->update_info ($self->{info}->{$id}); 101 $self->{chatview}->{$id}->update_info ($self->{info}->{$id});
90} 102}
91 103
92sub init_chat { 104sub init_chat {
93 my ($self, $id) = @_; 105 my ($self, $id) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines