Bladeren bron

Updates

svn: 51
Bryan Drewery 23 jaren geleden
bovenliggende
commit
61a5093be1
2 gewijzigde bestanden met toevoegingen van 66 en 12 verwijderingen
  1. 1 3
      scripts/BitchX/wraith.bx
  2. 65 9
      scripts/irssi/wraith.pl

+ 1 - 3
scripts/BitchX/wraith.bx

@@ -8,13 +8,11 @@
 # $pass is the DEFPASS setting from your pack.cfg
 
 #change this to your homedir.
-assign wpath /home/admin/bryan
+assign wpath /home/wheel/bryan
 
 #put the 'md5' binary in $HOME/.BitchX/md5 
 
 
-#        if ($2 == "") {
-#        }
 
 alias setauth {
         if ([$2] == "") {

+ 65 - 9
scripts/irssi/wraith.pl

@@ -19,21 +19,81 @@ use Encode qw(encode_utf8);
 
 sub cmd_auth {
   my($data,$server,$witem) = @_;
-  Irssi::print auth($data);
+  if (!$data) {
+    Irssi:print "Usage: /auth hash\nbefore you can do that, type /set auth, then /set all of the variables that show.\n";
+  } else {
+    Irssi::print auth($data);
+  }
 }
 
 
-sub auth($$$) {
+sub auth($) {
   my($data,$server,$witem) = @_;
-  my ($secpass,$authkey,$password,$botdump);
+  my ($secpass,$authkey,$botdump,$hash);
+  #lets use the right word for the hash.
+  my @words = split " ", $data;
+  if ($data =~ /^\-Auth/) {
+    $hash = $words[1];
+  } else {
+    $hash = $words[0];
+  }
+
+  Irssi::print "Authing: $hash";
+
   $secpass = Irssi::settings_get_str('auth_secpass');
   $authkey = Irssi::settings_get_str('auth_authkey');
-  $password = Irssi::settings_get_str('auth_password');
-  $botdump = $data . $secpass . $authkey ;
+  $botdump = $hash . $secpass . $authkey ;
   return md5_hex(encode_utf8($botdump));
 }
 
+#this must handle both auth. and -Auth
+Irssi::signal_add "message private", sub {
+    my ($server, $text, $nick, $address, $target) = @_;
+    my ($msg, $data, $password);
+    my (@servers) = Irssi::servers();
+
+    if ($msg =~ /^\255\251\001/) {
+      $msg = substr($text,3);
+    } else {
+      $msg = $text;
+    }
+
+#    if ($nick =~ /^\(/) { #this is a psybnc dcc chat.
+#    } else { #normal msg
+#      $password = Irssi::settings_get_str('auth_password');
+#      if ($msg =~ /^auth\./) { #msg back password
+#        send auth $password;
+#      }
+#    }
+
+    if ($msg =~ /^\-Auth/) {
+      $server = $servers[0];
+      my $cmd = "/MSG $nick +Auth " . auth($msg);
+      $server->command("$cmd");
+    }  
+};
+
+#this must handle -Auth
+Irssi::signal_add "dcc chat message", sub {
+  my ($dcc, $text) = @_;
+  my ($msg,$data);
+    my (@servers) = Irssi::servers();
+  if ($msg =~ /^\255\251\001/) {
+    $msg = substr($text,3);
+  } else {
+    $msg = $text;
+  }
 
+  if ($msg =~ /^\-Auth/) {
+#    my $cmd = "/MSG =". $dcc->{nick} . " +Auth ". auth($msg);
+    $server = $servers[0];
+    my $cmd = "+Auth ". auth($msg);
+    $server->command("/MSG =". $dcc->{nick} . " ". $cmd);
+#    $dcc->send("$cmd");
+#    send +Auth auth($msg);
+  }
+  
+};
 
 Irssi::settings_add_str('auth', 'auth_password', '');
 Irssi::settings_add_str('auth', 'auth_secpass', '');
@@ -41,7 +101,3 @@ Irssi::settings_add_str('auth', 'auth_authkey', '');
 
 Irssi::command_bind("auth", "cmd_auth");
 
-=comment
-#Irssi::signal_add_priority("message private", \&message, Irssi::SIGNAL_PRIORITY_LOW + 1);
-#Irssi::signal_add_priority("dcc request", \&dcc_request, Irssi::SIGNAL_PRIORITY_LOW + 1);
-=cut