]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Drop tabs. Read instead of write passwords.
authorIsaac Good <redacted>
Wed, 7 Dec 2016 02:45:34 +0000 (18:45 -0800)
committerIsaac Good <redacted>
Wed, 7 Dec 2016 02:45:34 +0000 (18:45 -0800)
scripts/ident.pl

index 125082566cab0be6f2a805a9a7c3850a1100c800..a4854f2c8e9f3dce91841d2cb40a5a0d6228455b 100644 (file)
@@ -22,11 +22,11 @@ my %pw;
 
 
 sub LoadPasswords {
-       # Load the passwords from file.
+    # Load the passwords from file.
     delete @pw{keys %pw};
     my $filename = Irssi::get_irssi_dir() . '/passwords';
-       my $FH;
-    unless(open $FH, ">", $filename)
+    my $FH;
+    unless(open $FH, "<", $filename)
     {
         print "Can not open $filename";
         return 0;
@@ -34,12 +34,12 @@ sub LoadPasswords {
     while (my $line = <$FH>)
     {
         chomp $line;
-               next unless ($line);
+        next unless ($line);
         my ($tag, $password) = split(/  */, $line, 2);
         next unless ($tag and $password);
-               $pw{$tag} = $password;
-       }
-       return 1;
+        $pw{$tag} = $password;
+    }
+    return 1;
 }
 
 
@@ -48,15 +48,15 @@ sub notice {
     my ($channel, $msg) = split(/ :/, $data, 2);
     my $l = 0;
 
-       # Test the notice. Must be from nickserv and be asking you to identify.
+    # Test the notice. Must be from nickserv and be asking you to identify.
     return undef unless (lc($nick) eq 'nickserv');
     return undef unless (lc($msg) =~ /msg nickserv identify/);
-       # Check it's a direct message and we have a password for this network.
+    # Check it's a direct message and we have a password for this network.
     return undef unless (lc($channel) eq lc($server->{'nick'}));
     return undef unless ($pw{$server->{'chatnet'}});
 
     my $pw = $pw{$server->{'chatnet'}};
-       # Use the /quote nickserv approach to reduce chance of leaking the password to a bad actor, ie someone pretending to be nickserv.
+    # Use the /quote nickserv approach to reduce chance of leaking the password to a bad actor, ie someone pretending to be nickserv.
     $server->command("^quote nickserv identify $pw");
 
     return undef;
@@ -64,5 +64,5 @@ sub notice {
 
 
 if (LoadPasswords()) {
-       Irssi::signal_add('event notice', \&notice);
+    Irssi::signal_add('event notice', \&notice);
 }
git clone https://git.99rst.org/PROJECT