[svn] GpgOL - r189 - trunk/src

svn author wk cvs at cvs.gnupg.org
Wed Oct 10 19:17:00 CEST 2007


Author: wk
Date: 2007-10-10 19:16:51 +0200 (Wed, 10 Oct 2007)
New Revision: 189

Modified:
   trunk/src/ChangeLog
   trunk/src/common.h
   trunk/src/engine-assuan.c
   trunk/src/ext-commands.cpp
   trunk/src/ext-commands.h
   trunk/src/main.c
   trunk/src/message-events.cpp
   trunk/src/message.cpp
   trunk/src/message.h
   trunk/src/olflange-dlgs.cpp
   trunk/src/olflange-ids.h
   trunk/src/olflange-rsrcs.rc
   trunk/src/olflange.cpp
   trunk/src/olflange.h
Log:
Added missing commands for engine-assuan.c.
Add option to select S/MIME.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/ChangeLog	2007-10-10 17:16:51 UTC (rev 189)
@@ -1,3 +1,8 @@
+2007-10-10  Werner Koch  <wk at g10code.com>
+
+	* main.c (read_options): Remove saveDecryptedAttachment.  Add
+	smimeDefault.
+
 2007-10-08  Werner Koch  <wk at g10code.com>
 
 	* main.c (do_log): Remove trailing LF from w32 error message and

Modified: trunk/src/common.h
===================================================================
--- trunk/src/common.h	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/common.h	2007-10-10 17:16:51 UTC (rev 189)
@@ -103,9 +103,9 @@
 struct 
 {
   int passwd_ttl;            /* Time in seconds the passphrase is stored. */
+  int smime_default;         /* Use S/MIME by default. */
   int encrypt_default;       /* Encrypt by default. */
   int sign_default;          /* Sign by default. */
-  int save_decrypted_attach; /* Save decrypted attachments. */
   int auto_sign_attach;	     /* Sign all outgoing attachments. */
   int enc_format;            /* Encryption format for attachments. */
   char *default_key;         /* The key we want to always encrypt to. */

Modified: trunk/src/engine-assuan.c
===================================================================
--- trunk/src/engine-assuan.c	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/engine-assuan.c	2007-10-10 17:16:51 UTC (rev 189)
@@ -69,6 +69,7 @@
   gpgme_data_t status_data;
   status_buffer_t status_buffer; /* Allocated on demand.  */
   int status_ready;
+  gpgme_data_t sigdata;   /* Used by verify_closure.  */
   gpg_error_t last_err;
 };
 
@@ -138,6 +139,20 @@
 }
 
 
+static void
+close_pipe (HANDLE apipe[2])
+{
+  int i;
+
+  for (i=0; i < 2; i++)
+    if (apipe[i] != INVALID_HANDLE_VALUE)
+      {
+        CloseHandle (apipe[i]);
+        apipe[i] = INVALID_HANDLE_VALUE;
+      }
+}
+
+
 /* Duplicate HANDLE into the server's process and close HANDLE.  Note
    that HANDLE is closed even if the function fails.  Returns the
    duplicated handle on success or INVALID_HANDLE_VALUE on error.  */
@@ -1099,10 +1114,21 @@
 }
 
 
+static const char *
+get_protocol_name (protocol_t protocol)
+{
+  switch (protocol)
+    {
+    case PROTOCOL_OPENPGP: return "OpenPGP"; break;
+    case PROTOCOL_SMIME:   return "CMS"; break;
+    default: return NULL;
+    }
+}
 
+
 
 /* Note that this closure is called in the context of the
-   waiter_thread.  */
+   async_worker_thread.  */
 static void
 encrypt_closure (closure_data_t cld)
 {
@@ -1134,7 +1160,11 @@
   pid_t pid;
   int i;
   char *p;
+  const char *protocol_name;
 
+  if (!(protocol_name = get_protocol_name (protocol)))
+    return gpg_error(GPG_ERR_INV_VALUE);
+
   err = connect_uiserver (&ctx, &pid, &cmdid, hwnd);
   if (err)
     return err;
@@ -1143,8 +1173,7 @@
     return err;
   if ((err = create_io_pipe (outpipe, pid, 0)))
     {
-      CloseHandle (inpipe[0]);
-      CloseHandle (outpipe[0]);
+      close_pipe (inpipe);
       return err;
     }
 
@@ -1183,12 +1212,8 @@
                     cmdid, NULL, 0); 
   enqueue_callback ("output", ctx, outdata, outpipe[0], 0, finalize_handler, 
                     cmdid, NULL, 1 /* Wait on success */); 
