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
21 my $self = SUPER->new($pkg);
22 $self->{from} = shift;
23 $self->{to} = shift; # is TO if {to} is blank
24 $self->{text} = shift;
25 $self->{flag} = shift;
27 $self->{origin} = shift;
29 # sort out the to/via dillema and do some validation
30 if (is_callsign($auxto)) {
31 $self->{via} = $self->{to};
33 return undef unless is_callsign($self->{via});
35 return undef unless is_callsign($self->{from}) && is_callsign($self->{to}) && is_callsign($self->{origin}) && is_pctext($self->{text}) && is_pcflag($self->{flag});
41 my $addra = $self->{via} || $self->{to};
42 my $addrb = exists $self->{via} ? $self->{to} : ' ';
43 return "PC10^$self->{from}^$addra^$self->{text}^$self->{flag}^$addrb^$self->{origin}^~";