[svn] GPGol - r156 - trunk/src

svn author twoaday cvs at cvs.gnupg.org
Wed Aug 16 12:42:55 CEST 2006


Author: twoaday
Date: 2006-08-16 12:42:52 +0200 (Wed, 16 Aug 2006)
New Revision: 156

Removed:
   trunk/src/olgpgcore.def
Modified:
   trunk/src/ChangeLog
   trunk/src/decrypt.bmp
   trunk/src/encrypt.bmp
   trunk/src/engine-gpgme.c
   trunk/src/gpgol-rsrcs.rc
   trunk/src/intern.h
   trunk/src/key_mana.bmp
   trunk/src/olflange.cpp
   trunk/src/passphrase-dialog.c
   trunk/src/recipient-dialog.c
   trunk/src/sign.bmp
Log:
2006-08-15  Timo Schulz  <ts at g10code.de>
                                                                                
        * decrypt.bmp, encrypt.bmp: Restore format.
        * olflange.cpp (OnWriteComplete): Correct exit code handling.
        * recipient-dialog.c (initialize_rsetbox): Correct column width.
        (recipient_dlg_proc): Do not show the cancel error any longer.
        * passphrase-dialog.c (decrypt_key_dlg_proc): Likewise.
        (decrypt_key_ext_dlg_proc): Ditto.
        * olgpgcore.def: Deleted unused file.



Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2006-06-14 15:49:15 UTC (rev 155)
+++ trunk/src/ChangeLog	2006-08-16 10:42:52 UTC (rev 156)
@@ -1,3 +1,13 @@
+2006-08-15  Timo Schulz  <ts at g10code.de>
+
+	* decrypt.bmp, encrypt.bmp: Restore format.
+	* olflange.cpp (OnWriteComplete): Correct exit code handling.
+	* recipient-dialog.c (initialize_rsetbox): Correct column width.
+	(recipient_dlg_proc): Do not show the cancel error any longer.
+	* passphrase-dialog.c (decrypt_key_dlg_proc): Likewise.
+	(decrypt_key_ext_dlg_proc): Ditto.
+	* olgpgcore.def: Deleted unused file.
+	
 2006-06-14  Timo Schulz  <ts at g10code.com>
 
 	* gpgol-rscs.rc (IDD_OPT): The English version of the dialog

Modified: trunk/src/decrypt.bmp
===================================================================
(Binary files differ)

Modified: trunk/src/encrypt.bmp
===================================================================
(Binary files differ)

Modified: trunk/src/engine-gpgme.c
===================================================================
--- trunk/src/engine-gpgme.c	2006-06-14 15:49:15 UTC (rev 155)
+++ trunk/src/engine-gpgme.c	2006-08-16 10:42:52 UTC (rev 156)
@@ -116,7 +116,6 @@
       return err;
     }
   
-  /*init_keycache_objects ();*/
   init_done = 1;
   return 0;
 }
@@ -178,7 +177,7 @@
    delete it if the TTL is 0 or an empty value is used. We also wipe
    the passphrase from the context here. */
 static void
