wraith.pl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. use Irssi 20020121.2020 ();
  2. $VERSION = "1.01";
  3. %IRSSI = (
  4. authors => 'bryan P38',
  5. contact => 'bryan\@shatow.net, bryan on EFnet',
  6. name => 'wraith-auth',
  7. description => 'private auth script for botpack wraith',
  8. license => 'ALL?',
  9. url => 'http://wraith.botpack.net/wiki/AuthSystem',
  10. changed => '$Date$ ',
  11. );
  12. use Irssi::Irc; # for DCC object
  13. use Digest::MD5 qw(md5 md5_hex md5_base64);
  14. use Encode qw(encode_utf8);
  15. sub cmd_auth {
  16. my($data,$server,$witem) = @_;
  17. Irssi::print auth($data);
  18. }
  19. sub auth($$$) {
  20. my($data,$server,$witem) = @_;
  21. my ($secpass,$authkey,$password,$botdump);
  22. $secpass = Irssi::settings_get_str('auth_secpass');
  23. $authkey = Irssi::settings_get_str('auth_authkey');
  24. $password = Irssi::settings_get_str('auth_password');
  25. $botdump = $data . $secpass . $authkey ;
  26. return md5_hex(encode_utf8($botdump));
  27. }
  28. Irssi::settings_add_str('auth', 'auth_password', '');
  29. Irssi::settings_add_str('auth', 'auth_secpass', '');
  30. Irssi::settings_add_str('auth', 'auth_authkey', '');
  31. Irssi::command_bind("auth", "cmd_auth");
  32. =comment
  33. #Irssi::signal_add_priority("message private", \&message, Irssi::SIGNAL_PRIORITY_LOW + 1);
  34. #Irssi::signal_add_priority("dcc request", \&dcc_request, Irssi::SIGNAL_PRIORITY_LOW + 1);
  35. =cut