init commit
[urisagit/Stem.git] / lib / Stem / ChatLabel.pm
1 package Stem::ChatLabel ;
2
3 use strict ;
4
5
6 my $attr_spec = [
7
8         {
9                 'name'          => 'sw_addr',
10                 'help'          => <<HELP,
11 This is the address of the chat switch
12 HELP
13         },
14 ] ;
15
16 sub new {
17
18         my( $class ) = shift ;
19
20         my $self = Stem::Class::parse_args( $attr_spec, @_ ) ;
21         return $self unless ref $self ;
22
23         return $self ;
24 }
25
26 sub data_in {
27
28         my ( $self, $msg ) = @_ ;
29
30         my $data = $msg->data() ;
31
32 #print "$$data" ;
33
34         substr( $$data, 0, 0, $msg->from_cell() . ': ' ) ;
35
36         $msg->data( $data ) ;
37         $msg->to_cell( $self->{'sw_addr'} ) ;
38
39         $msg->dispatch() ;
40 }
41
42 1 ;