-  err = start_command (ctx, cld, cmdid, 
-                       (protocol == PROTOCOL_OPENPGP
-                        ? "ENCRYPT --protocol=OpenPGP"
-                        : protocol == PROTOCOL_SMIME
-                        ? "ENCRYPT --protocol=CMS"
-                        : "ENCRYPT --protocol=unknown-protocol"));
+  snprintf (line, sizeof line, "ENCRYPT --protocol=%s", protocol_name);
+  err = start_command (ctx, cld, cmdid, line);
   cld = NULL; /* Now owned by start_command.  */
   if (err)
     goto leave;
@@ -1198,14 +1223,8 @@
   if (err)
     {
       /* Fixme: Cancel stuff in the work_queue. */
-      if (inpipe[0] != INVALID_HANDLE_VALUE)
-        CloseHandle (inpipe[0]);
-      if (inpipe[1] != INVALID_HANDLE_VALUE)
-        CloseHandle (inpipe[1]);
-      if (outpipe[0] != INVALID_HANDLE_VALUE)
-        CloseHandle (outpipe[0]);
-      if (outpipe[1] != INVALID_HANDLE_VALUE)
-        CloseHandle (outpipe[1]);
+      close_pipe (inpipe);
+      close_pipe (outpipe);
       xfree (cld);
       assuan_disconnect (ctx);
     }
@@ -1216,33 +1235,278 @@
 
 
 
