]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
cap_sasl 1.11
authorMantas Mikulėnas <redacted>
Fri, 4 Dec 2015 17:11:05 +0000 (19:11 +0200)
committerMantas Mikulėnas <redacted>
Fri, 4 Dec 2015 17:11:05 +0000 (19:11 +0200)
_data/scripts.yaml
scripts/cap_sasl.pl

index e6761681841a8a2cea9832fc681f1f855be523b9..7fc0514d182231dff4bf4289540cb9ac3fbb1b2a 100644 (file)
   description: 'Implements SASL authentication and enables CAP "multi-prefix"'
   filename: cap_sasl.pl
   license: GPLv2
-  modified: '2015-01-07 07:47:22'
+  modified: '2015-12-04 19:04:00'
   modules: Crypt::PK::ECC
   name: cap_sasl.pl
   url: http://ircv3.atheme.org/extensions/sasl-3.1
-  version: '1.10'
+  version: '1.11'
 -
   authors: ZaMz0n
   commands: cddb
index 7c1fba2bf3260adab12b7885aefc769f01669555..7a0b742c989efd811438af872b4bbb2f401c3785 100644 (file)
@@ -4,14 +4,14 @@ use MIME::Base64;
 use vars qw($VERSION %IRSSI);
 use constant CHALLENGE_SIZE => 32;
 
-$VERSION = "1.10";
+$VERSION = "1.11";
 %IRSSI = (
-    authors     => 'Michael Tharp (gxti), Jilles Tjoelker (jilles), Mantas Mikulėnas (grawity)',
-    contact     => 'grawity@gmail.com',
-    name        => 'cap_sasl.pl',
-    description => 'Implements SASL authentication and enables CAP "multi-prefix"',
-    license     => 'GPLv2',
-    url         => 'http://ircv3.atheme.org/extensions/sasl-3.1',
+       authors => 'Michael Tharp (gxti), Jilles Tjoelker (jilles), Mantas Mikulėnas (grawity)',
+       contact => 'grawity@gmail.com',
+       name => 'cap_sasl.pl',
+       description => 'Implements SASL authentication and enables CAP "multi-prefix"',
+       license => 'GPLv2',
+       url => 'http://ircv3.atheme.org/extensions/sasl-3.1',
 );
 
 my %sasl_auth = ();
@@ -314,7 +314,7 @@ if (eval {require Crypt::PK::ECC}) {
                }
        };
 
-       sub cmd_sasl_keygen {
+       Irssi::command_bind("sasl keygen" => sub {
                my ($data, $server, $witem) = @_;
 
                my $print = $server
@@ -362,8 +362,7 @@ if (eval {require Crypt::PK::ECC}) {
                }
 
                my $cmdchar = substr(Irssi::settings_get_str("cmdchars"), 0, 1);
-               my $cmd = "msg NickServ SET PROPERTY pubkey $pub";
-               # TODO: change to 'SET PUBKEY' when freenode gets support for that
+               my $cmd = "msg NickServ SET PUBKEY $pub";
 
                if ($server) {
                        $print->("SASL: updating your Irssi settings...");
@@ -379,9 +378,9 @@ if (eval {require Crypt::PK::ECC}) {
                        $print->("SASL: submit your pubkey to $net:");
                        $print->("%P".$cmdchar.$cmd);
                }
-       }
+       });
 
-       sub cmd_sasl_pubkey {
+       Irssi::command_bind("sasl pubkey" => sub {
                my ($data, $server, $witem) = @_;
 
                my $arg = $server ? $server->{tag} : $data;
@@ -420,11 +419,18 @@ if (eval {require Crypt::PK::ECC}) {
                my $pub = encode_base64($pk->export_key_raw("public_compressed"), "");
                Irssi::print("SASL: loaded keyfile '$f'");
                Irssi::print("SASL: your pubkey is $pub");
-       }
-
-       Irssi::command_bind('sasl keygen', \&cmd_sasl_keygen);
-       Irssi::command_bind('sasl pubkey', \&cmd_sasl_pubkey);
-};
+       });
+} else {
+       Irssi::command_bind("sasl keygen" => sub {
+               Irssi::print("SASL: cannot '/sasl keygen' as the Perl 'CryptX' module is missing",
+                                       MSGLEVEL_CLIENTERROR);
+       });
+
+       Irssi::command_bind("sasl pubkey" => sub {
+               Irssi::print("SASL: cannot '/sasl pubkey' as the Perl 'CryptX' module is missing",
+                                       MSGLEVEL_CLIENTERROR);
+       });
+}
 
 cmd_sasl_load();
 
git clone https://git.99rst.org/PROJECT