source: perl/modules/AIM/lib/Net/OSCAR/ServerCallbacks/23/initial_signon_request.pm @ 3dcccba

barnowl_perlaim
Last change on this file since 3dcccba was 7a1c90d, checked in by Geoffrey Thomas <geofft@mit.edu>, 14 years ago
Skeleton AIM module, and Net::OSCAR 1.925
  • Property mode set to 100644
File size: 880 bytes
Line 
1package Net::OSCAR::ServerCallbacks;
2use strict;
3use warnings;
4use vars qw($SESSIONS $SCREENNAMES %COOKIES $screenname $connection $snac $conntype $family $subtype $data $reqid $reqdata $session $protobit %data);
5sub {
6
7if(exists($SCREENNAMES->{$data{screenname}})) {
8        $screenname = $data{screenname};
9        my $key = sprintf("%08d", int(rand(99999999)));
10        print "$screenname would like to sign on.  Generated key '$key'\n";
11
12        $SESSIONS->{$screenname} ||= {};
13        $SESSIONS->{$screenname}->{keys} ||= {};
14        $SESSIONS->{$screenname}->{sessions} ||= [];
15        $SESSIONS->{$screenname}->{status} ||= {
16                online => 0,
17        };
18
19        $SESSIONS->{$screenname}->{keys}->{$key} = 1;
20        $connection->proto_send(protobit => "authentication_key", protodata => {key => $key});
21} else {
22        $connection->proto_send(protobit => "authorization_response", protodata => {error => 1});
23        $session->delconn($connection);
24}
25
26};
27
Note: See TracBrowser for help on using the repository browser.