+/* Note that this closure is called in the context of the
+   async_worker_thread.  */
+static void
+sign_closure (closure_data_t cld)
+{
+  engine_private_finished (cld->filter, cld->final_err);
+}
+
+
+/* Created a detached signature for INDATA and write it to OUTDATA.
+   On termination of the signing command engine_private_finished() is
+   called with FILTER as the first argument.  */
 int 
 op_assuan_sign (protocol_t protocol, 
                 gpgme_data_t indata, gpgme_data_t outdata,
                 engine_filter_t filter, void *hwnd)
 {
-  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+  gpg_error_t err;
+  closure_data_t cld;
+  assuan_context_t ctx;
+  char line[1024];
+  HANDLE inpipe[2], outpipe[2];
+  ULONG cmdid;
+  pid_t pid;
+  const char *protocol_name;
+
+
+  if (!(protocol_name = get_protocol_name (protocol)))
+    return gpg_error(GPG_ERR_INV_VALUE);
+
+  err = connect_uiserver (&ctx, &pid, &cmdid, hwnd);
+  if (err)
+    return err;
+
+  if ((err = create_io_pipe (inpipe, pid, 1)))
+    return err;
+  if ((err = create_io_pipe (outpipe, pid, 0)))
+    {
+      close_pipe (inpipe);
+      return err;
+    }
+
+  cld = xcalloc (1, sizeof *cld);
+  cld->closure = sign_closure;
+  cld->filter = filter;
+
+  err = assuan_transact (ctx, "RESET", NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+
+  snprintf (line, sizeof line, "INPUT FD=%ld", (unsigned long int)inpipe[0]);
+  err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+  snprintf (line, sizeof line, "OUTPUT FD=%ld", (unsigned long int)outpipe[1]);
+  err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+
+  /* FIXME: Implement the optinonal SENDER command. */
+
+  enqueue_callback (" input", ctx, indata, inpipe[1], 1, finalize_handler,
+                    cmdid, NULL, 0); 
+  enqueue_callback ("output", ctx, outdata, outpipe[0], 0, finalize_handler, 
+                    cmdid, NULL, 1 /* Wait on success */); 
+
+  snprintf (line, sizeof line, "SIGN --protocol=%s --detached",
+            protocol_name);
+  err = start_command (ctx, cld, cmdid, line);
+  cld = NULL; /* Now owned by start_command.  */
+  if (err)
+    goto leave;
+
+
+ leave:
+  if (err)
+    {
+      /* Fixme: Cancel stuff in the work_queue. */
+      close_pipe (inpipe);
+      close_pipe (outpipe);
+      xfree (cld);
+      assuan_disconnect (ctx);
+    }
+  else
+    engine_private_set_cancel (filter, ctx);
+  return err;
 }
 
 
+
 
+/* Note that this closure is called in the context of the
+   async_worker_thread.  */
+static void
+decrypt_closure (closure_data_t cld)
+{
+  engine_private_finished (cld->filter, cld->final_err);
+}
+
+
+/* Decrypt data from INDATA to OUTDATE.  If WITH_VERIFY is set, the
+   signature of a PGP/MIME combined message is also verified the same
+   way as with op_assuan_verify.  */
 int 
 op_assuan_decrypt (protocol_t protocol,
                    gpgme_data_t indata, gpgme_data_t outdata, 
                    engine_filter_t filter, void *hwnd,
                    int with_verify)
 {
-  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+  gpg_error_t err;
+  closure_data_t cld;
+  assuan_context_t ctx;
+  char line[1024];
+  HANDLE inpipe[2], outpipe[2];
+  ULONG cmdid;
+  pid_t pid;
+  const char *protocol_name;
+
+  if (!(protocol_name = get_protocol_name (protocol)))
+    return gpg_error(GPG_ERR_INV_VALUE);
+
+  err = connect_uiserver (&ctx, &pid, &cmdid, hwnd);
+  if (err)
+    return err;
+
+  if ((err = create_io_pipe (inpipe, pid, 1)))
+    return err;
+  if ((err = create_io_pipe (outpipe, pid, 0)))
+    {
+      close_pipe (inpipe);
+      return err;
+    }
+
+  cld = xcalloc (1, sizeof *cld);
+  cld->closure = decrypt_closure;
+  cld->filter = filter;
+
+  err = assuan_transact (ctx, "RESET", NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+
+  snprintf (line, sizeof line, "INPUT FD=%ld", (unsigned long int)inpipe[0]);
+  err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+  snprintf (line, sizeof line, "OUTPUT FD=%ld", (unsigned long int)outpipe[1]);
+  err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+
+  enqueue_callback (" input", ctx, indata, inpipe[1], 1, finalize_handler,
+                    cmdid, NULL, 0); 
+  enqueue_callback ("output", ctx, outdata, outpipe[0], 0, finalize_handler, 
+                    cmdid, NULL, 1 /* Wait on success */); 
+
+  snprintf (line, sizeof line, "DECRYPT --protocol=%s%s",
+            protocol_name, with_verify? "":" --no-verify");
+  err = start_command (ctx, cld, cmdid, line);
+  cld = NULL; /* Now owned by start_command.  */
+  if (err)
+    goto leave;
+
+
+ leave:
+  if (err)
+    {
+      /* Fixme: Cancel stuff in the work_queue. */
+      close_pipe (inpipe);
+      close_pipe (outpipe);
+      xfree (cld);
+      assuan_disconnect (ctx);
+    }
+  else
+    engine_private_set_cancel (filter, ctx);
+  return err;
 }
 
 
 
+/* Note that this closure is called in the context of the
+   async_worker_thread.  */
+static void
+verify_closure (closure_data_t cld)
+{
+  gpgme_data_release (cld->sigdata);
+  cld->sigdata = NULL;
+  engine_private_finished (cld->filter, cld->final_err);
+}
+
+
+/* Verify a detached message where the data is in the gpgme object
+   MSGDATA and the signature given as the string SIGNATURE. */
 int 
 op_assuan_verify (gpgme_protocol_t protocol, 
-                   gpgme_data_t data, const char *signature,
-                   engine_filter_t filter, void *hwnd)
+                  gpgme_data_t msgdata, const char *signature,
+                  engine_filter_t filter, void *hwnd)
 {
-  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
+  gpg_error_t err;
+  closure_data_t cld = NULL;
+  assuan_context_t ctx;
+  char line[1024];
+  HANDLE msgpipe[2], sigpipe[2];
+  ULONG cmdid;
+  pid_t pid;
+  gpgme_data_t sigdata = NULL;
+  const char *protocol_name;
+
+  msgpipe[0] = INVALID_HANDLE_VALUE;
+  msgpipe[1] = INVALID_HANDLE_VALUE;
+  sigpipe[0] = INVALID_HANDLE_VALUE;
+  sigpipe[1] = INVALID_HANDLE_VALUE;
+
+  if (!(protocol_name = get_protocol_name (protocol)))
+    return gpg_error(GPG_ERR_INV_VALUE);
+
+  err = gpgme_data_new_from_mem (&sigdata, signature, strlen (signature), 0);
+  if (err)
+    goto leave;
+
+  err = connect_uiserver (&ctx, &pid, &cmdid, hwnd);
+  if (err)
+    goto leave;
+
+  if ((err = create_io_pipe (msgpipe, pid, 1)))
+    goto leave;
+  if ((err = create_io_pipe (sigpipe, pid, 1)))
+    goto leave;
+
+  cld = xcalloc (1, sizeof *cld);
+  cld->closure = verify_closure;
+  cld->filter = filter;
+  cld->sigdata = sigdata;
+
+  err = assuan_transact (ctx, "RESET", NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+
+  snprintf (line, sizeof line, "MESSAGE FD=%ld",(unsigned long int)msgpipe[0]);
+  err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+  snprintf (line, sizeof line, "INPUT FD=%ld", (unsigned long int)sigpipe[0]);
+  err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
+  if (err)
+    goto leave;
+
+  enqueue_callback ("   msg", ctx, msgdata, msgpipe[1], 1, finalize_handler,
+                    cmdid, NULL, 0); 
+  enqueue_callback ("   sig", ctx, sigdata, sigpipe[1], 1, finalize_handler, 
+                    cmdid, NULL, 0); 
+
+  snprintf (line, sizeof line, "VERIFY --protocol=%s",  protocol_name);
+  err = start_command (ctx, cld, cmdid, line);
+  cld = NULL;     /* Now owned by start_command.  */
+  sigdata = NULL; /* Ditto.  */
+  if (err)
+    goto leave;
+
+
+ leave:
+  if (err)
+    {
+      /* Fixme: Cancel stuff in the work_queue. */
+      close_pipe (msgpipe);
+      close_pipe (sigpipe);
+      gpgme_data_release (sigdata);
+      xfree (cld);
+      assuan_disconnect (ctx);
+    }
+  else
+    engine_private_set_cancel (filter, ctx);
+  return err;
 }
 
 

Modified: trunk/src/ext-commands.cpp
===================================================================
--- trunk/src/ext-commands.cpp	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/ext-commands.cpp	2007-10-10 17:16:51 UTC (rev 189)
@@ -78,6 +78,7 @@
   m_pExchExt = pParentInterface; 
   m_lRef = 0; 
   m_lContext = 0; 
+  m_nCmdSelectSmime = 0;
   m_nCmdEncrypt = 0;  
   m_nCmdDecrypt = 0;  
   m_nCmdSign = 0; 
@@ -88,8 +89,10 @@
   m_nCmdDebug2 = 0;
   m_nToolbarButtonID1 = 0; 
   m_nToolbarButtonID2 = 0; 
+  m_nToolbarButtonID3 = 0; 
   m_nToolbarBitmap1 = 0;
   m_nToolbarBitmap2 = 0; 
+  m_nToolbarBitmap3 = 0; 
   m_hWnd = NULL; 
 }
 
@@ -345,6 +348,7 @@
   if (m_lContext == EECONTEXT_SENDNOTEMESSAGE) 
     {
       toolbar_add_menu (pEECB, pnCommandIDBase, "", NULL,
+                        _("use S/MIME protocol"), &m_nCmdSelectSmime,
                         _("&encrypt message with GnuPG"), &m_nCmdEncrypt,
                         _("&sign message with GnuPG"), &m_nCmdSign,
                         NULL );
@@ -367,8 +371,16 @@
           tbab.nID = IDB_SIGN;
           m_nToolbarBitmap2 = SendMessage (hwnd_toolbar, TB_ADDBITMAP,
                                            1, (LPARAM)&tbab);
+
+          m_nToolbarButtonID3 = pTBEArray[tb_idx].itbbBase;
+          pTBEArray[tb_idx].itbbBase++;
+
+          tbab.nID = IDB_SELECT_SMIME;
+          m_nToolbarBitmap3 = SendMessage (hwnd_toolbar, TB_ADDBITMAP,
+                                           1, (LPARAM)&tbab);
         }
 
+      m_pExchExt->m_gpgSelectSmime = opt.smime_default;
       m_pExchExt->m_gpgEncrypt = opt.encrypt_default;
       m_pExchExt->m_gpgSign    = opt.sign_default;
       if (force_encrypt)
@@ -509,6 +521,11 @@
       ul_release (message);
       ul_release (mdb);
     }
