+sub handle
+{
+ my $thing = shift;
+ my $dxchan = shift;
+
+ # verify authenticity
+ if ($dxchan->call eq $thing->{origin}) {
+ if ($verify_on_login) {
+ my $pp = $dxchan->user->passphrase;
+ unless ($pp) {
+ dbglog('err', "Thingy::Hello::handle: verify on and $thing->{origin} has no passphrase");
+ $dxchan->disconnect;
+ return;
+ }
+ my $auth = Verify->new("DXSp,$thing->{origin},$thing->{s},$thing->{v},$thing->{b}");
+ unless ($auth->verify($thing->{auth}, $dxchan->user->passphrase)) {
+ dbglog('err', "Thingy::Hello::handle: verify on and $thing->{origin} failed auth check");
+ $dxchan->disconnect;
+ return;
+ }
+ }
+ if ($dxchan->{state} ne 'normal') {
+ $dxchan->start($dxchan->{conn}->{csort}, $dxchan->{conn}->{outbound} ? 'O' : 'A');
+ if ($dxchan->{outbound}) {
+ my $thing = Thingy::Hello->new();
+ $thing->send($dxchan);
+ }
+ }
+ }
+ $thing->broadcast($dxchan);
+}
+
+sub new