source: perl/modules/AIM/lib/Net/OSCAR/Connection/Chat.pm @ 7a1c90d

barnowl_perlaim
Last change on this file since 7a1c90d was 7a1c90d, checked in by Geoffrey Thomas <geofft@mit.edu>, 16 years ago
Skeleton AIM module, and Net::OSCAR 1.925
  • Property mode set to 100644
File size: 1.5 KB
Line 
1=pod
2
3Net::OSCAR::Connection::Chat -- OSCAR chat connections
4
5=cut
6
7package Net::OSCAR::Connection::Chat;
8
9$VERSION = '1.925';
10$REVISION = '$Revision: 1.10 $';
11
12use strict;
13use Carp;
14
15use Net::OSCAR::TLV;
16use Net::OSCAR::Callbacks;
17use vars qw(@ISA $VERSION);
18use Net::OSCAR::Common qw(:all);
19use Net::OSCAR::Constants;
20use Net::OSCAR::Utility;
21use Net::OSCAR::XML;
22@ISA = qw(Net::OSCAR::Connection);
23
24sub invite($$;$) {
25        my($self, $who, $message) = @_;
26        $message ||= "Join me in this Buddy Chat";
27
28        $self->log_print(OSCAR_DBG_DEBUG, "Inviting $who to join us.");
29
30        my $svcdata = protoparse($self, "chat_invite_rendezvous_data")->pack(
31                exchange => $self->{exchange},
32                url => $self->{url}
33        );
34
35        my $cookie = randchars(8);
36        my %rvdata = (
37                capability => OSCAR_CAPS()->{chat}->{value},
38                charset => "us-ascii",
39                cookie => $cookie,
40                invitation_msg => $message,
41                push_pull => 1,
42                status => "propose",
43                svcdata => $svcdata
44        );
45
46        return $self->{session}->send_message($who, 2, protoparse($self, "rendezvous_IM")->pack(%rvdata), 0, $cookie);
47}
48
49sub chat_send($$;$$) {
50        my($self, $msg, $noreflect, $away) = @_;
51
52        my %protodata = (
53                cookie => randchars(8),
54                message => $msg
55        );
56        $protodata{reflect} = "" unless $noreflect;
57        $protodata{is_automatic} = "" if $away;
58
59        $self->proto_send(protobit => "outgoing_chat_IM", protodata => \%protodata);
60}
61
62sub part($) { shift->disconnect(); }   
63sub url($) { shift->{url}; }
64sub name($) { shift->{name}; }
65sub exchange($) { shift->{exchange}; }
66
671;
Note: See TracBrowser for help on using the repository browser.