+  else if (nCommandID == m_nCmdSelectSmime
+           && m_lContext == EECONTEXT_SENDNOTEMESSAGE) 
+    {
+      m_pExchExt->m_gpgSelectSmime = !m_pExchExt->m_gpgSelectSmime;
+    }
   else if (nCommandID == m_nCmdEncrypt
            && m_lContext == EECONTEXT_SENDNOTEMESSAGE) 
     {
@@ -588,6 +605,13 @@
                   _("Check the signature now and display the result"),
                   "GpgOL", MB_OK);
     }
+  else if (nCommandID == m_nCmdSelectSmime
+           && m_lContext == EECONTEXT_SENDNOTEMESSAGE) 
+    {
+      MessageBox (m_hWnd,
+                  _("Select this option to select the S/MIME protocol."),
+                  "GpgOL", MB_OK);	
+    } 
   else if (nCommandID == m_nCmdEncrypt 
            && m_lContext == EECONTEXT_SENDNOTEMESSAGE) 
     {
@@ -656,6 +680,16 @@
                   _("Check the signature now and display the result"),
                   nCharCnt);
     }
+  else if (nCommandID == m_nCmdSelectSmime
+           && m_lContext == EECONTEXT_SENDNOTEMESSAGE) 
+    {
+      if (lFlags == EECQHT_STATUS)
+        lstrcpyn (pszText, ".", nCharCnt);
+      if (lFlags == EECQHT_TOOLTIP)
+        lstrcpyn (pszText,
+                  _("Use S/MIME for sign/encrypt"),
+                  nCharCnt);
+    }
   else if (nCommandID == m_nCmdEncrypt
            && m_lContext == EECONTEXT_SENDNOTEMESSAGE) 
     {
@@ -749,6 +783,20 @@
       lstrcpyn (description, _("Sign message with GPG"),
                 description_size);
     }
