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