/[winpt]/trunk/Src/wptKeyEditCB.cpp
ViewVC logotype

Diff of /trunk/Src/wptKeyEditCB.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 118 by twoaday, Fri Nov 25 10:56:05 2005 UTC revision 119 by twoaday, Fri Dec 9 08:04:51 2005 UTC
# Line 18  Line 18 
18   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
19   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA   * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20   */   */
21    
22  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
23  #include <config.h>  #include <config.h>
24  #endif  #endif
25    
26  #include <stdio.h>  #include <stdio.h>
 #include <stdio.h>  
27  #include <string.h>  #include <string.h>
28  #include <stdlib.h>  #include <stdlib.h>
29  #include <assert.h>  #include <assert.h>
# Line 66  cmd_keyserv_handler (GpgKeyEdit *ctx, gp Line 66  cmd_keyserv_handler (GpgKeyEdit *ctx, gp
66  }  }
67    
68    
69    /* 'sign' command handler. */
70  static const char*  static const char*
71  cmd_sign_handler (GpgKeyEdit *ctx, gpgme_status_code_t code, const char *key)  cmd_sign_handler (GpgKeyEdit *ctx, gpgme_status_code_t code, const char *key)
72  {  {
# Line 559  cmd_revkey_handler (GpgKeyEdit *ctx, gpg Line 560  cmd_revkey_handler (GpgKeyEdit *ctx, gpg
560  /* 'addrevoker' command handler. */  /* 'addrevoker' command handler. */
561  static const char *  static const char *
562  cmd_addrev_handler (GpgKeyEdit *ctx, gpgme_status_code_t code,  cmd_addrev_handler (GpgKeyEdit *ctx, gpgme_status_code_t code,
563                      const char * key, int * r_step)                      const char *key, int *r_step)
564  {  {
565      int step = *r_step;      int step = *r_step;
566    
567      /* If the isuser already signed the key, send an empty      /* If the isuser already signed the key, send an empty
568         string and jump to quit. */             string and jump to quit. */
569      if (ctx->getResult () & GPG_EDITRES_ALREADY_SIGNED      if (ctx->getResult () & GPG_EDITRES_ALREADY_SIGNED
570          && *r_step != -1 && *r_step != 4) {          && *r_step != -1 && *r_step != 4) {
571          *r_step = step = -1;          *r_step = step = -1;
572          return "";          return "";
# Line 573  cmd_addrev_handler (GpgKeyEdit *ctx, gpg Line 574  cmd_addrev_handler (GpgKeyEdit *ctx, gpg
574      if (*r_step == -1) {      if (*r_step == -1) {
575          *r_step = step = 4;          *r_step = step = 4;
576          return ""; /* empty value to abort. */          return ""; /* empty value to abort. */
577      }      }
578      if (step == 0 && !strcmp (key, "keyedit.prompt")) {      if (step == 0 && !strcmp (key, "keyedit.prompt")) {
579          *r_step = step = 1;          *r_step = step = 1;
580          return "addrevoker";          return "addrevoker";
# Line 621  cmd_addphoto_handler (GpgKeyEdit *ctx, g Line 622  cmd_addphoto_handler (GpgKeyEdit *ctx, g
622      return NULL;      return NULL;
623  }  }
624    
625    
626    /* 'clean' command handler. */
627    static const char*
628    cmd_clean_handler (GpgKeyEdit *ctx, gpgme_status_code_t code, const char *key)
629    {
630        if (!strcmp (key, "keyedit.prompt") && !ctx->cmd_sent) {
631            ctx->cmd_sent = 1;
632            return "clean";
633        }
634        if (!strcmp (key, "keyedit.prompt")) {
635            ctx->reset ();
636            return "save";
637        }
638        return NULL;
639    }
640    
641    
642  /* 'enable' and 'disable' command handler. */  /* 'enable' and 'disable' command handler. */
643  static const char *  static const char *
644  cmd_enable_disable_handler (GpgKeyEdit *ctx, gpgme_status_code_t code,  cmd_enable_disable_handler (GpgKeyEdit *ctx, gpgme_status_code_t code,
# Line 659  editkey_command_handler (void *opaque, g Line 677  editkey_command_handler (void *opaque, g
677      case GPGME_STATUS_ALREADY_SIGNED:      case GPGME_STATUS_ALREADY_SIGNED:
678          ke->setResult (GPG_EDITRES_ALREADY_SIGNED);          ke->setResult (GPG_EDITRES_ALREADY_SIGNED);
679          break;          break;
680    
681      case GPGME_STATUS_BAD_PASSPHRASE:      case GPGME_STATUS_BAD_PASSPHRASE:
682          ke->setResult (GPG_EDITRES_BAD_PASSPHRASE);          ke->setResult (GPG_EDITRES_BAD_PASSPHRASE);
683          break;          break;
684            
685      default:      default:
686          break;          break;
687      }      }
# Line 741  editkey_command_handler (void *opaque, g Line 760  editkey_command_handler (void *opaque, g
760          out =  cmd_addphoto_handler (ke, code, key);          out =  cmd_addphoto_handler (ke, code, key);
761          break;          break;
762    
763        case GPG_EDITKEY_CLEAN:
764            out = cmd_clean_handler (ke, code, key);
765            break;
766    
767      case GPG_EDITKEY_ENABLE:      case GPG_EDITKEY_ENABLE:
768      case GPG_EDITKEY_DISABLE:      case GPG_EDITKEY_DISABLE:
769          out = cmd_enable_disable_handler (ke, code, key,          out = cmd_enable_disable_handler (ke, code, key,

Legend:
Removed from v.118  
changed lines
  Added in v.119

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26