Posted By


sudarkoff on 07/12/06

Tagged


Statistics


Viewed 284 times
Favorited by 0 user(s)

AIM autoresponder


/ Published in: Perl
Save to your folder(s)

I no longer use ICQ, but I still have dozens of contacts there. To let them know of other ways to contact me I wrote this little script.


Copy this code and paste it in your HTML
  1. #!/usr/bin/perl
  2.  
  3. use warnings;
  4. use strict;
  5. use Net::OSCAR qw(:standard);
  6.  
  7. my $screenname = 'screenname';
  8. my $password = 'password';
  9. my $logfile = '~/aimbot.log';
  10.  
  11. my $oscar;
  12. $oscar = Net::OSCAR->new(capabilities => [qw(extended_status)]);
  13. $oscar->set_callback_im_in(\&im_in);
  14. $oscar->signon($screenname, $password);
  15. while(1) { $oscar->do_one_loop(); }
  16.  
  17. sub im_in {
  18. my($oscar, $sender, $message, $is_away) = @_;
  19.  
  20. # respond to the poor soul still using ICQ
  21. my $response = "Sorry, I am no longer using ICQ. " .
  22. "If you need to contact me, try sending me an " .
  23. "email/Jabber/GTalk message at 'me\@domain.com'. " .
  24. "(This is an automated response.)\n";
  25. $oscar->send_im($sender, $response);
  26.  
  27. # save the message to the log-file
  28. open (LOG, ">>$logfile") or print "Oops, can't open logfile.\a\n";
  29. print LOG scalar(localtime)." [AWAY] " if $is_away;
  30. print LOG scalar(localtime).(" "x8)."$sender: $message\n";
  31. close LOG
  32. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.