/[gpgoe]/trunk/src/OECrypto.c
ViewVC logotype

Diff of /trunk/src/OECrypto.c

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

revision 18 by twoaday, Thu Apr 13 07:41:30 2006 UTC revision 19 by twoaday, Sun Jun 4 10:12:47 2006 UTC
# Line 382  sign_msg (plugin_ctx_t ctx, char **r_msg Line 382  sign_msg (plugin_ctx_t ctx, char **r_msg
382  }  }
383    
384    
385    static void
386    start_verify_dialog (HWND main_wnd, gpgme_signature_t sig, gpgme_data_t text)
387    {
388        struct verify_ctx_s ctx;
389    
390        if (!sig)
391            return;
392        memset (&ctx, 0, sizeof (ctx));
393        ctx.sig = sig;
394        ctx.text = text;
395        DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, main_wnd,
396                                verify_dlg_proc, (LPARAM)&ctx);
397    }
398    
399    
400  /* Sign and encrypt the message @r_msg. */  /* Sign and encrypt the message @r_msg. */
401  static gpgme_error_t  static gpgme_error_t
402  sign_encrypt_msg (plugin_ctx_t ctx, char **r_msg)  sign_encrypt_msg (plugin_ctx_t ctx, char **r_msg)
# Line 448  verify_msg (plugin_ctx_t ctx, char **r_m Line 463  verify_msg (plugin_ctx_t ctx, char **r_m
463      if (!err) {      if (!err) {
464          res = gpgme_op_verify_result (gctx);          res = gpgme_op_verify_result (gctx);
465          if (res && res->signatures)          if (res && res->signatures)
466              DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, ctx->main_wnd,              start_verify_dialog (ctx->main_wnd, res->signatures, out);
                             verify_dlg_proc, (LPARAM)res->signatures);  
467      }      }
468    
469      gpgme_release (gctx);      gpgme_release (gctx);
# Line 542  oe_decrypt_msg (HWND main_wnd, char **r_ Line 556  oe_decrypt_msg (HWND main_wnd, char **r_
556  /* Decrypt the message @r_msg. If the type @type is actually a signature,  /* Decrypt the message @r_msg. If the type @type is actually a signature,
557     the verify function is called instead of decryption. */     the verify function is called instead of decryption. */
558  static gpgme_error_t  static gpgme_error_t
559  decrypt_msg (plugin_ctx_t ctx, char **r_msg, int type, int *r_cancel)  decrypt_msg (plugin_ctx_t ctx, char **r_msg, int *type, int *r_cancel)
560  {  {
561      gpgme_ctx_t gctx = NULL;      gpgme_ctx_t gctx = NULL;
562      gpgme_data_t in = NULL, out = NULL;      gpgme_data_t in = NULL, out = NULL;
# Line 551  decrypt_msg (plugin_ctx_t ctx, char **r_ Line 565  decrypt_msg (plugin_ctx_t ctx, char **r_
565      pass_cb_t cb_val;      pass_cb_t cb_val;
566      char *msg = *r_msg;      char *msg = *r_msg;
567    
568      if ((type & PGP_SIG) || (type & PGP_CLEARSIG))      if ((*type & PGP_SIG) || (*type & PGP_CLEARSIG))
569          return verify_msg (ctx, r_msg);          return verify_msg (ctx, r_msg);
570    
571      cb_val = new_pass_cb (ctx->main_wnd);      cb_val = new_pass_cb (ctx->main_wnd);
# Line 565  decrypt_msg (plugin_ctx_t ctx, char **r_ Line 579  decrypt_msg (plugin_ctx_t ctx, char **r_
579          gpgme_set_passphrase_cb (gctx, passphrase_cb, cb_val);          gpgme_set_passphrase_cb (gctx, passphrase_cb, cb_val);
580          err = gpgme_op_decrypt_verify (gctx, in, out);          err = gpgme_op_decrypt_verify (gctx, in, out);
581          res = gpgme_op_verify_result (gctx);          res = gpgme_op_verify_result (gctx);
582          if (res && res->signatures)          if (res && res->signatures) {
583              DialogBoxParam (mod_hinst_dll, (LPCTSTR)IDD_VERIFY, ctx->main_wnd,              start_verify_dialog (ctx->main_wnd, res->signatures, out);
584                              verify_dlg_proc, (LPARAM)res->signatures);              *type |= PGP_SIG;
585            }
586      }      }
587      *r_cancel = pass_cb_cancelled (cb_val);      *r_cancel = pass_cb_cancelled (cb_val);
588    
# Line 686  oe_handle_mail (plugin_ctx_t ctx) Line 701  oe_handle_mail (plugin_ctx_t ctx)
701                        _("GPG Plug-in Info"), MB_ICONINFORMATION|MB_OK);                        _("GPG Plug-in Info"), MB_ICONINFORMATION|MB_OK);
702      }      }
703      else if (msg_type) {      else if (msg_type) {
704          rc = decrypt_msg (ctx, &msg, msg_type, &cancel);          rc = decrypt_msg (ctx, &msg, &msg_type, &cancel);
705          SendMessage (ctx->msg_wnd, WM_CLEAR, 0, 0);          SendMessage (ctx->msg_wnd, WM_CLEAR, 0, 0);
706          SendMessage (ctx->msg_wnd, WM_UNDO, 0, 0);          SendMessage (ctx->msg_wnd, WM_UNDO, 0, 0);
707          if (!cancel && !rc && (msg_type & PGP_MESSAGE)          if (!cancel && !rc && (msg_type & PGP_MESSAGE) && !(msg_type & PGP_SIG)
708              && msg && strlen (msg) > 0) {              && msg && strlen (msg) > 0) {
709              struct viewer_ctx_s viewer;              struct viewer_ctx_s viewer;
710              viewer.msg = msg;              viewer.msg = msg;

Legend:
Removed from v.18  
changed lines
  Added in v.19

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26