-update_passphrase_cache (int err, struct decrypt_key_s *pass_cb_value)
+update_passphrase_cache (int err, struct passphrase_cb_s *pass_cb_value)
 {
   if (*pass_cb_value->keyid)
     {
@@ -227,15 +226,15 @@
 op_encrypt (const char *inbuf, char **outbuf, gpgme_key_t *keys,
             gpgme_key_t sign_key, int ttl)
 {
-  struct decrypt_key_s dk;
+  struct passphrase_cb_s cb;
   gpgme_data_t in = NULL;
   gpgme_data_t out = NULL;
   gpgme_error_t err;
   gpgme_ctx_t ctx = NULL;
     
-  memset (&dk, 0, sizeof dk);
-  dk.ttl = ttl;
-  dk.flags = 0x01; /* FIXME: what is that? */
+  memset (&cb, 0, sizeof cb);
+  cb.ttl = ttl;
+  cb.decrypt_cmd = 0;
 
   *outbuf = NULL;
 
@@ -256,14 +255,14 @@
   gpgme_set_armor (ctx, 1);
   if (sign_key)
     {
-      gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &dk);
-      dk.ctx = ctx;
+      gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &cb);
+      cb.ctx = ctx;
       err = gpgme_signers_add (ctx, sign_key);
       if (!err)
         err = gpgme_op_encrypt_sign (ctx, keys, GPGME_ENCRYPT_ALWAYS_TRUST,
                                      in, out);
-      dk.ctx = NULL;
-      update_passphrase_cache (err, &dk);
+      cb.ctx = NULL;
+      update_passphrase_cache (err, &cb);
     }
   else
     err = gpgme_op_encrypt (ctx, keys, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
@@ -299,7 +298,7 @@
 op_encrypt_stream (LPSTREAM instream, LPSTREAM outstream, gpgme_key_t *keys,
                    gpgme_key_t sign_key, int ttl)
 {
-  struct decrypt_key_s dk;
+  struct passphrase_cb_s cb;
   struct gpgme_data_cbs cbs;
   gpgme_data_t in = NULL;
   gpgme_data_t out = NULL;
@@ -310,9 +309,9 @@
   cbs.read = stream_read_cb;
   cbs.write = stream_write_cb;
 
-  memset (&dk, 0, sizeof dk);
-  dk.ttl = ttl;
-  dk.flags = 1;
+  memset (&cb, 0, sizeof cb);
+  cb.ttl = ttl;
+  cb.decrypt_cmd = 0;
 
   err = gpgme_data_new_from_cbs (&in, &cbs, instream);
   if (err)
@@ -330,14 +329,14 @@
   /* FIXME:  We should not hardcode always trust. */
   if (sign_key)
     {
-      gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &dk);
-      dk.ctx = ctx;
+      gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &cb);
+      cb.ctx = ctx;
       err = gpgme_signers_add (ctx, sign_key);
       if (!err)
         err = gpgme_op_encrypt_sign (ctx, keys, GPGME_ENCRYPT_ALWAYS_TRUST,
                                      in, out);
-      dk.ctx = NULL;
-      update_passphrase_cache (err, &dk);
+      cb.ctx = NULL;
+      update_passphrase_cache (err, &cb);
     }
   else
     err = gpgme_op_encrypt (ctx, keys, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
@@ -361,15 +360,15 @@
 op_sign (const char *inbuf, char **outbuf, int mode,
          gpgme_key_t sign_key, int ttl)
 {
-  struct decrypt_key_s dk;
+  struct passphrase_cb_s cb;
   gpgme_error_t err;
   gpgme_data_t in = NULL;
   gpgme_data_t out = NULL;
   gpgme_ctx_t ctx = NULL;
 
-  memset (&dk, 0, sizeof dk);
-  dk.ttl = ttl;
-  dk.flags = 1;
+  memset (&cb, 0, sizeof cb);
+  cb.ttl = ttl;
+  cb.decrypt_cmd = 0;
 
   *outbuf = NULL;
   op_init ();
@@ -393,11 +392,11 @@
     gpgme_set_textmode (ctx, 1);
   gpgme_set_armor (ctx, 1);
 
-  gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &dk);
-  dk.ctx = ctx;
+  gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &cb);
+  cb.ctx = ctx;
   err = gpgme_op_sign (ctx, in, out, mode);
-  dk.ctx = NULL;
-  update_passphrase_cache (err, &dk);
+  cb.ctx = NULL;
+  update_passphrase_cache (err, &cb);
 
   if (!err)
     {
@@ -427,7 +426,7 @@
                 gpgme_key_t sign_key, int ttl)
 {
   struct gpgme_data_cbs cbs;
-  struct decrypt_key_s dk;
+  struct passphrase_cb_s cb;
   gpgme_data_t in = NULL;
   gpgme_data_t out = NULL;
   gpgme_ctx_t ctx = NULL;
@@ -437,9 +436,9 @@
   cbs.read = stream_read_cb;
   cbs.write = stream_write_cb;
 
-  memset (&dk, 0, sizeof dk);
-  dk.ttl = ttl;
-  dk.flags = 0x01; /* fixme: Use a macro for documentation reasons. */
+  memset (&cb, 0, sizeof cb);
+  cb.ttl = ttl;
+  cb.decrypt_cmd = 0;
 
   err = gpgme_data_new_from_cbs (&in, &cbs, instream);
   if (err)
@@ -460,11 +459,11 @@
     gpgme_set_textmode (ctx, 1);
   gpgme_set_armor (ctx, 1);
 
-  gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &dk);
-  dk.ctx = ctx;
+  gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &cb);
+  cb.ctx = ctx;
   err = gpgme_op_sign (ctx, in, out, mode);
