2 # OO version of all the PC protocol stuff
4 # Here is done all reception, validation and generation of PC
7 # This uses the Prot class as a basis for all
12 use vars qw($VERSION $BRANCH);
13 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
14 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
15 $main::build += $VERSION;
16 $main::branch += $BRANCH;
28 my $self = SUPER->new($pkg);
29 $self->{from} = shift;
30 $self->{to} = shift; # is TO if {to} is blank
31 $self->{text} = shift;
32 $self->{flag} = shift;
34 $self->{origin} = shift;
36 # sort out the to/via dillema and do some validation
37 if (is_callsign($auxto)) {
38 $self->{via} = $self->{to};
40 return undef unless is_callsign($self->{via});
42 return undef unless is_callsign($self->{from}) && is_callsign($self->{to}) && is_callsign($self->{origin}) && is_pctext($self->{text}) && is_pcflag($self->{flag});
48 my $addra = $self->{via} || $self->{to};
49 my $addrb = exists $self->{via} ? $self->{to} : ' ';
50 return "PC10^$self->{from}^$addra^$self->{text}^$self->{flag}^$addrb^$self->{origin}^~";