source: perl/modules/AIM/lib/Net/OSCAR/Callbacks/3/buddy_status_update.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.3 KB
Line 
1package Net::OSCAR::Callbacks;
2use strict;
3use warnings;
4use vars qw($connection $snac $conntype $family $subtype $data $reqid $reqdata $session $protobit %data);
5sub {
6
7$connection->log_print(OSCAR_DBG_DEBUG, "Incoming bogey - er, I mean buddy - $data{screenname}");
8$session->postprocess_userinfo(\%data);
9my $screenname = $data{screenname};
10
11my($grpname, $group) = $session->findbuddy($screenname);
12return unless $grpname; # Without this, remove_buddy screws things up until signoff/signon
13my $budinfo = $group->{members}->{$screenname};
14
15$data{buddyid} = $budinfo->{buddyid};
16$data{online} = 1;
17foreach my $key(keys %data) {
18        next if $key eq "__UNKNOWN";
19        $budinfo->{$key} = delete $data{$key};
20}
21if(exists($budinfo->{idle}) and !exists($data{idle})) {
22        delete $budinfo->{idle};
23        delete $budinfo->{idle_since};
24}
25
26# Sync $session->{userinfo}->{$foo} with buddylist entry
27if(exists($session->{userinfo}->{$screenname})) {
28        if($session->{userinfo}->{$screenname} != $budinfo)  {
29                my $info = $session->{userinfo}->{$screenname};
30                foreach my $key(keys %$info) {
31                        $budinfo->{$key} = $info->{$key};
32                }
33                $session->{userinfo}->{$screenname} = $budinfo;
34        }
35} else {
36        $session->{userinfo}->{$screenname} = $budinfo;
37}
38$session->callback_buddy_in($screenname, $grpname, $budinfo);
39
40};
Note: See TracBrowser for help on using the repository browser.