From: Daniel Kahn Gillmor Date: Mon, 4 Oct 2010 02:13:45 +0000 (-0400) Subject: successfully deal with at least one prompt per msva run :/ X-Git-Tag: msva-perl/0.4~14 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=06658961bc7ff223dd6a9ca42c21ea3233bcba2a;p=monkeysphere-validation-agent.git successfully deal with at least one prompt per msva run :/ --- diff --git a/Crypt/Monkeysphere/MSVA/MarginalUI.glade b/Crypt/Monkeysphere/MSVA/MarginalUI.glade index c8f2003..fe3bb9e 100644 --- a/Crypt/Monkeysphere/MSVA/MarginalUI.glade +++ b/Crypt/Monkeysphere/MSVA/MarginalUI.glade @@ -32,7 +32,7 @@ True True True - + False @@ -47,7 +47,7 @@ True True True - + False diff --git a/Crypt/Monkeysphere/MSVA/MarginalUI.pm b/Crypt/Monkeysphere/MSVA/MarginalUI.pm index 8bcfec7..d544c24 100755 --- a/Crypt/Monkeysphere/MSVA/MarginalUI.pm +++ b/Crypt/Monkeysphere/MSVA/MarginalUI.pm @@ -1,5 +1,3 @@ -#!/usr/bin/perl -w - #---------------------------------------------------------------------- # marginalUI # @@ -11,51 +9,41 @@ { 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 -uid [ full ] Jameson Graef Rollins -uid [ full ] Jameson Graef Rollins -uid [ full ] Jameson Graef Rollins -uid [ full ] Jameson Rollins -uid [ full ] Jameson Graef Rollins -uid [ full ] [jpeg image of size 4097] -uid [marginal] Jameson Rollins -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; } diff --git a/msva-perl b/msva-perl index 45f1ce7..df5e548 100755 --- 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 :(