]> snippets.scripts.mit.edu Git - Scripts/git/.git/blobdiff - barnowl/zcrypt.pl
zcrypt.pl: No need to replace BarnOwl’s builtin zcrypt anymore
[Scripts/git/.git] / barnowl / zcrypt.pl
index cf864fb26e847f28d46791d2a4a5e3c517026ad2..e60b0de529a8cc68c566bd85e7a0be315d547838 100644 (file)
@@ -1,18 +1,10 @@
-# BarnOwls older than late September 2008 will segfault on short zcrypt messages.
-# Besides, the code is sketchy and doesn't belong in core. This perl module
-# will add :zcrypt and :decrypt commands that use outland's zcrypt binary via
-# Perl, so a bug in zcrypt can't possibly affect BarnOwl proper. The :zcrypt
-# command replaces the built-in one.
+# This perl module adds a :decrypt command that uses barnowl's zcrypt
+# binary via Perl to decrypt zcrypt'd zephyrs after they have been
+# received.
 #
 # To use this code, type
 #   :perl do '/mit/snippets/barnowl/zcrypt.pl'
 #
-# This first line will disable BarnOwl's own zcrypt code, so messages are
-# encrypted onscreen. Use :decrypt to display them. (Security bugs were later
-# found in the decryption code, although these probably affect locker zcrypt
-# too.)
-
-BarnOwl::command("unset zcrypt");
 
 use IPC::Open2;
 BarnOwl::new_command(decrypt => sub {
@@ -23,9 +15,9 @@ BarnOwl::new_command(decrypt => sub {
        @args = ('-c', $msg->class, '-i', $msg->instance);
    }
    my ($zo, $zi);
-   my $pid = open2($zo, $zi, '/mit/outland/bin/zcrypt', '-D', @args) or die "Couldn't launch zcrypt\n";
+   my $pid = open2($zo, $zi, 'athrun', 'barnowl', 'zcrypt', '-D', @args) or die "Couldn't launch zcrypt\n";
    my $decrypted;
-   print $zi $msg->fields[1] . "\n";
+   print $zi $msg->fields->[1] . "\n";
    close $zi;
    while (<$zo>) {
       chomp;
@@ -37,28 +29,10 @@ BarnOwl::new_command(decrypt => sub {
    },
    {summary => "Decrypt a zcrypted message once",
     usage => "decrypt [args]",
-    description => "Invokes /mit/outland/bin/zcrypt on the current message,\n
+    description => "Invokes athrun barnowl zcrypt on the current message,\n
 using the class and instance to find the crypt key, and pops up the\n
 decrypted output. If args are specified, they are passed to zcrypt and the\n
 class and instance are ignored.\n\n
 SEE ALSO: zcrypt(1)"});
 
-BarnOwl::new_command(zcrypt => sub {
-   my $cmd = shift;
-   my @args = @_;
-   my $argstring = join ' ', @args;
-   BarnOwl::start_edit_win("/mit/outland/bin/zcrypt $argstring", sub {
-      my $msg = shift;
-      my ($zo, $zi);
-      my $pid = open2($zo, $zi, '/mit/outland/bin/zcrypt', @args);
-      print $zi "$msg\n";
-      close $zi;
-      local $/;
-      BarnOwl::message(<$zo>);
-      waitpid $pid, 0;
-      });
-   },
-   {summary => "Run /mit/outland/bin/zcrypt",
-    usage => "zcrypt -c [class] -i [instance]",
-    description => "Calls /mit/outland/bin/zcrypt on a message you type in.\n\n
-SEE ALSO: zcrypt(1)"});
+1;