-  dk.ctx = NULL;
-  update_passphrase_cache (err, &dk);
+  cb.ctx = NULL;
+  update_passphrase_cache (err, &cb);
   
  fail:
   if (in)
@@ -488,7 +487,7 @@
 op_decrypt (const char *inbuf, char **outbuf, int ttl, const char *filename,
             gpgme_data_t attestation, int preview_mode)
 {
-  struct decrypt_key_s dk;
+  struct passphrase_cb_s cb;
   gpgme_data_t in = NULL;
   gpgme_data_t out = NULL;
   gpgme_ctx_t ctx;
@@ -497,8 +496,9 @@
   *outbuf = NULL;
   op_init ();
 
-  memset (&dk, 0, sizeof dk);
-  dk.ttl = ttl;
+  memset (&cb, 0, sizeof cb);
+  cb.ttl = ttl;
+  cb.decrypt_cmd = 1;
 
   err = gpgme_new (&ctx);
   if (err)
@@ -511,14 +511,14 @@
   if (err)
     goto leave;
 
-  gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &dk);
-  dk.ctx = ctx;
+  gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &cb);
+  cb.ctx = ctx;
   if (preview_mode)
     err = gpgme_op_decrypt (ctx, in, out);
   else
     err = gpgme_op_decrypt_verify (ctx, in, out);
-  dk.ctx = NULL;
-  update_passphrase_cache (err, &dk);
+  cb.ctx = NULL;
+  update_passphrase_cache (err, &cb);
 
   /* Act upon the result of the decryption operation. */
   if (!err && preview_mode) 
@@ -561,7 +561,7 @@
 
   /* If the callback indicated a cancel operation, set the error
      accordingly. */
-  if (err && (dk.opts & OPT_FLAG_CANCEL))
+  if (err && (cb.opts & OPT_FLAG_CANCEL))
     err = gpg_error (GPG_ERR_CANCELED);
   
 leave:    
@@ -585,25 +585,26 @@
                 const char *filename, gpgme_data_t attestation, 
                 int preview_mode)
 {    
-  struct decrypt_key_s dk;
+  struct passphrase_cb_s cb;
   gpgme_ctx_t ctx = NULL;
   gpgme_error_t err;
   
-  memset (&dk, 0, sizeof dk);
-  dk.ttl = ttl;
+  memset (&cb, 0, sizeof cb);
+  cb.ttl = ttl;
+  cb.decrypt_cmd = 1;
 
   err = gpgme_new (&ctx);
   if (err)
     goto fail;
 
-  gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &dk);
-  dk.ctx = ctx;
+  gpgme_set_passphrase_cb (ctx, passphrase_callback_box, &cb);
+  cb.ctx = ctx;
   if (preview_mode)
     err = gpgme_op_decrypt (ctx, in, out);
   else
     err = gpgme_op_decrypt_verify (ctx, in, out);
-  dk.ctx = NULL;
-  update_passphrase_cache (err, &dk);
+  cb.ctx = NULL;
+  update_passphrase_cache (err, &cb);
   /* Act upon the result of the decryption operation. */
   if (!err && preview_mode) 
     ;
@@ -637,7 +638,7 @@
 
   /* If the callback indicated a cancel operation, set the error
      accordingly. */
-  if (err && (dk.opts & OPT_FLAG_CANCEL))
+  if (err && (cb.opts & OPT_FLAG_CANCEL))
     err = gpg_error (GPG_ERR_CANCELED);
 
  fail:

