root/feedmelinks/aim/bot/klaus.pl

Revision 1425, 1.5 kB (checked in by jm3, 2 years ago)

gulp. svn diff for the deltas

  • Property svn:executable set to *
Line 
1 #!/usr/local/bin/perl
2 use strict;
3 use Module::Reload;
4 use Net::OSCAR qw(:standard :loglevels);
5 use Data::Dumper;
6 use FeedMeLinks::Environment;
7 use FeedMeLinks::Bot;
8
9 # $Id$
10 # FML AIM bot
11
12 my $aimbot = Net::OSCAR->new(capabilities => [qw(buddy_icons typing_status)]);
13
14 $aimbot->loglevel( OSCAR_DBG_NOTICE );
15 $aimbot->set_callback_im_in(\&respond); 
16 print FeedMeLinks::Environment::get_aim_bot_user() . "\n";
17 print FeedMeLinks::Environment::get_aim_bot_password() . "\n";;
18 $aimbot->signon( FeedMeLinks::Environment::get_aim_bot_user(), FeedMeLinks::Environment::get_aim_bot_password() );
19
20 # doesn't work
21 #open( ICON, "48x48heart.gif" ) || die("can't open icon file: $!");
22 #binmode( ICON );
23 #my @icon = <ICON>;  #Read the file into an array
24 #$aimbot->set_icon( @icon );
25 #print "attempting to load icon...\n";
26 #close( ICON );
27 #$aimbot->commit_buddylist();
28
29 # global
30 my $sessions_ref;
31
32 sub respond {
33         my ($aim, $sender, $message, $away) = @_;
34        
35         print "respond called\n";
36
37         # has to happen at the main klaus level so we can force a reload of all the other commands in the module
38         if( $message =~ m/reload/ ) {
39                 if( $sender eq "jm3theDestroyer" || $sender eq "jm3bottester" ) {
40                         Module::Reload->check;
41                         $sessions_ref = {};
42                         $aim->send_im($sender, "Reloaded code and flushed sessions table\n" . FeedMeLinks::Bot::get_version());
43                 } else {
44                         $aim->send_im($sender, "(you are not a super-user)" );
45                 }
46         } else {
47                 $sessions_ref = FeedMeLinks::Bot::handle_response( $aim, $sender, $message, $away, $sessions_ref);
48         }
49 } 
50
51 while(1) {
52         $aimbot->do_one_loop();
53 }
54
55 exit 0;
Note: See TracBrowser for help on using the browser.