:pserver:anonymous@intra.tektonica.com:/opt/cvs - gsmperl - Fri Dec 21 07:37 CET...
[gsmperl.git] / GSM / SMS / OTA / VCard.pm
1 package GSM::SMS::OTA::VCard;
2 use GSM::SMS::OTA::OTA;
3
4 # Generic package for VCARDS 
5 # experimental!
6
7 require Exporter;
8 @ISA = qw(Exporter);
9
10 @EXPORT = qw( OTAVcard_makestream
11                           OTAVcard_PORT );
12
13 $VERSION = '0.1';
14
15 use constant OTAVcard_PORT => 9204;
16
17
18 sub OTAVcard_makestream {
19         my ($lastname, $firstname, $phone) = @_;
20
21         $lastname = encode( $lastname );
22         $firstname = encode( $firstname);
23         $phone = encode( $phone );
24
25         $vcard=<<EOT;
26 BEGIN:VCARD
27 VERSION:2.1
28 N:$lastname,$firstname
29 TEL;PREF:$phone
30 END:VCARD
31 EOT
32
33
34         return OTAencode_8bit($vcard);
35 }
36
37 sub encode {
38         my ($string) = @_;
39
40         $string=~s/([,;:])/\\$1/g;
41
42         return $string;
43 }
44
45 1;
46
47 =head1 NAME
48
49 GSM::SMS::OTA::VCard
50
51 =head1 DESCRIPTION
52
53 This package allows you to create a VCard to send an address/phone book item to a handset capable receiving it. This is only tested with a Nokia Phone (7110).
54 Anyway, this module is rather experimental.
55
56 =head1 METHODS
57
58 =head2 OTAVcard_makestream
59
60         $stream = OTAVcard_makestream( $lastname, $firstname, $phone );
61
62 Make a VCard with only name, lastname and (home)phonenumber. A lot more is possible to include, but I think this is sufficient for most uses (?) ... or until somebody motivates me to expand this ...
63
64 =head2 OTAVcard_PORT
65
66 NSB Port number for a VCard message.
67
68 =head1 AUTHOR
69
70 Joha Van den Brande <johan@vandenbrande.com>