Modified: trunk/src/gpgol-rsrcs.rc
===================================================================
--- trunk/src/gpgol-rsrcs.rc	2006-06-14 15:49:15 UTC (rev 155)
+++ trunk/src/gpgol-rsrcs.rc	2006-08-16 10:42:52 UTC (rev 156)
@@ -1,5 +1,5 @@
 /* gpgol-rsrcs.rc - Main resources for this DLL        -*- c -*-
- *	Copyright (C) 2004, 2005 g10 Code GmbH
+ *	Copyright (C) 2004, 2005, 2006 g10 Code GmbH
  * 
  * This file is part of GPGol.
  * 
@@ -46,11 +46,11 @@
 FONT 8, "MS Sans Serif"
 BEGIN
     CONTROL         "List1",IDC_ENC_RSET1,"SysListView32",LVS_REPORT | 
-                    WS_BORDER | WS_TABSTOP,8,4,314,92
+                    LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,8,4,314,92
     LTEXT           "Ausgewählte Empfänger:",IDC_STATIC,
                     8,98,130,8
     CONTROL         "List2",IDC_ENC_RSET2,"SysListView32",LVS_REPORT | 
-                    WS_BORDER | WS_TABSTOP,8,110,313,49
+                    LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,8,110,313,49
     LTEXT           "Empfänger die NICHT gefunden wurden:",IDC_ENC_INFO,
                     8,161,128,8
     LISTBOX         IDC_ENC_NOTFOUND,8,170,313,22,LBS_SORT | 
@@ -265,9 +265,9 @@
 FONT 8, "MS Sans Serif"
 BEGIN
     CONTROL         "List1",IDC_ENC_RSET1,"SysListView32",LVS_REPORT | 
-                    WS_BORDER | WS_TABSTOP,8,4,314,92
+                    LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,8,4,314,92
     CONTROL         "List2",IDC_ENC_RSET2,"SysListView32",LVS_REPORT | 
-                    WS_BORDER | WS_TABSTOP,8,98,313,49
+                    LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,8,98,313,49
     LTEXT           "Recipient which were NOT found",IDC_ENC_INFO,8,149,106,
                     8
     LISTBOX         IDC_ENC_NOTFOUND,8,158,313,22,LBS_SORT | 

Modified: trunk/src/intern.h
===================================================================
--- trunk/src/intern.h	2006-06-14 15:49:15 UTC (rev 155)
+++ trunk/src/intern.h	2006-08-16 10:42:52 UTC (rev 156)
@@ -1,6 +1,6 @@
 /* intern.h
  *	Copyright (C) 2004 Timo Schulz
- *	Copyright (C) 2005 g10 Code GmbH
+ *	Copyright (C) 2005, 2006 g10 Code GmbH
  *
  * This file is part of GPGol.
  *
@@ -38,6 +38,7 @@
 #endif
 
 
+/* Possible options for the recipient dialog. */
 enum
   {
     OPT_FLAG_TEXT     =  2,
@@ -71,16 +72,18 @@
 extern UINT      this_dll;
 
 
-struct decrypt_key_s 
+/* Passphrase callback structure. */
+struct passphrase_cb_s
 {
   gpgme_key_t signer;
+  gpgme_ctx_t ctx;
   char keyid[16+1];
   char *user_id;
   char *pass;    
-  void *ctx;
   int opts;
   int ttl;  /* TTL of the passphrase. */
-  unsigned int flags;
+  unsigned int decrypt_cmd:1; /* 1 = show decrypt dialog, otherwise secret key
+			         selection. */
   unsigned int hide_pwd:1;
   unsigned int last_was_bad:1;
 };
@@ -130,7 +133,7 @@
 void watcher_set_callback_ctx (void *cb);
 
 /*-- recipient-dialog.c --*/
-unsigned int recipient_dialog_box(gpgme_key_t **ret_rset);
+unsigned int recipient_dialog_box (gpgme_key_t **ret_rset);
 unsigned int recipient_dialog_box2 (gpgme_key_t *fnd, char **unknown,
                                     gpgme_key_t **ret_rset);
 
@@ -139,7 +142,7 @@
 gpgme_error_t passphrase_callback_box (void *opaque, const char *uid_hint, 
 			     const char *pass_info,
 			     int prev_was_bad, int fd);
-void free_decrypt_key (struct decrypt_key_s * ctx);
+void free_decrypt_key (struct passphrase_cb_s *ctx);
 const char *get_pubkey_algo_str (gpgme_pubkey_algo_t id);
 
 /*-- config-dialog.c --*/

Modified: trunk/src/key_mana.bmp
===================================================================
(Binary files differ)

Modified: trunk/src/olflange.cpp
===================================================================
--- trunk/src/olflange.cpp	2006-06-14 15:49:15 UTC (rev 155)
+++ trunk/src/olflange.cpp	2006-08-16 10:42:52 UTC (rev 156)
@@ -997,15 +997,15 @@
   HRESULT hr = pEECB->GetObject (&pMDB, (LPMAPIPROP *)&msg);
   if (SUCCEEDED (hr))
     {
-      SPropTagArray proparray;
+//      SPropTagArray proparray;
 
       GpgMsg *m = CreateGpgMsg (msg);
       m->setExchangeCallback ((void*)pEECB);
       if (m_pExchExt->m_gpgEncrypt && m_pExchExt->m_gpgSign)
         rc = m->signEncrypt (hWnd, m_want_html);
-      if (m_pExchExt->m_gpgEncrypt && !m_pExchExt->m_gpgSign)
+      else if (m_pExchExt->m_gpgEncrypt && !m_pExchExt->m_gpgSign)
         rc = m->encrypt (hWnd, m_want_html);
-      if (!m_pExchExt->m_gpgEncrypt && m_pExchExt->m_gpgSign)
+      else if (!m_pExchExt->m_gpgEncrypt && m_pExchExt->m_gpgSign)
         rc = m->sign (hWnd, m_want_html);
       else
         rc = 0;
@@ -1034,9 +1034,10 @@
           hrReturn = E_FAIL;
           m_bWriteFailed = TRUE;	
 
-          /* Due to a bug in Outlook the error is ignored and the
-             message sent out anyway.  Thus we better delete the stuff
-             now. */
+	  /* Outlook should now correctly react and do not deliver
+	     the message in case of an error.
+	   */
+	  #if 0
           if (m_pExchExt->m_gpgEncrypt)
             {
               log_debug ("%s:%s: deleting property PR_BODY due to error\n",
@@ -1050,7 +1051,7 @@
               /* FIXME: We should delete the attachments too. 
                  We really, really should do this!!!          */
             }
-          
+          #endif
         }
     }
 

Deleted: trunk/src/olgpgcore.def

Modified: trunk/src/passphrase-dialog.c
===================================================================
--- trunk/src/passphrase-dialog.c	2006-06-14 15:49:15 UTC (rev 155)
+++ trunk/src/passphrase-dialog.c	2006-08-16 10:42:52 UTC (rev 156)
@@ -20,7 +20,9 @@
  * 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
 #include <windows.h>
 #include <time.h>
@@ -38,7 +40,7 @@
 /* Object to maintai8n state in the dialogs. */
 struct dialog_context_s
 {
-  struct decrypt_key_s *dec; /* The decryption info. */
+  struct passphrase_cb_s *dec; /* The decryption info. */
 
   gpgme_key_t *keyarray;     /* NULL or an array of keys. */
 
@@ -54,7 +56,7 @@
 
 
 static void
-set_key_hint (struct decrypt_key_s *dec, HWND dlg, int ctrlid)
+set_key_hint (struct passphrase_cb_s *dec, HWND dlg, int ctrlid)
 {
   const char *s = dec->user_id;
   char *key_hint;
@@ -93,12 +95,11 @@
 {
   size_t n;
 
-  if (array)
-    {
-      for (n=0; array[n]; n++)
-        gpgme_key_release (array[n]);
-      xfree (array);
-    }
+  if (!array)
+    return;
+  for (n=0; array[n]; n++)
+    gpgme_key_release (array[n]);
+  xfree (array);
 }
 
 /* Return the number of keys in the key array KEYS. */
@@ -147,7 +148,10 @@
     goto fail;
   err = gpgme_op_keylist_start (keyctx, buffer, 0);
   if (err)
-    goto fail;
+    {
+      log_error ("failed to initialize keylisting: %s", gpg_strerror (err));
+      goto fail;
+    }
 
   while (!gpgme_op_keylist_next (keyctx, &key))
     {
@@ -304,9 +308,8 @@
   /* Fixme: We should not use a static here but keep it in an array
      index by DLG. */
   static struct dialog_context_s *context; 
-  struct decrypt_key_s *dec;
+  struct passphrase_cb_s *dec;
   size_t n;
-  const char *warn;
 
   if (msg == WM_INITDIALOG)
     {
@@ -356,11 +359,6 @@
       context->hide_state = 1;
       break;
 
-    case WM_SYSCOMMAND:
-      if (wparam == SC_CLOSE)
-        EndDialog (dlg, TRUE);
-      break;
-
     case WM_COMMAND:
       switch (HIWORD (wparam)) 
         {
@@ -405,28 +403,8 @@
           break;
           
 	case IDCANCEL:
-          if (context->no_encrypt_warning)
-            {
-              warn = _("If you cancel this dialog, the message will be sent"
-                       " in cleartext!\n\n"
-                       "Do you really want to cancel?");
-            }
-          else if (dec && context->use_as_cb && (dec->flags & 0x01)) 
-            {
-              warn = _("If you cancel this dialog, the message"
-                       " will be sent without signing.\n\n"
-                       "Do you really want to cancel?");
-            }
-          else
-            warn = NULL;
-
-          if (warn)
-            {
-              n = MessageBox (dlg, warn, _("Secret Key Dialog"),
-                              MB_ICONWARNING|MB_YESNO);
-              if (n == IDNO)
-                return FALSE;
-	    }
+	  /* Outlook show now correctly abort the sending process
+	     and thus no warning is shown any longer. */
           if (dec)
             {
               dec->opts = OPT_FLAG_CANCEL;
@@ -448,9 +426,8 @@
   /* Fixme: We should not use a static here but keep it in an array
      index by DLG. */
   static struct dialog_context_s *context; 
-  struct decrypt_key_s * dec;
+  struct passphrase_cb_s * dec;
   size_t n;
-  const char *warn;
 
   if (msg == WM_INITDIALOG)
     {
@@ -469,7 +446,7 @@
                       (dec && dec->last_was_bad)?
                       _("Invalid passphrase; please try again..."):"");
       if (dec)
-        load_recipbox (dlg, IDC_DECEXT_RSET, (gpgme_ctx_t)dec->ctx);
+        load_recipbox (dlg, IDC_DECEXT_RSET, dec->ctx);
 
       CheckDlgButton (dlg, IDC_DECEXT_HIDE, BST_CHECKED);
       center_window (dlg, NULL);
@@ -489,11 +466,6 @@
       context->hide_state = 1;
       break;
 
-    case WM_SYSCOMMAND:
-      if (wparam == SC_CLOSE)
-        EndDialog (dlg, TRUE);
-      break;
-
     case WM_COMMAND:
       switch (HIWORD (wparam)) 
         {
@@ -517,35 +489,14 @@
           n = SendDlgItemMessage (dlg, IDC_DECEXT_PASS, WM_GETTEXTLENGTH,0,0);
           if (n && dec) 
             {
-              dec->pass = xmalloc ( n + 2 );
-              GetDlgItemText (dlg, IDC_DECEXT_PASS, dec->pass, n+1 );
+              dec->pass = xmalloc (n + 2);
+              GetDlgItemText (dlg, IDC_DECEXT_PASS, dec->pass, n+1);
 	    }
           EndDialog (dlg, TRUE);
           break;
 
 	case IDCANCEL:
-          if (context->no_encrypt_warning)
-            {
-              warn = _("If you cancel this dialog, the message will be sent"
-                       " in cleartext!\n\n"
-                       "Do you really want to cancel?");
-            }
-          else if (dec && context->use_as_cb && (dec->flags & 0x01)) 
-            {
-              warn = _("If you cancel this dialog, the message"
-                       " will be sent without signing.\n"
-                       "Do you really want to cancel?");
-            }
-          else
-            warn = NULL;
-
-          if (warn)
-            {
-              n = MessageBox (dlg, warn, _("Secret Key Dialog"),
-                              MB_ICONWARNING|MB_YESNO);
-              if (n == IDNO)
-                return FALSE;
-	    }
+	  /* See comment in decrypt_key_dlg_proc. */
           if (dec)
             {
               dec->opts = OPT_FLAG_CANCEL;
@@ -568,7 +519,7 @@
 signer_dialog_box (gpgme_key_t *r_key, char **r_passwd, int encrypting)
 {
   struct dialog_context_s context; 
-  struct decrypt_key_s dec;
+  struct passphrase_cb_s dec;
   int resid;
 
   memset (&context, 0, sizeof context);
@@ -616,7 +567,7 @@
 			 const char *pass_info,
 			 int prev_was_bad, int fd)
 {
-  struct decrypt_key_s *dec = opaque;
+  struct passphrase_cb_s *dec = opaque;
   DWORD nwritten = 0;
   char keyidstr[16+1];
   int resid;
@@ -738,7 +689,7 @@
       xfree (dec->user_id);
       dec->user_id = utf8_to_native (s);
       dec->last_was_bad = prev_was_bad;
-      if (dec->flags & 0x01)
+      if (!dec->decrypt_cmd)
         {
           if (!strncmp (gettext_localename (), "de", 2))
             resid = IDD_DEC_DE;
@@ -782,7 +733,7 @@
 
 /* Release the context which was used in the passphrase callback. */
 void
-free_decrypt_key (struct decrypt_key_s * ctx)
+free_decrypt_key (struct passphrase_cb_s *ctx)
 {
     if (!ctx)
 	return;

Modified: trunk/src/recipient-dialog.c
===================================================================
--- trunk/src/recipient-dialog.c	2006-06-14 15:49:15 UTC (rev 155)
+++ trunk/src/recipient-dialog.c	2006-08-16 10:42:52 UTC (rev 156)
@@ -1,6 +1,6 @@
 /* recipient-dialog.c
  *	Copyright (C) 2004 Timo Schulz
- *	Copyright (C) 2005 g10 Code GmbH
+ *	Copyright (C) 2005, 2006 g10 Code GmbH
  *
  * This file is part of GPGol.
  * 
@@ -20,12 +20,19 @@
  * 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
 
+#ifndef _WIN32_IE /* allow to use advanced list view modes. */
+#define _WIN32_IE 0x0600
+#endif
+
 #include <windows.h>
 #include <commctrl.h>
 #include <time.h>
 #include <gpgme.h>
+#include <assert.h>
 
 #include "gpgol-ids.h"
 #include "intern.h"
@@ -87,29 +94,29 @@
     col.pszText = "E-Mail";
     col.cx = 100;
     col.iSubItem = 1;
-    ListView_InsertColumn( hwnd, 1, &col );
+    ListView_InsertColumn (hwnd, 1, &col);
 
     col.pszText = "Key-Info";
-    col.cx = 110;
+    col.cx = 100;
     col.iSubItem = 2;
-    ListView_InsertColumn( hwnd, 2, &col );
+    ListView_InsertColumn (hwnd, 2, &col);
 
     col.pszText = "Key ID";
-    col.cx = 70;
+    col.cx = 80;
     col.iSubItem = 3;
-    ListView_InsertColumn( hwnd, 3, &col );
+    ListView_InsertColumn (hwnd, 3, &col);
 
     col.pszText = "Validity";
     col.cx = 70;
     col.iSubItem = 4;
-    ListView_InsertColumn( hwnd, 4, &col );
+    ListView_InsertColumn (hwnd, 4, &col);
 
     col.pszText = "Index";
     col.cx = 0;  /* Hide it. */
     col.iSubItem = 5;
-    ListView_InsertColumn( hwnd, 5, &col );
+    ListView_InsertColumn (hwnd, 5, &col);
 
-/*     ListView_SetExtendedListViewStyleEx( hwnd, 0, LVS_EX_FULLROWSELECT ); */
+    ListView_SetExtendedListViewStyleEx (hwnd, 0, LVS_EX_FULLROWSELECT);
 }
 
 
@@ -126,12 +133,12 @@
   char keybuf[128], *s;
   const char *trust_items[] = 
     {
-      "UNKNOWN",
-      "UNDEFINED",
-      "NEVER",
-      "MARGINAL",
-      "FULL",
-      "ULTIMATE"
+      "Unknown",
+      "Undefined",
+      "Never",
+      "Marginal",
+      "Full",
+      "Ultimate"
     };
   enum {COL_NAME, COL_EMAIL, COL_KEYINF, COL_KEYID, COL_TRUST, COL_IDX};
   DWORD val;
@@ -208,8 +215,11 @@
       s = keybuf;
       ListView_SetItemText (hwnd, 0, COL_KEYINF, s);
       
-      if (key->subkeys->keyid  && strlen (key->subkeys->keyid) > 8)
-        ListView_SetItemText (hwnd, 0, COL_KEYID, key->subkeys->keyid+8);
+      if (key->subkeys->keyid  && strlen (key->subkeys->keyid) > 8) 
+	{
+	  _snprintf (keybuf, sizeof (keybuf)-1, "0x%s", key->subkeys->keyid+8);
+	  ListView_SetItemText (hwnd, 0, COL_KEYID, keybuf);
+	}
       
       val = key->uids->validity;
       if (val < 0 || val > 5) 
@@ -221,6 +231,8 @@
       /* I'd like to use SetItemData but that one is only available as
          a member function of CListCtrl; I haved not figured out how
          the vtable is made up.  Thus we use a string with the index. */
+      /* ts: this can be done via the lParam (LVIF_PARAM) item in LVITEM.
+             I will implement this ASAP. */
       sprintf (keybuf, "%u", (unsigned int)pos);
       s = keybuf;
       ListView_SetItemText (hwnd, 0, COL_IDX, s);
@@ -255,12 +267,11 @@
 {
   size_t n;
 
-  if (array)
-    {
-      for (n=0; n < count; n++)
-        gpgme_key_release (array[n]);
-      xfree (array);
-    }
+  if (!array)
+    return;
+  for (n=0; n < count; n++)
+    gpgme_key_release (array[n]);
+  xfree (array);
 }
 
 
@@ -352,10 +363,8 @@
 recipient_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
 {
   static struct recipient_cb_s * rset_cb;
-  static int rset_state = 1;
   NMHDR *notify;
   HWND hrset;
-  const char *warn;
   size_t pos;
   int i, j;
 
@@ -363,7 +372,7 @@
     {
     case WM_INITDIALOG:
       rset_cb = (struct recipient_cb_s *)lparam;
-
+      assert (rset_cb != NULL);
       initialize_rsetbox (GetDlgItem (dlg, IDC_ENC_RSET1));
       rset_cb->keyarray = load_rsetbox (GetDlgItem (dlg, IDC_ENC_RSET1),
                                         &rset_cb->keyarray_count);
@@ -383,15 +392,6 @@
       SetForegroundWindow (dlg);
       return TRUE;
 
-    case WM_DESTROY:
-      rset_state = 1; /* reset to default. */
-      break;
-      
-    case WM_SYSCOMMAND:
-      if (wparam == SC_CLOSE)
-        EndDialog (dlg, TRUE);
-      break;
-
     case WM_NOTIFY:
       notify = (LPNMHDR)lparam;
       if (notify && notify->code == NM_DBLCLK
@@ -401,19 +401,6 @@
       break;
 
     case WM_COMMAND:
-      switch (HIWORD (wparam))
-        {
-	case BN_CLICKED:
-          if ((int)LOWORD (wparam) == IDC_ENC_OPTSYM)
-            {
-              rset_state ^= 1;
-              EnableWindow (GetDlgItem (dlg, IDC_ENC_RSET1), rset_state);
-              EnableWindow (GetDlgItem (dlg, IDC_ENC_RSET2), rset_state);
-              ListView_DeleteAllItems (GetDlgItem (dlg, IDC_ENC_RSET2));
-	    }
-          break;
-	}
-
       switch (LOWORD (wparam))
         {
 	case IDOK:
@@ -479,16 +466,10 @@
           break;
 
 	case IDCANCEL:
-          warn = _("If you cancel this dialog, the message will be sent"
-                   " in cleartext.\n\n"
-                   "Do you really want to cancel?");
-          i = MessageBox (dlg, warn, _("Recipient Dialog"),
-                          MB_ICONWARNING|MB_YESNO);
-          if (i != IDNO)
-            {
-              rset_cb->opts = OPT_FLAG_CANCEL;
-              EndDialog (dlg, FALSE);
-            }
+	  /* now that Outlook correctly aborts the delivery, we do not
+	     need any warning message if the user cancels thi dialog. */
+	  rset_cb->opts = OPT_FLAG_CANCEL;
+	  EndDialog (dlg, FALSE);
           break;
 	}
       break;

Modified: trunk/src/sign.bmp
===================================================================
(Binary files differ)




More information about the Gnupg-commits mailing list