successfully deal with at least one prompt per msva run :/
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Mon, 4 Oct 2010 02:13:45 +0000 (22:13 -0400)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Mon, 4 Oct 2010 02:13:45 +0000 (22:13 -0400)
Crypt/Monkeysphere/MSVA/MarginalUI.glade
Crypt/Monkeysphere/MSVA/MarginalUI.pm
msva-perl

index c8f2003cad119f7e37c198d0bde4b543139bfd17..fe3bb9edf4562976848e0419ef45772a3575f068 100644 (file)
@@ -32,7 +32,7 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
-                <signal name="clicked" handler="Crypt::Monkeysphere::MSVA::MarginalUI::on_yesButton_clicked"/>
+                <signal name="clicked" handler="on_yesButton_clicked"/>
               </widget>
               <packing>
                 <property name="expand">False</property>
@@ -47,7 +47,7 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
-                <signal name="clicked" handler="Crypt::Monkeysphere::MSVA::MarginalUI::on_noButton_clicked" object="no"/>
+                <signal name="clicked" handler="on_noButton_clicked" object="no"/>
               </widget>
               <packing>
                 <property name="expand">False</property>
index 8bcfec7ac50ee7c4ee45df05c40bf621ec7ee31f..d544c2486929c0aa804bf574f93c83b8d9c9b908 100755 (executable)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl -w
-
 #----------------------------------------------------------------------
 # marginalUI
 #
 
 { package Crypt::Monkeysphere::MSVA::MarginalUI;
 
-use strict;
-use warnings;
-
-use Gtk2 '-init'; # auto-initializes Gtk2
-use Gtk2::GladeXML;
+  use strict;
+  use warnings;
 
-my $glade;
-my $label;
+  my $resp = 0;
 
-# populate UI from 
-$glade = Gtk2::GladeXML->new("Crypt/Monkeysphere/MSVA/MarginalUI.glade");
+  sub prompt {
+    use Gtk2 '-init'; # auto-initializes Gtk2
+    use Gtk2::GladeXML;
 
-# Connect the signals
-$glade->signal_autoconnect_from_package('main');
+    my $glade;
+    my $label;
 
-$label = $glade->get_widget('messageLabel');
-my $labeltxt = <<'END';
-pub   4096R/E27BAABC 2007-01-08 [expires: 2012-01-07] 
-uid       [  full  ] Jameson Graef Rollins <jrollins@finestructure.net> 
-uid       [  full  ] Jameson Graef Rollins <jrollins@phys.columbia.edu>
-uid       [  full  ] Jameson Graef Rollins <jrollins@fifthhorseman.net>
-uid       [  full  ] Jameson Graef Rollins <jrollins@astro.columbia.edu>
-uid       [  full  ] Jameson Rollins <jrollins@fifthhorseman.net>
-uid       [  full  ] Jameson Graef Rollins <jameson.rollins@ligo.org>
-uid       [  full  ] [jpeg image of size 4097]
-uid       [marginal] Jameson Rollins <jrollins@finestructure.net>
-sub   4096R/1321E689 2007-01-09 [expires: 2012-01-08]
-sub   2048R/4414A10A 2008-06-18 [expires: 2013-06-17]
+    # populate UI from 
+    $glade = Gtk2::GladeXML->new("Crypt/Monkeysphere/MSVA/MarginalUI.glade");
 
-Do you trust this dude?
-END
-$label->set_text($labeltxt);
+    # Connect the signals
+    $glade->signal_autoconnect_from_package('Crypt::Monkeysphere::MSVA::MarginalUI');
+    $label = $glade->get_widget('messageLabel');
 
-# Start it up
-Gtk2->main;
+    my $labeltxt = shift;
+    $label->set_text($labeltxt);
 
-exit 0;
+    # Start it up
+    Gtk2->main;
 
-sub on_yesButton_clicked {
-    exit 0;
-}
-sub on_noButton_clicked {
-    exit 1;
-}
+    return $resp;
+  }
 
-1;
+  sub on_yesButton_clicked {
+    $resp = 1;
+    Gtk2->main_quit;
+  }
+  sub on_noButton_clicked {
+    Gtk2->main_quit;
+  }
 
+  1;
 }
index 45f1ce7760b78ace85c56c63780619256ed1272a..df5e548cdde47d9c7a6f973898e984acbfa7e09b 100755 (executable)
--- a/msva-perl
+++ b/msva-perl
@@ -573,6 +573,12 @@ use strict;
                                     $certifier_list,
                                    );
                   msvalog('info', "%s\n", $msg);
+                  my $resp = Crypt::Monkeysphere::MSVA::MarginalUI::prompt($msg);
+                  msvalog('info', "response: %s\n", $resp);
+                  if ($resp) {
+                    $ret->{valid} = JSON::true;
+                    $ret->{message} = sprintf('Manually validated "%s" through the OpenPGP Web of Trust.', $uid);
+                  }
                 }
                 # FIXME: not doing anything with @marginal_certifiers
                 # -- that'd be yet more queries to gpg :(