+  else if (buttonid == m_nToolbarButtonID3
+           && m_lContext == EECONTEXT_SENDNOTEMESSAGE)
+    {
+      pTBB->iBitmap = m_nToolbarBitmap3;             
+      pTBB->idCommand = m_nCmdSelectSmime;
+      pTBB->fsState = TBSTATE_ENABLED;
+      if (m_pExchExt->m_gpgSelectSmime)
+        pTBB->fsState |= TBSTATE_CHECKED;
+      pTBB->fsStyle = TBSTYLE_BUTTON | TBSTYLE_CHECK;
+      pTBB->dwData = 0;
+      pTBB->iString = -1;
+      lstrcpyn (description, _("Use the S/MIME protocol"),
+                description_size);
+    }
   else if (buttonid == m_nToolbarButtonID1
            && m_lContext == EECONTEXT_VIEWER)
     {

Modified: trunk/src/ext-commands.h
===================================================================
--- trunk/src/ext-commands.h	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/ext-commands.h	2007-10-10 17:16:51 UTC (rev 189)
@@ -37,6 +37,7 @@
   ULONG m_lRef;
   ULONG m_lContext;
   
+  UINT  m_nCmdSelectSmime;
   UINT  m_nCmdEncrypt;
   UINT  m_nCmdDecrypt;
   UINT  m_nCmdSign;
@@ -48,8 +49,10 @@
 
   UINT  m_nToolbarButtonID1;
   UINT  m_nToolbarButtonID2;     
+  UINT  m_nToolbarButtonID3;     
   UINT  m_nToolbarBitmap1;
   UINT  m_nToolbarBitmap2;
+  UINT  m_nToolbarBitmap3;
   
   HWND  m_hWnd;
   

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/main.c	2007-10-10 17:16:51 UTC (rev 189)
@@ -483,8 +483,8 @@
   opt.auto_sign_attach = val == NULL || *val != '1' ? 0 : 1;
   xfree (val); val = NULL;
   
-  load_extension_value ("saveDecryptedAttachments", &val);
-  opt.save_decrypted_attach = val == NULL || *val != '1'? 0 : 1;
+  load_extension_value ("smimeDefault", &val);
+  opt.smime_default = val == NULL || *val != '1'? 0 : 1;
   xfree (val); val = NULL;
 
   load_extension_value ("encryptDefault", &val);
@@ -566,9 +566,9 @@
     int  value;
     char *s_val;
   } table[] = {
+    {"smimeDefault",             0, opt.smime_default},
     {"encryptDefault",           0, opt.encrypt_default},
     {"signDefault",              0, opt.sign_default},
-    {"saveDecryptedAttachments", 0, opt.save_decrypted_attach},
     {"autoSignAttachments",      0, opt.auto_sign_attach},
     {"previewDecrypt",           0, opt.preview_decrypt},
     {"storePasswdTime",          1, opt.passwd_ttl},

Modified: trunk/src/message-events.cpp
===================================================================
--- trunk/src/message-events.cpp	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/message-events.cpp	2007-10-10 17:16:51 UTC (rev 189)
@@ -272,12 +272,16 @@
   HRESULT hr = eecb->GetObject (&pMDB, (LPMAPIPROP *)&msg);
   if (SUCCEEDED (hr))
     {
+      protocol_t proto = (m_pExchExt->m_gpgSelectSmime
+                          ? PROTOCOL_SMIME
+                          : PROTOCOL_OPENPGP);
+      
       if (m_pExchExt->m_gpgEncrypt && m_pExchExt->m_gpgSign)
-        rc = message_sign_encrypt (msg, hWnd);
+        rc = message_sign_encrypt (msg, proto, hWnd);
       else if (m_pExchExt->m_gpgEncrypt && !m_pExchExt->m_gpgSign)
-        rc = message_encrypt (msg, hWnd);
+        rc = message_encrypt (msg, proto, hWnd);
       else if (!m_pExchExt->m_gpgEncrypt && m_pExchExt->m_gpgSign)
-        rc = message_sign (msg, hWnd);
+        rc = message_sign (msg, proto, hWnd);
       else
         rc = 0;
       

Modified: trunk/src/message.cpp
===================================================================
--- trunk/src/message.cpp	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/message.cpp	2007-10-10 17:16:51 UTC (rev 189)
@@ -741,7 +741,7 @@
 
 
 static int
-sign_encrypt (LPMESSAGE message, HWND hwnd, int signflag)
+sign_encrypt (LPMESSAGE message, protocol_t protocol, HWND hwnd, int signflag)
 {
   gpg_error_t err;
   char **recipients;
@@ -757,9 +757,9 @@
   else
     {
       if (signflag)
-        err = mime_sign_encrypt (message, PROTOCOL_OPENPGP, recipients);
+        err = mime_sign_encrypt (message, protocol, recipients);
       else
-        err = mime_encrypt (message, PROTOCOL_OPENPGP, recipients);
+        err = mime_encrypt (message, protocol, recipients);
       if (err)
         {
           char buf[200];
@@ -776,11 +776,11 @@
 
 /* Sign the MESSAGE.  */
 int 
-message_sign (LPMESSAGE message, HWND hwnd)
+message_sign (LPMESSAGE message, protocol_t protocol, HWND hwnd)
 {
   gpg_error_t err;
 
-  err = mime_sign (message, PROTOCOL_OPENPGP);
+  err = mime_sign (message, protocol);
   if (err)
     {
       char buf[200];
@@ -796,17 +796,17 @@
 
 /* Encrypt the MESSAGE.  */
 int 
-message_encrypt (LPMESSAGE message, HWND hwnd)
+message_encrypt (LPMESSAGE message, protocol_t protocol, HWND hwnd)
 {
-  return sign_encrypt (message, hwnd, 0);
+  return sign_encrypt (message, protocol, hwnd, 0);
 }
 
 
 /* Sign+Encrypt the MESSAGE.  */
 int 
-message_sign_encrypt (LPMESSAGE message, HWND hwnd)
+message_sign_encrypt (LPMESSAGE message, protocol_t protocol, HWND hwnd)
 {
-  return sign_encrypt (message, hwnd, 1);
+  return sign_encrypt (message, protocol, hwnd, 1);
 }
 
 

Modified: trunk/src/message.h
===================================================================
--- trunk/src/message.h	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/message.h	2007-10-10 17:16:51 UTC (rev 189)
@@ -31,9 +31,9 @@
 int message_verify (LPMESSAGE message, msgtype_t msgtype, int force);
 int message_decrypt (LPMESSAGE message, msgtype_t msgtype, int force);
 
-int message_sign (LPMESSAGE message, HWND hwnd);
-int message_encrypt (LPMESSAGE message, HWND hwnd);
-int message_sign_encrypt (LPMESSAGE message, HWND hwnd);
+int message_sign (LPMESSAGE message, protocol_t protocol, HWND hwnd);
+int message_encrypt (LPMESSAGE message, protocol_t protocol, HWND hwnd);
+int message_sign_encrypt (LPMESSAGE message, protocol_t protocol, HWND hwnd);
 
 
 #endif /*MESSAGE_H*/

Modified: trunk/src/olflange-dlgs.cpp
===================================================================
--- trunk/src/olflange-dlgs.cpp	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/olflange-dlgs.cpp	2007-10-10 17:16:51 UTC (rev 189)
@@ -117,7 +117,7 @@
 	    case IDC_ENCRYPT_WITH_STANDARD_KEY:
 	    case IDC_PREFER_HTML:
 	    case IDC_SIGN_DEFAULT:
-	    case IDC_SAVE_DECRYPTED:
+	    case IDC_SMIME_DEFAULT:
 	    case IDC_PREVIEW_DECRYPT:
 	    case IDC_SIGN_ATTACHMENTS:
 	      SendMessage (GetParent (hDlg), PSM_CHANGED, (WPARAM)hDlg, 0L);
@@ -159,8 +159,8 @@
 			        !!opt.sign_default, 0L);
 	    SendDlgItemMessage (hDlg, IDC_ENCRYPT_WITH_STANDARD_KEY,
                                 BM_SETCHECK, opt.enable_default_key, 0L);
-	    SendDlgItemMessage (hDlg, IDC_SAVE_DECRYPTED, BM_SETCHECK, 
-				!!opt.save_decrypted_attach, 0L);
+	    SendDlgItemMessage (hDlg, IDC_SMIME_DEFAULT, BM_SETCHECK, 
+				!!opt.smime_default, 0L);
 	    SendDlgItemMessage (hDlg, IDC_SIGN_ATTACHMENTS, BM_SETCHECK,
 				!!opt.auto_sign_attach, 0L);
 	    SendDlgItemMessage (hDlg, IDC_PREVIEW_DECRYPT, BM_SETCHECK,
@@ -198,8 +198,8 @@
               (hDlg, IDC_ENCRYPT_DEFAULT, BM_GETCHECK, 0, 0L);
 	    opt.sign_default = !!SendDlgItemMessage 
               (hDlg, IDC_SIGN_DEFAULT, BM_GETCHECK, 0, 0L);
-	    opt.save_decrypted_attach = !!SendDlgItemMessage
-              (hDlg, IDC_SAVE_DECRYPTED, BM_GETCHECK, 0, 0L);
+	    opt.smime_default = !!SendDlgItemMessage
+              (hDlg, IDC_SMIME_DEFAULT, BM_GETCHECK, 0, 0L);
             opt.auto_sign_attach = !!SendDlgItemMessage
               (hDlg, IDC_SIGN_ATTACHMENTS, BM_GETCHECK, 0, 0L);
             opt.preview_decrypt = !!SendDlgItemMessage

Modified: trunk/src/olflange-ids.h
===================================================================
--- trunk/src/olflange-ids.h	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/olflange-ids.h	2007-10-10 17:16:51 UTC (rev 189)
@@ -16,7 +16,7 @@
 #define IDB_ADD_KEYS                    4003
 #define IDC_ENCRYPT_WITH_STANDARD_KEY   4003
 #define IDB_KEY_MANAGER                 4004
-#define IDC_SAVE_DECRYPTED              4004
+#define IDC_SMIME_DEFAULT               4004
 #define IDC_GPG_OPTIONS                 4006
 #define IDC_BITMAP                      4007
 #define IDB_BANNER                      4009
@@ -27,5 +27,6 @@
 #define IDD_GPG_OPTIONS_DE              4012
 #define IDC_PREVIEW_DECRYPT             4013
 #define IDC_PREFER_HTML                 4014
+#define IDB_SELECT_SMIME                4015
 
 #endif /*OLFLANGE_IDS_H*/

Modified: trunk/src/olflange-rsrcs.rc
===================================================================
--- trunk/src/olflange-rsrcs.rc	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/olflange-rsrcs.rc	2007-10-10 17:16:51 UTC (rev 189)
@@ -63,8 +63,8 @@
     CONTROL         "Neue Nachrichten per Voreinstellung signieren",
                     IDC_SIGN_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
                     24,30,162,10
-    CONTROL         "Entschlüsselte Attachments automatisch speichern",
-                    IDC_SAVE_DECRYPTED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+    CONTROL         "S/MIME per Voreinstellung verwenden",
+                    IDC_SMIME_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
                     24,42,175,10
     CONTROL         "Automatisch Attachments signieren",IDC_SIGN_ATTACHMENTS,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,54,126,10
@@ -141,8 +141,8 @@
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,19,121,10
     CONTROL         "&Sign new messages by default",IDC_SIGN_DEFAULT,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,24,30,111,10
-    CONTROL         "Save decrypted message &automatically",
-                    IDC_SAVE_DECRYPTED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+    CONTROL         "Use S/MIME by default",
+                    IDC_SMIME_DEFAULT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
                     24,42,139,10
     CONTROL         "Automatically sign attachments",IDC_SIGN_ATTACHMENTS,
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,54,113,10

Modified: trunk/src/olflange.cpp
===================================================================
--- trunk/src/olflange.cpp	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/olflange.cpp	2007-10-10 17:16:51 UTC (rev 189)
@@ -290,6 +290,7 @@
   m_lRef = 1;
   m_lContext = 0;
   m_hWndExchange = 0;
+  m_gpgSelectSmime = FALSE;
   m_gpgEncrypt = FALSE;
   m_gpgSign = FALSE;
   msgtype = MSGTYPE_UNKNOWN;

Modified: trunk/src/olflange.h
===================================================================
--- trunk/src/olflange.h	2007-10-10 13:23:41 UTC (rev 188)
+++ trunk/src/olflange.h	2007-10-10 17:16:51 UTC (rev 189)
@@ -41,6 +41,7 @@
   HWND m_hWndExchange;  /* Handle of the exchange window. */
 
   /* Parameters for sending mails.  */
+  BOOL  m_gpgSelectSmime;
   BOOL  m_gpgEncrypt;
   BOOL  m_gpgSign;
   




More information about the Gnupg-commits mailing list