[git] GpgOL - branch, master, updated. gpgol-1.2.0-92-g6533170

by Andre Heinecke cvs at cvs.gnupg.org
Wed Nov 4 16:52:38 CET 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".

The branch, master has been updated
       via  6533170a34d9e6f7191e41b31045ad0b4b4af1df (commit)
       via  6bc833c018004608df1a76cb10bf826fb545eea2 (commit)
       via  2a24cdbfbc75128b87097f792c854c17cb9084e2 (commit)
       via  0c460a499d0ce486295ebd9d2c3de5a99105c627 (commit)
       via  c41e2e4e1ed7baa57d4047613d543f25349f9895 (commit)
       via  af0e348eb32a33f7a9e58d0cb9cc32b0fb000570 (commit)
       via  0fb822b13c907e0589c2b8278937af5a44d3a67f (commit)
      from  4052dfcc96da23bf617be1e16f771dec4f086cf0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6533170a34d9e6f7191e41b31045ad0b4b4af1df
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 4 16:50:22 2015 +0100

    Use libmapi32 from mingw
    
    * Makefile.am: Remove our own libmapi32 creation
    * mapi32.def: Removed.
    
    --
    The libmapi32 that comes with debian stable (jessie) has all the symbols
    we need. And this solves a linker problem when building for x64.

diff --git a/src/Makefile.am b/src/Makefile.am
index e5cb2c4..2f9a6c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,7 +16,7 @@ unused_sources = item-events.cpp
 bin_PROGRAMS = gpgol 
 #treeview
 EXTRA_DIST = \
-	versioninfo.rc.in mapi32.def $(unused_sources) Outlook.gpl \
+	versioninfo.rc.in $(unused_sources) Outlook.gpl \
 	encrypt-16.bmp encrypt-16m.bmp \
 	sign-16.bmp sign-16m.bmp \
 	key-manager-16.bmp key-manager-16m.bmp \
@@ -86,16 +86,11 @@ gpgol_SOURCES = \
 
 #treeview_SOURCES = treeview.c
 
-# W32API 3.2 comes with an unusable libmapi32.a.  We build our own
-# version.  Note the omission of -k (--kill-at) from the DLLTOOL
-# command line.  We also create our own virtual copies to the _static_
+# We create our own virtual copies to the _static_
 # versions of GPGME and gpg-error, because we want to link to them
 # statically, and not dynamically (otherwise Outlook would not find
 # them).
-gpgol_DEPENDENCIES = libmapi32.a libgpg-error.a libgpgme.a libassuan.a
-
-libmapi32.a: mapi32.def
-	$(DLLTOOL) --output-lib $@ --def $<
+gpgol_DEPENDENCIES = libgpg-error.a libgpgme.a libassuan.a
 
 libgpg-error.a:
 	ln -s $$($(GPG_ERROR_CONFIG) --prefix)/lib/libgpg-error.a .
diff --git a/src/mapi32.def b/src/mapi32.def
deleted file mode 100644
index 2e4fe42..0000000
--- a/src/mapi32.def
+++ /dev/null
@@ -1,164 +0,0 @@
-LIBRARY MAPI32.DLL
-EXPORTS
-BuildDisplayTable at 40
-CbOfEncoded at 4
-CchOfEncoding at 4
-ChangeIdleRoutine at 28
-CloseIMsgSession at 4
-CreateIProp at 24
-CreateTable at 36
-DeinitMapiUtil at 0
-DeregisterIdleRoutine at 4
-EnableIdleRoutine at 8
-EncodeID at 12
-FBadColumnSet at 4
-FBadEntryList at 4
-FBadProp at 4
-FBadPropTag at 4
-FBadRestriction at 4
-FBadRglpNameID at 8
-FBadRglpszA at 8
-FBadRglpszW at 8
-FBadRow at 4
-FBadRowSet at 4
-FBadSortOrderSet at 4
-FBinFromHex at 8
-FDecodeID at 12
-FEqualNames at 8
-FPropCompareProp at 12
-FPropContainsProp at 12
-FPropExists at 8
-FreePadrlist at 4
-FreeProws at 4
-FtAdcFt at 20
-FtAddFt at 16
-FtDivFtBogus at 20
-FtMulDw at 12
-FtMulDwDw at 8
-FtNegFt at 8
-FtSubFt at 16
-FtgRegisterIdleRoutine at 20
-GetAttribIMsgOnIStg at 12
-GetTnefStreamCodepage
-GetTnefStreamCodepage at 12
-HexFromBin at 12
-HrAddColumns at 16
-HrAddColumnsEx at 20
-HrAllocAdviseSink at 12
-HrComposeEID at 28
-HrComposeMsgID at 24
-HrDecomposeEID at 28
-HrDecomposeMsgID at 24
-HrDispatchNotifications at 4
-HrEntryIDFromSz at 12
-HrGetOneProp at 12
-HrIStorageFromStream at 16
-HrQueryAllRows at 24
-HrSetOneProp at 8
-HrSzFromEntryID at 12
-HrThisThreadAdviseSink at 8
-HrValidateIPMSubtree at 20
-HrValidateParameters at 8
-InstallFilterHook at 4
-IsBadBoundedStringPtr at 8
-LAUNCHWIZARD
-LPropCompareProp at 8
-LaunchWizard at 20
-LpValFindProp at 12
-MAPI_NSCP_SynchronizeClient at 8
-MAPIAddress at 44
-MAPIAdminProfiles
-MAPIAdminProfiles at 8
-MAPIAllocateBuffer
-MAPIAllocateBuffer at 8
-MAPIAllocateMore
-MAPIAllocateMore at 12
-MAPIDeinitIdle at 0
-MAPIDeleteMail at 20
-MAPIDetails at 20
-MAPIFindNext at 28
-MAPIFreeBuffer
-MAPIFreeBuffer at 4
-MAPIGetDefaultMalloc at 0
-MAPIGetNetscapeVersion at 0
-MAPIInitIdle at 4
-MAPIInitialize
-MAPIInitialize at 4
-MAPILogoff at 16
-MAPILogon at 24
-MAPILogonEx
-MAPILogonEx at 20
-MAPIOpenFormMgr
-MAPIOpenFormMgr at 8
-MAPIOpenLocalFormContainer
-MAPIOpenLocalFormContainer at 4
-MAPIReadMail at 24
-MAPIResolveName at 24
-MAPISaveMail at 24
-MAPISendDocuments at 20
-MAPISendMail
-MAPISendMail at 20
-MAPIUninitialize
-MAPIUninitialize at 0
-MNLS_CompareStringW at 24
-MNLS_IsBadStringPtrW at 8
-MNLS_MultiByteToWideChar at 24
-MNLS_WideCharToMultiByte at 32
-MNLS_lstrcmpW at 8
-MNLS_lstrcpyW at 8
-MNLS_lstrlenW at 4
-MapStorageSCode at 4
-OpenIMsgOnIStg at 44
-OpenIMsgSession at 12
-OpenStreamOnFile
-OpenStreamOnFile at 24
-OpenTnefStream
-OpenTnefStream at 28
-OpenTnefStreamEx
-OpenTnefStreamEx at 32
-PRProviderInit
-PpropFindProp at 12
-PropCopyMore at 16
-RTFSync
-RTFSync at 12
-ScBinFromHexBounded at 12
-ScCopyNotifications at 16
-ScCopyProps at 16
-ScCountNotifications at 12
-ScCountProps at 12
-ScCreateConversationIndex at 16
-ScDupPropset at 16
-ScGenerateMuid at 4
-ScInitMapiUtil at 4
-ScLocalPathFromUNC at 12
-ScMAPIXFromCMC
-ScMAPIXFromSMAPI
-ScRelocNotifications at 20
-ScRelocProps at 20
-ScSplEntry
-ScUNCFromLocalPath at 12
-SetAttribIMsgOnIStg at 16
-SwapPlong at 8
-SwapPword at 8
-SzFindCh at 8
-SzFindLastCh at 8
-SzFindSz at 8
-UFromSz at 4
-UNKOBJ_COFree at 8
-UNKOBJ_Free at 8
-UNKOBJ_FreeRows at 8
-UNKOBJ_ScAllocate at 12
-UNKOBJ_ScAllocateMore at 16
-UNKOBJ_ScCOAllocate at 12
-UNKOBJ_ScCOReallocate at 12
-UNKOBJ_ScSzFromIdsAlloc at 20
-UlAddRef at 4
-UlFromSzHex at 4
-UlPropSize at 4
-UlRelease at 4
-WrapCompressedRTFStream
-WrapCompressedRTFStream at 12
-WrapProgress at 20
-WrapStoreEntryID at 24
-__CPPValidateParameters at 8
-__ValidateParameters at 8

commit 6bc833c018004608df1a76cb10bf826fb545eea2
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 4 16:45:33 2015 +0100

    Fix int to pointer cast when creating worker
    
    * src/engine-assuan.c (async_worker_thread): Expect parameter to be
     a pointer instead of a value.
     (op_assuan_init): Pass a reference instead.
    
    --
    While the old code was not broken building for x64 created a
    warning. And I also don't think you should do it even if it works
    here.

diff --git a/src/engine-assuan.c b/src/engine-assuan.c
index 970cebc..f3422e3 100644
--- a/src/engine-assuan.c
+++ b/src/engine-assuan.c
@@ -629,7 +629,7 @@ op_assuan_init (void)
         return gpg_error (GPG_ERR_GENERAL);
       }
     mytid = GetCurrentThreadId ();
-    th = CreateThread (NULL, 256*1024, async_worker_thread, (void*)mytid,
+    th = CreateThread (NULL, 256*1024, async_worker_thread, &mytid,
                        0, &tid);
     if (th == INVALID_HANDLE_VALUE)
       log_error ("failed to launch the async_worker_thread");
@@ -904,11 +904,12 @@ async_worker_thread (void *dummy)
      Wordview, we can't use MsgWaitForMultipleObjects and the event
      loops.  For test purposes a compatibiliy option allows to revert
      to the old behaviour. */
-  int msgwait = opt.compat.use_mwfmo; 
+  int msgwait = opt.compat.use_mwfmo;
+  DWORD orig_thread = *(DWORD*)dummy;
 
   
   if (msgwait)
-    attach_thread_input ( (DWORD)dummy );
+    attach_thread_input ( orig_thread );
 
   for (;;)
     {

commit 2a24cdbfbc75128b87097f792c854c17cb9084e2
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 4 16:42:40 2015 +0100

    Handle handle to int casts
    
     * src/engine-assuan.c (handle_to_int): New.
      (send_options, op_assuan_init, op_assuan_encrypt),
      (op_assuan_sign, op_assuan_decrypt, op_assuan_verify): Use it.
    
    --
    Doing this in a function explictly ensures that we only downcast
    Handle pointers. For them this is allowed and we can locally
    deactive the warning.

diff --git a/src/engine-assuan.c b/src/engine-assuan.c
index 86207c3..970cebc 100644
--- a/src/engine-assuan.c
+++ b/src/engine-assuan.c
@@ -139,7 +139,33 @@ static HANDLE work_queue_event;
 /*-- prototypes --*/
 static DWORD WINAPI async_worker_thread (void *dummy);
 
-
+static unsigned int
+handle_to_int (HANDLE handle)
+{
+  /* According to MSDN
+     https://msdn.microsoft.com/en-us/library/
+     windows/desktop/aa384203%28v=vs.85%29.aspx:
+
+     64-bit versions of Windows use 32-bit handles for
+     interoperability. When sharing a handle between 32-bit
+     and 64-bit applications, only the lower 32 bits are significant,
+     so it is safe to truncate the handle (when passing it from 64-bit
+     to 32-bit) or sign-extend the handle (when passing it from 32-bit
+     to 64-bit). Handles that can be shared include handles to user
+     objects such as windows (HWND), handles to GDI objects such as pens
+     and brushes (HBRUSH and HPEN), and handles to named objects such
+     as mutexes, semaphores, and file handles.
+
+     So this hack is safe.
+   */
+#ifndef __clang__
+#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
+#endif
+  return (unsigned int) handle;
+#ifndef __clang__
+#pragma GCC diagnostic pop
+#endif
+}
 
 

 /* Return the next command id.  Command Ids are used to group
@@ -425,11 +451,12 @@ send_options (assuan_context_t ctx, void *hwnd, pid_t *r_pid)
     }
 
   if (*r_pid != (pid_t)(-1) && !AllowSetForegroundWindow (*r_pid))
-    log_error_w32 (-1, "AllowSetForegroundWindow(%u) failed", *r_pid);
+    log_error_w32 (-1, "AllowSetForegroundWindow("SIZE_T_FORMAT") failed",
+                   *r_pid);
 
   if (!err && hwnd)
     {
-      snprintf (numbuf, sizeof numbuf, "%x", (unsigned int)hwnd);
+      snprintf (numbuf, sizeof numbuf, "%x", handle_to_int (hwnd));
       err = send_one_option (ctx, "window-id", numbuf);
     }
 
@@ -1694,15 +1721,15 @@ op_assuan_encrypt (protocol_t protocol,
      duplicate the handle into the server process and the server then
      uses this handle.  Eventually we should put this code into
      assuan_sendfd.  */
-  snprintf (line, sizeof line, "INPUT FD=%d", (unsigned int)inpipe[0]);
+  snprintf (line, sizeof line, "INPUT FD=%d", handle_to_int (inpipe[0]));
   err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
   if (err)
     goto leave;
   if (flags & ENGINE_FLAG_BINARY_OUTPUT)
     snprintf (line, sizeof line, "OUTPUT FD=%d --binary",
-              (unsigned int)outpipe[1]);
+              handle_to_int (outpipe[1]));
   else
-    snprintf (line, sizeof line, "OUTPUT FD=%d", (unsigned int)outpipe[1]);
+    snprintf (line, sizeof line, "OUTPUT FD=%d", handle_to_int (outpipe[1]));
   err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
   if (err)
     goto leave;
@@ -1875,11 +1902,11 @@ op_assuan_sign (protocol_t protocol,
   *r_used_protocol = protocol;
   log_debug ("%s:%s: using protocol %s", SRCNAME, __func__, protocol_name);
 
-  snprintf (line, sizeof line, "INPUT FD=%d", (unsigned int)inpipe[0]);
+  snprintf (line, sizeof line, "INPUT FD=%d", handle_to_int (inpipe[0]));
   err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
   if (err)
     goto leave;
-  snprintf (line, sizeof line, "OUTPUT FD=%d", (unsigned int)outpipe[1]);
+  snprintf (line, sizeof line, "OUTPUT FD=%d", handle_to_int (outpipe[1]));
   err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
   if (err)
     goto leave;
@@ -1976,11 +2003,11 @@ op_assuan_decrypt (protocol_t protocol,
         goto leave;
     }
 
-  snprintf (line, sizeof line, "INPUT FD=%d", (unsigned int)inpipe[0]);
+  snprintf (line, sizeof line, "INPUT FD=%d", handle_to_int (inpipe[0]));
   err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
   if (err)
     goto leave;
-  snprintf (line, sizeof line, "OUTPUT FD=%d", (unsigned int)outpipe[1]);
+  snprintf (line, sizeof line, "OUTPUT FD=%d", handle_to_int (outpipe[1]));
   err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
   if (err)
     goto leave;
@@ -2116,11 +2143,12 @@ op_assuan_verify (gpgme_protocol_t protocol,
 
   if (!opaque_mode)
     {
-      snprintf (line, sizeof line, "MESSAGE FD=%d", (unsigned int)msgpipe[0]);
+      snprintf (line, sizeof line, "MESSAGE FD=%d",
+                handle_to_int (msgpipe[0]));
       err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
       if (err)
         goto leave;
-      snprintf (line, sizeof line, "INPUT FD=%d", (unsigned int)sigpipe[0]);
+      snprintf (line, sizeof line, "INPUT FD=%d", handle_to_int (sigpipe[0]));
       err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
       if (err)
         goto leave;
@@ -2131,11 +2159,11 @@ op_assuan_verify (gpgme_protocol_t protocol,
     }
   else 
     {
-      snprintf (line, sizeof line, "INPUT FD=%d", (unsigned int)msgpipe[0]);
+      snprintf (line, sizeof line, "INPUT FD=%d", handle_to_int (msgpipe[0]));
       err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
       if (err)
         goto leave;
-      snprintf (line, sizeof line, "OUTPUT FD=%d", (unsigned int)outpipe[1]);
+      snprintf (line, sizeof line, "OUTPUT FD=%d", handle_to_int (outpipe[1]));
       err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
       if (err)
         goto leave;

commit 0c460a499d0ce486295ebd9d2c3de5a99105c627
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 4 16:38:13 2015 +0100

    Add format string macro for size_t
    
    * src/util.h (SIZE_T_FORMAT): Use a macro for a portable way of
      printing size_t.
    * src/engine.c (engine_filter, engine_wait): Use it in debug output.
    
    --
    %z is not available for us.

diff --git a/src/engine.c b/src/engine.c
index 73e20b6..a30408d 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -445,7 +445,7 @@ engine_filter (engine_filter_t filter, const void *indata, size_t indatalen)
       while (filter->out.length)
         {
           if (debug_filter)
-            log_debug ("%s:%s: pushing %d bytes to the outfnc\n",
+            log_debug ("%s:%s: pushing "SIZE_T_FORMAT" bytes to the outfnc\n",
                        SRCNAME, __func__, filter->out.length); 
           nbytes = filter->outfnc (filter->outfncdata, 
                                    filter->out.buffer, filter->out.length);
@@ -678,7 +678,7 @@ engine_wait (engine_filter_t filter)
           if (filter->out.length)
             {
               if (debug_filter_extra)
-                log_debug ("%s:%s: still %d pending bytes for outfnc\n",
+                log_debug ("%s:%s: still "SIZE_T_FORMAT" pending bytes for outfnc\n",
                            SRCNAME, __func__, filter->out.length);
               more = 1;
             }
diff --git a/src/util.h b/src/util.h
index 3dfab5f..c8a44db 100644
--- a/src/util.h
+++ b/src/util.h
@@ -172,6 +172,13 @@ _gpgol_stpcpy (char *a, const char *b)
 
 extern int g_ol_version_major;
 
+#ifdef WIN64
+#define SIZE_T_FORMAT "%I64u"
+#else
+#define SIZE_T_FORMAT "%u"
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif

commit c41e2e4e1ed7baa57d4047613d543f25349f9895
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 4 16:33:33 2015 +0100

    Define out code that does not compile for x64
    
    * src/config-dialog.c (config_dialog_box): Define out for x64
    * src/olflange-dlgs.c (GPGOptionsDlgProc): Define out call to
      SetWindowLong
    
    --
    This code is only used in older outlook versions which are not
    avaibale for 64 bit. And I rather not compile it then change it
    and cause regressions in those versions.

diff --git a/src/config-dialog.c b/src/config-dialog.c
index 5814d6f..4587fc8 100644
--- a/src/config-dialog.c
+++ b/src/config-dialog.c
@@ -182,6 +182,7 @@ config_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
 void
 config_dialog_box (HWND parent)
 {
+#ifndef WIN64
   int resid;
 
   resid = IDD_EXT_OPTIONS;
@@ -189,6 +190,10 @@ config_dialog_box (HWND parent)
   if (!parent)
     parent = GetDesktopWindow ();
   DialogBoxParam (glob_hinst, (LPCTSTR)resid, parent, config_dlg_proc, 0);
+#else
+  (void)parent;
+  (void)config_dlg_proc;
+#endif
 }
 
 
diff --git a/src/olflange-dlgs.cpp b/src/olflange-dlgs.cpp
index a957bff..8bccbaa 100644
--- a/src/olflange-dlgs.cpp
+++ b/src/olflange-dlgs.cpp
@@ -279,7 +279,13 @@ GPGOptionsDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
           break;
 	}
 
+#ifndef WIN64
+      /* SetWindowLong is not portable according to msdn
+         it should be replaced by SetWindowLongPtr. But
+         as this here is code for Outlook < 2010 we don't
+         care as there is no 64bit version for that. */
       SetWindowLong (hDlg, DWL_MSGRESULT, bMsgResult);
+#endif
       break;
 
     default:

commit af0e348eb32a33f7a9e58d0cb9cc32b0fb000570
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 4 16:25:22 2015 +0100

    Fix pointer to int cast in debug output
    
    * src/oomhelp.cpp (dump_excepinfo): Fix deferredFill output format.

diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp
index 7ba2775..83cc344 100644
--- a/src/oomhelp.cpp
+++ b/src/oomhelp.cpp
@@ -116,13 +116,13 @@ dump_excepinfo (EXCEPINFO err)
              "              desc: %S\n"
              "              help: %S\n"
              "              helpCtx: 0x%x\n"
-             "              deferredFill: 0x%x\n"
+             "              deferredFill: %p\n"
              "              scode: 0x%x\n",
              SRCNAME, __func__, (unsigned int) err.wCode,
              (unsigned int) err.wReserved,
              err.bstrSource, err.bstrDescription, err.bstrHelpFile,
              (unsigned int) err.dwHelpContext,
-             (unsigned int) err.pfnDeferredFillIn,
+             err.pfnDeferredFillIn,
              (unsigned int) err.scode);
 }
 

commit 0fb822b13c907e0589c2b8278937af5a44d3a67f
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Nov 4 16:18:30 2015 +0100

    Remove dead code
    
    * Makefile.am: Update gpgol_Sources accordingly.
    * main.c (init_options, read_options): Remove password_ttl setting.
      (DllMain): No longer initialize passcache.
    * passcache.c, passcache.h, passphrase-dialog.c, recipient-dialog.c,
      verify-dialog.c: Removed. This is handled by the uiserver now.
    
    --
    This is code from a time before assuan architecture and unlikely
    to be useful again.

diff --git a/src/Makefile.am b/src/Makefile.am
index ff96120..e5cb2c4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,11 +55,7 @@ gpgol_SOURCES = \
 	rfc822parse.c rfc822parse.h \
         common.h common.c util.h    \
 	xmalloc.h		    \
-	passcache.c passcache.h     \
         config-dialog.c	            \
-        passphrase-dialog.c         \
-        recipient-dialog.c          \
-        verify-dialog.c             \
 	mapihelp.cpp mapihelp.h     \
 	mymapi.h  mymapitags.h      \
 	serpent.c serpent.h         \
diff --git a/src/main.c b/src/main.c
index 6e7eb79..b8b9160 100644
--- a/src/main.c
+++ b/src/main.c
@@ -28,7 +28,6 @@
 #include "mymapitags.h"
 
 #include "common.h"
-#include "passcache.h"
 #include "msgcache.h"
 #include "mymapi.h"
 
@@ -64,9 +63,6 @@ int g_ol_version_major;
 static void
 init_options (void)
 {
-  opt.passwd_ttl = 10; /* Seconds. Use a small value, so that no
-                          multiple prompts for attachment encryption
-                          are issued. */
   opt.enc_format = GPG_FMT_CLASSIC;
 }
 
@@ -178,8 +174,6 @@ DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
       i18n_init ();
       if (initialize_session_key ())
         return FALSE;
-      if (initialize_passcache ())
-        return FALSE;
       if (initialize_msgcache ())
         return FALSE;
       if (initialize_inspectors ())
@@ -646,12 +640,6 @@ read_options (void)
   opt.enable_default_key = val == NULL || *val != '1' ? 0 : 1;
   xfree (val); val = NULL;
 
-  if (load_extension_value ("storePasswdTime", &val) )
-    opt.passwd_ttl = 600; /* Initial default. */
-  else
-    opt.passwd_ttl = val == NULL || *val == '0'? 0 : atol (val);
-  xfree (val); val = NULL;
-
   load_extension_value ("encodingFormat", &val);
   opt.enc_format = val == NULL? GPG_FMT_CLASSIC  : atol (val);
   xfree (val); val = NULL;
@@ -747,7 +735,6 @@ write_options (void)
     {"encryptDefault",           0, opt.encrypt_default},
     {"signDefault",              0, opt.sign_default},
     {"previewDecrypt",           0, opt.preview_decrypt},
-    {"storePasswdTime",          1, opt.passwd_ttl},
     {"encodingFormat",           1, opt.enc_format},
     {"logFile",                  2, 0, logfile},
     {"defaultKey",               2, 0, opt.default_key},
diff --git a/src/passcache.c b/src/passcache.c
deleted file mode 100644
index f857cca..0000000
--- a/src/passcache.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/* passcache.c - passphrase cache for GPGol
- *	Copyright (C) 2005 g10 Code GmbH
- *
- * This file is part of GpgOL.
- * 
- * GpgOL is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * GpgOL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/* We use a global passphrase cache.  The cache time is set at the
-   time the passphrase gets stored.  */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <time.h>
-#include <windows.h> /* Argg: Only required for the locking. */
-
-#include "util.h"
-#include "passcache.h"
-
-
-/* An item to hold a cached passphrase. */
-struct cache_item
-{
-  /* We love linked lists; there are only a few passwords and access
-     to them is not in any way time critical. */
-  struct cache_item *next;  
-
-  /* The Time to Live for this entry. */
-  int ttl;
-
-  /* The timestamp is updated with each access to the item and used
-     along with TTL to exire this item. */
-  time_t timestamp;
-
-  /* The value of this item.  Malloced C String.  If this one is NULL
-     this item may be deleted. */
-  char *value;         
-
-  /* The key for this item. C String. */
-  char key[1];
-};
-typedef struct cache_item *cache_item_t;
-
-
-/* The actual cache is a simple list anchord at this global
-   variable. */
-static cache_item_t the_cache;
-
-/* Mutex used to serialize access to the cache. */
-static HANDLE cache_mutex;
-
-
-/* Initialize this mode.  Called at a very early stage. Returns 0 on
-   success. */
-int
-initialize_passcache (void)
-{
-  SECURITY_ATTRIBUTES sa;
-  
-  memset (&sa, 0, sizeof sa);
-  sa.bInheritHandle = FALSE;
-  sa.lpSecurityDescriptor = NULL;
-  sa.nLength = sizeof sa;
-  cache_mutex = CreateMutex (&sa, FALSE, NULL);
-  return cache_mutex? 0 : -1;
-}
-
-/* Acquire the mutex.  Returns 0 on success. */
-static int 
-lock_cache (void)
-{
-  int code = WaitForSingleObject (cache_mutex, INFINITE);
-  if (code != WAIT_OBJECT_0)
-    log_error ("%s:%s: waiting on mutex failed: code=%#x\n",
-               SRCNAME, __func__, code);
-  return code != WAIT_OBJECT_0;
-}
-
-/* Release the mutex.  No error is returned because this is a fatal
-   error anyway and there is no way to clean up. */
-static void
-unlock_cache (void)
-{
-  if (!ReleaseMutex (cache_mutex))
-    log_error_w32 (-1, "%s:%s: ReleaseMutex failed", SRCNAME, __func__);
-}
-
-
-/* This is routine is used to remove all deleted entries from the
-   linked list.  Deleted entries are marked by a value of NULL.  Note,
-   that this routine must be called in a locked state. */
-static void
-remove_deleted_items (void)
-{
-  cache_item_t item, prev;
-
- again:
-  for (item = the_cache; item; item = item->next)
-    if (!item->value)
-      {
-        if (item == the_cache)
-          {
-            the_cache = item->next;
-            xfree (item);
-          }
-        else
-          {
-            for (prev=the_cache; prev->next; prev = prev->next)
-              if (prev->next == item)
-                {
-                  prev->next = item->next;
-                  xfree (item);
-                  item = NULL;
-                  break;
-                }
-            assert (!item);
-          }
-        goto again; /* Yes, we use this pretty dumb algorithm ;-) */
-      }
-}
-
-
-
-/* Flush all entries from the cache. */
-void
-passcache_flushall (void)
-{
-  cache_item_t item;
-
-  if (lock_cache ())
-    return; /* FIXME: Should we pop up a message box? */ 
-
-  for (item = the_cache; item; item = item->next)
-    if (item->value)
-      {
-        wipestring (item->value);
-        xfree (item->value);
-        item->value = NULL;
-      }
-  remove_deleted_items ();
-
-  unlock_cache ();
-}
-
-
-/* Store the passphrase in VALUE under KEY in out cache. Assign TTL
-   seconds as maximum caching time.  If it already exists, merely
-   updates the TTL. If the TTL is 0 or VALUE is NULL or empty, flush a
-   possible entry. */
-void
-passcache_put (const char *key, const char *value, int ttl)
-{
-  cache_item_t item;
-
-  if (!key || !*key)
-    {
-      log_error ("%s:%s: no key given", SRCNAME, __func__);
-      return;
-    }
-
-  if (lock_cache ())
-    return; /* FIXME: Should we pop up a message box if a flush was
-               requested? */
-  
-  for (item = the_cache; item; item = item->next)
-    if (item->value && !strcmp (item->key, key))
-      break;
-  if (item && (!ttl || !value || !*value))
-    {
-      /* Delete this entry. */
-      wipestring (item->value);
-      xfree (item->value);
-      item->value = NULL;
-      /* Actual delete will happen before we allocate a new entry. */
-    }
-  else if (item)
-    {
-      /* Update this entry. */
-      if (item->value)
-        {
-          wipestring (item->value);
-          xfree (item->value);
-        }
-      item->value = xstrdup (value);
-      item->ttl = ttl;
-      item->timestamp = time (NULL);
-    }
-  else if (!ttl || !value || !*value)
-    {
-      log_debug ("%s:%s: ignoring attempt to add empty entry `%s'",
-                 SRCNAME, __func__, key);
-    }
-  else 
-    {
-      /* Create new cache entry. */
-      remove_deleted_items ();
-      item = xcalloc (1, sizeof *item + strlen (key));
-      strcpy (item->key, key);
-      item->ttl = ttl;
-      item->value = xstrdup (value);
-      item->timestamp = time (NULL);
-
-      item->next = the_cache;
-      the_cache = item;
-    }
-
-  unlock_cache ();
-}
-
-
-/* Return the passphrase stored under KEY as a newly malloced string.
-   Caller must release that string using xfree.  Using this function
-   won't update the TTL.  If no passphrase is available under this
-   key, the function returns NULL.  Calling thsi function with KEY set
-   to NULL will only expire old entries. */
-char *
-passcache_get (const char *key)
-{
-  cache_item_t item;
-  char *result = NULL;
-  time_t now = time (NULL);
-
-  if (lock_cache ())
-    return NULL;
-  
-  /* Expire entries. */
-  for (item = the_cache; item; item = item->next)
-    if (item->value && item->timestamp + item->ttl < now)
-      {
-        wipestring (item->value);
-        xfree (item->value);
-        item->value = NULL;
-      }
-
-  /* Look for the entry. */
-  if (key && *key)
-    {
-      for (item = the_cache; item; item = item->next)
-        if (item->value && !strcmp (item->key, key))
-          {
-            result = xstrdup (item->value);
-            item->timestamp = time (NULL);
-            break;
-          }
-    }
-
-  unlock_cache ();
-
-  return result;
-}
diff --git a/src/passcache.h b/src/passcache.h
deleted file mode 100644
index 84e7418..0000000
--- a/src/passcache.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* passcache.h - Interface the passphrase cache for GPGol
- *	Copyright (C) 2005 g10 Code GmbH
- *
- * This file is part of GpgOL.
- * 
- * GpgOL is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * GpgOL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef PASSCACHE_H
-#define PASSCACHE_H
-
-
-/* Initialize the passcache subsystem. */
-int initialize_passcache (void);
-
-/* Flush all entries. */
-void passcache_flushall (void);
-
-/* Store and retrieve a cached passphrase. */
-void passcache_put (const char *key, const char *value, int ttl);
-char *passcache_get (const char *key);
-
-#endif /*PASSCACHE_H*/
diff --git a/src/passphrase-dialog.c b/src/passphrase-dialog.c
deleted file mode 100644
index 54fdcea..0000000
--- a/src/passphrase-dialog.c
+++ /dev/null
@@ -1,786 +0,0 @@
-/* passphrase-dialog.c
- *	Copyright (C) 2004 Timo Schulz
- *	Copyright (C) 2005, 2006, 2007 g10 Code GmbH
- *
- * This file is part of GpgOL.
- * 
- * GpgOL is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * GpgOL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <windows.h>
-#include <time.h>
-#include <assert.h>
-#include <gpgme.h>
-
-#include "common.h"
-#include "gpgol-ids.h"
-#include "passcache.h"
-#include "dialogs.h"
-
-
-/* Object to maintai8n state in the dialogs. */
-struct dialog_context_s
-{
-  struct passphrase_cb_s *dec; /* The decryption info. */
-
-  gpgme_key_t *keyarray;     /* NULL or an array of keys. */
-
-  int hide_state;            /* Flag indicating that some stuff is hidden. */
-
-  unsigned int use_as_cb;    /* This is used by the passphrase callback. */
-
-  int no_encrypt_warning;    /* Print a warning after cancel. */
-};
-
-
-static char const allhexdigits[] = "1234567890ABCDEFabcdef";
-
-
-static void
-set_key_hint (struct passphrase_cb_s *dec, HWND dlg, int ctrlid)
-{
-  const char *s = dec->user_id;
-  char *key_hint;
-  
-  if (s && dec->keyid) 
-    {
-      char stop_char;
-      size_t i = 0;
-
-      key_hint = xmalloc (17 + strlen (s) + strlen (dec->keyid) + 32);
-      if (strchr (s, '<') && strchr (s, '>'))
-        stop_char = '<';
-      else if (strchr (s, '(') && strchr (s, ')'))
-        stop_char = '(';
-      else
-        stop_char = 0;
-      while (*s != stop_char)
-        key_hint[i++] = *s++;
-      key_hint[i++] = ' ';
-      if (dec->keyid && strlen (dec->keyid) > 8)
-        sprintf (key_hint+i, "(0x%s)", dec->keyid+8);
-      else
-        key_hint[i] = 0;
-    }
-  else
-    key_hint = xstrdup (_("No certificate hint given."));
-  SendDlgItemMessage (dlg, ctrlid, CB_ADDSTRING, 0, 
-                      (LPARAM)(const char *)key_hint);
-  SendDlgItemMessage (dlg, ctrlid, CB_SETCURSEL, 0, 0);
-  xfree (key_hint);
-}
-
-/* Release the key array ARRAY as well as all COUNT keys. */
-static void
-release_keyarray (gpgme_key_t *array)
-{
-  size_t n;
-
-  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. */
-static size_t
-count_keys (gpgme_key_t *keys)
-{
-  size_t n = 0;
-
-  if (keys)
-    for (; *keys; keys++)
-      n++;
-  return n;
-}
-
-
-static void
-load_recipbox (HWND dlg, int ctlid, gpgme_ctx_t ctx)
-{
-  gpgme_decrypt_result_t res;
-  gpgme_recipient_t rset, r;
-  gpgme_ctx_t keyctx = NULL;
-  gpgme_key_t key;
-  gpgme_error_t err;
-  char *buffer, *p;
-  size_t n;
-  
-  if (!ctx)
-    return;
-
-  /* Lump together all recipients of the message. */
-  res = gpgme_op_decrypt_result (ctx);
-  if (!res || !res->recipients)
-    return;
-  rset = res->recipients;
-  for (n=0, r = rset; r; r = r->next)
-    if (r->keyid)
-      n += strlen (r->keyid) + 1;    
-  buffer = xmalloc (n + 1);
-  for (p=buffer, r = rset; r; r = r->next)
-    if (r->keyid)
-      p = stpcpy (stpcpy (p, r->keyid), " ");
-
-  /* Run a key list on all of them to fill up the list box. */
-  err = gpgme_new (&keyctx);
-  if (err)
-    goto fail;
-  err = gpgme_op_keylist_start (keyctx, buffer, 0);
-  if (err)
-    {
-      log_error ("failed to initialize keylisting: %s", gpg_strerror (err));
-      goto fail;
-    }
-
-  while (!gpgme_op_keylist_next (keyctx, &key))
-    {
-      if (key && key->uids && key->uids->uid)
-	{
-	  char *utf8_uid = utf8_to_native (key->uids->uid);
-	  SendDlgItemMessage (dlg, ctlid, LB_ADDSTRING, 0,
-			      (LPARAM)(const char *)utf8_uid);
-	  xfree (utf8_uid);
-	}
-      if (key)
-	gpgme_key_release (key);
-    }
-
- fail:
-  if (keyctx)
-    gpgme_release (keyctx);
-  xfree (buffer);
-}
-
-
-
-/* Return a string with the short description of the algorithm.  This
-   function is guaranteed to not return NULL or a string longer that 3
-   bytes. */
-const char*
-get_pubkey_algo_str (gpgme_pubkey_algo_t alg)
-{
-  switch (alg)
-    {
-    case GPGME_PK_RSA:
-    case GPGME_PK_RSA_E:
-    case GPGME_PK_RSA_S:
-      return "RSA";
-      
-    case GPGME_PK_ELG_E:
-    case GPGME_PK_ELG:
-      return "ELG";
-
-    case GPGME_PK_DSA:
-      return "DSA";
-
-    default:
-      break;
-    }
-  
-  return "???";
-}
-
-
-/* Fill a combo box with all keys and return an error with those keys. 
-   set *R_NKEYS to the amount of keys if requested. */
-static gpgme_key_t*
-load_secbox (HWND dlg, int ctlid, size_t *r_nkeys)
-{
-  gpg_error_t err;
-  gpgme_ctx_t ctx;
-  gpgme_key_t key;
-  gpgme_key_t *keyarray;
-  size_t pos, keyarray_size;
-
-  err = gpgme_new (&ctx);
-  if (err)
-    return NULL;
-
-  err = gpgme_op_keylist_start (ctx, NULL, 1);
-  if (err)
-    {
-      log_error ("failed to initiate key listing: %s\n", gpg_strerror (err));
-      gpgme_release (ctx);
-      return NULL;
-    }
-
-  keyarray_size = 20; 
-  keyarray = xcalloc (keyarray_size+1, sizeof *keyarray);
-  pos = 0;
-
-  while (!gpgme_op_keylist_next (ctx, &key)) 
-    {
-      const char *email, *keyid, *algo;
-      char *p, *name;
-      long idx;
-      
-      if (key->revoked || key->expired || key->disabled || key->invalid)
-        {
-          gpgme_key_release (key);
-          continue;
-        }
-      if (!key->uids || !key->subkeys)
-        {
-          gpgme_key_release (key);
-          continue;
-        }
-        
-      if (!key->uids->name)
-        name = strdup ("");
-      else
-	name = utf8_to_native (key->uids->name);
-      email = key->uids->email;
-      if (!email)
-	email = "";
-      keyid = key->subkeys->keyid;
-      if (!keyid || strlen (keyid) < 8)
-        {
-	  xfree (name);
-          gpgme_key_release (key);
-          continue;
-        }
-
-      algo = get_pubkey_algo_str (key->subkeys->pubkey_algo);
-      p = xmalloc (strlen (name) + strlen (email) + strlen (keyid+8) + 3 + 20);
-      if (email && *email)
-	sprintf (p, "%s <%s> (0x%s, %s)", name, email, keyid+8, algo);
-      else
-	sprintf (p, "%s (0x%s, %s)", name, keyid+8, algo);
-      idx = SendDlgItemMessage (dlg, ctlid, CB_ADDSTRING, 0, 
-				(LPARAM)(const char *)p);
-      xfree (p);
-      xfree (name);
-      if (idx < 0) /* Error. */
-        {
-          gpgme_key_release (key);
-          continue;
-        }
-      
-      SendDlgItemMessage (dlg, ctlid, CB_SETITEMDATA, idx, (LPARAM)pos);
-
-      if (pos >= keyarray_size)
-        {
-          gpgme_key_t *tmparr;
-          size_t i;
-
-          keyarray_size += 10;
-          tmparr = xcalloc (keyarray_size, sizeof *tmparr);
-          for (i=0; i < pos; i++)
-            tmparr[i] = keyarray[i];
-          xfree (keyarray);
-          keyarray = tmparr;
-        }
-      keyarray[pos++] = key;
-    }
-  SendDlgItemMessage (dlg, ctlid, CB_SETCURSEL, 0, 0);
-
-  gpgme_op_keylist_end (ctx);
-  gpgme_release (ctx);
-  if (r_nkeys)
-    *r_nkeys = pos;
-  return keyarray;
-}
-
-
-/* To avoid writing a dialog template for each language we use gettext
-   for the labels and hope that there is enough space in the dialog to
-   fit teh longest translation.  */
-static void
-decrypt_key_dlg_set_labels (HWND dlg)
-{
-  static struct { int itemid; const char *label; } labels[] = {
-    { IDC_DEC_PASSINF, N_("Enter passphrase to unlock the secret key")},
-    { IDC_DEC_HIDE,    N_("Hide typing")},
-    { IDCANCEL,        N_("&Cancel")},
-    { 0, NULL}
-  };
-  int i;
-
-  for (i=0; labels[i].itemid; i++)
-    SetDlgItemText (dlg, labels[i].itemid, _(labels[i].label));
-}  
-
-
-
-static BOOL CALLBACK
-decrypt_key_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
-{
-  /* Fixme: We should not use a static here but keep it in an array
-     index by DLG. */
-  static struct dialog_context_s *context; 
-  struct passphrase_cb_s *dec;
-  size_t n;
-
-  if (msg == WM_INITDIALOG)
-    {
-      context = (struct dialog_context_s *)lparam;
-      context->hide_state = 1;
-      dec = context->dec;
-      if (dec && context->use_as_cb) 
-        {
-          dec->opts = 0;
-          dec->pass = NULL;
-          set_key_hint (dec, dlg, IDC_DEC_KEYLIST);
-          EnableWindow (GetDlgItem (dlg, IDC_DEC_KEYLIST), FALSE);
-	}
-      if (dec && dec->last_was_bad)
-        SetDlgItemText (dlg, IDC_DEC_HINT, 
-                        (dec && dec->last_was_bad)?
-                        _("Invalid passphrase; please try again..."):"");
-
-      if (dec && !context->use_as_cb)
-        {
-          context->keyarray = load_secbox (dlg, IDC_DEC_KEYLIST, &n);
-          /* If only one secret key is available, it makes no sense to
-             ask the user to select one. */
-          if (n == 1) 
-            {
-              dec->signer = context->keyarray[0];
-              gpgme_key_ref (context->keyarray[0]);
-              EndDialog (dlg, TRUE);
-              return FALSE;
-            }
-        }
-
-      decrypt_key_dlg_set_labels (dlg);
-      CheckDlgButton (dlg, IDC_DEC_HIDE, BST_CHECKED);
-      center_window (dlg, NULL);
-      if (dec && dec->hide_pwd) 
-        {
-          ShowWindow (GetDlgItem (dlg, IDC_DEC_HIDE), SW_HIDE);
-          ShowWindow (GetDlgItem (dlg, IDC_DEC_PASS), SW_HIDE);
-          ShowWindow (GetDlgItem (dlg, IDC_DEC_PASSINF), SW_HIDE);
-	}
-      else
-        SetFocus (GetDlgItem (dlg, IDC_DEC_PASS));
-
-      if (!context->use_as_cb)
-	SetWindowText (dlg, _("Select Signing Key"));
-      SetForegroundWindow (dlg);
-      return FALSE;
-    }
-
-  if (!context)
-    return FALSE;
-
-  dec = context->dec;
-
-  switch (msg) 
-    {
-    case WM_DESTROY:
-      context->hide_state = 1;
-      break;
-
-    case WM_COMMAND:
-      switch (HIWORD (wparam)) 
-        {
-	case BN_CLICKED:
-          if ((int)LOWORD (wparam) == IDC_DEC_HIDE)
-            {
-              HWND hwnd;
-
-              context->hide_state ^= 1;
-              hwnd = GetDlgItem (dlg, IDC_DEC_PASS);
-              SendMessage (hwnd, EM_SETPASSWORDCHAR,
-                           context->hide_state? '*' : 0, 0);
-              SetFocus (hwnd);
-	    }
-          break;
-	}
-
-      switch (LOWORD (wparam)) 
-        {
-	case IDOK:
-          n = SendDlgItemMessage (dlg, IDC_DEC_PASS, WM_GETTEXTLENGTH, 0, 0);
-          if (n && dec) 
-            {
-              dec->pass = xmalloc (n + 2);
-              GetDlgItemText (dlg, IDC_DEC_PASS, dec->pass, n+1);
-	    }
-          if (dec && !context->use_as_cb) 
-            {
-              int idx, pos;
-
-              idx = SendDlgItemMessage (dlg, IDC_DEC_KEYLIST,
-                                        CB_GETCURSEL, 0, 0);
-              pos = SendDlgItemMessage (dlg, IDC_DEC_KEYLIST,
-                                        CB_GETITEMDATA, idx, 0);
-              if (pos >= 0 && pos < count_keys (context->keyarray))
-                {
-                  dec->signer = context->keyarray[pos];
-                  gpgme_key_ref (dec->signer);
-                }
-	    }
-          EndDialog (dlg, TRUE);
-          break;
-          
-	case IDCANCEL:
-	  /* Outlook show now correctly abort the sending process
-	     and thus no warning is shown any longer. */
-          if (dec)
-            {
-              dec->opts = OPT_FLAG_CANCEL;
-              dec->pass = NULL;
-            }
-          EndDialog (dlg, FALSE);
-          break;
-	}
-      break; /*WM_COMMAND*/
-    }
-
-  return FALSE;
-}
-
-
-/* To avoid writing a dialog template for each language we use gettext
-   for the labels and hope that there is enough space in the dialog to
-   fit teh longest translation.  */
-static void
-decrypt_key_ext_dlg_set_labels (HWND dlg)
-{
-  static struct { int itemid; const char *label; } labels[] = {
-    { IDC_DECEXT_RSET_T,  N_("Encrypted to the following certificates:")},
-    { IDC_DECEXT_PASSINF, N_("Enter passphrase to unlock the secret key")},
-    { IDC_DECEXT_HIDE,    N_("Hide typing")},
-    { IDCANCEL,           N_("&Cancel")},
-    { 0, NULL}
-  };
-  int i;
-
-  for (i=0; labels[i].itemid; i++)
-    SetDlgItemText (dlg, labels[i].itemid, _(labels[i].label));
-}  
-
-static BOOL CALLBACK
-decrypt_key_ext_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
-{
-  /* Fixme: We should not use a static here but keep it in an array
-     index by DLG. */
-  static struct dialog_context_s *context; 
-  struct passphrase_cb_s * dec;
-  size_t n;
-
-  if (msg == WM_INITDIALOG)
-    {
-      context = (struct dialog_context_s *)lparam;
-      context->hide_state = 1;
-      dec = context->dec;
-      if (dec) 
-        {
-          dec->opts = 0;
-          dec->pass = NULL;
-          set_key_hint (dec, dlg, IDC_DECEXT_KEYLIST);
-          EnableWindow (GetDlgItem (dlg, IDC_DECEXT_KEYLIST), FALSE);
-	}
-
-      SetDlgItemText (dlg, IDC_DECEXT_HINT, 
-                      (dec && dec->last_was_bad)?
-                      _("Invalid passphrase; please try again..."):"");
-      if (dec)
-        load_recipbox (dlg, IDC_DECEXT_RSET, dec->ctx);
-
-      decrypt_key_ext_dlg_set_labels (dlg);
-      CheckDlgButton (dlg, IDC_DECEXT_HIDE, BST_CHECKED);
-      center_window (dlg, NULL);
-      SetFocus (GetDlgItem (dlg, IDC_DECEXT_PASS));
-      SetForegroundWindow (dlg);
-      return FALSE;
-    }
-
-  if (!context)
-    return FALSE;
-
-  dec = context->dec;
-
-  switch (msg) 
-    {
-    case WM_DESTROY:
-      context->hide_state = 1;
-      break;
-
-    case WM_COMMAND:
-      switch (HIWORD (wparam)) 
-        {
-	case BN_CLICKED:
-          if ((int)LOWORD (wparam) == IDC_DECEXT_HIDE) 
-            {
-              HWND hwnd;
-              
-              context->hide_state ^= 1;
-              hwnd = GetDlgItem (dlg, IDC_DECEXT_PASS);
-              SendMessage (hwnd, EM_SETPASSWORDCHAR,
-                           context->hide_state? '*' : 0, 0);
-              SetFocus (hwnd);
-	    }
-          break;
-	}
-
-      switch (LOWORD (wparam)) 
-        {
-	case IDOK:
-          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);
-	    }
-          EndDialog (dlg, TRUE);
-          break;
-
-	case IDCANCEL:
-	  /* See comment in decrypt_key_dlg_proc. */
-          if (dec)
-            {
-              dec->opts = OPT_FLAG_CANCEL;
-              dec->pass = NULL;
-            }
-          EndDialog (dlg, FALSE);
-          break;
-	}
-      break; /*WM_COMMAND*/
-    }
-
-  return FALSE;
-}
-
-/* Display a signer dialog which contains all secret keys, useable for
-   signing data.  The key is returned in R_KEY.  The passprase in
-   r_passwd.  If Encrypting is true, the message will get encrypted
-   later. */
-int 
-signer_dialog_box (gpgme_key_t *r_key, char **r_passwd, int encrypting)
-{
-  struct dialog_context_s context; 
-  struct passphrase_cb_s dec;
-  int resid;
-
-  memset (&context, 0, sizeof context);
-  memset (&dec, 0, sizeof dec);
-  dec.hide_pwd = 1;
-  context.dec = &dec;
-  context.no_encrypt_warning = encrypting;
-
-  resid = IDD_DEC;
-  DialogBoxParam (glob_hinst, (LPCTSTR)resid, GetDesktopWindow (),
-                  decrypt_key_dlg_proc, (LPARAM)&context);
-
-  if (dec.signer) 
-    {
-      if (r_passwd)
-        *r_passwd = dec.pass;
-      else 
-        {	    
-          if (dec.pass)
-            wipestring (dec.pass);
-          xfree (dec.pass);
-        }
-      dec.pass = NULL;
-      *r_key = dec.signer;
-      dec.signer = NULL;
-    }
-  if (dec.pass)
-    wipestring (dec.pass);
-  xfree (dec.pass);
-  if (dec.signer)
-    gpgme_key_release (dec.signer);
-  release_keyarray (context.keyarray);
-  return (dec.opts & OPT_FLAG_CANCEL)? -1 : 0;
-}
-
-
-/* GPGME passphrase callback function. It starts the decryption dialog
-   to request the passphrase from the user.  See the GPGME manual for
-   a description of the arguments. */
-gpgme_error_t
-passphrase_callback_box (void *opaque, const char *uid_hint, 
-			 const char *pass_info,
-			 int prev_was_bad, int fd)
-{
-  struct passphrase_cb_s *dec = opaque;
-  DWORD nwritten = 0;
-  char keyidstr[16+1];
-  int resid;
-
-  log_debug ("passphrase_callback_box: enter (uh=`%s',pi=`%s')\n", 
-             uid_hint?uid_hint:"(null)", pass_info?pass_info:"(null)");
-
-  *keyidstr = 0; 
-
-  /* First remove a possible passphrase from the return structure. */
-  if (dec->pass)
-    wipestring (dec->pass);
-  xfree (dec->pass);
-  dec->pass = NULL;
-
-  /* For some reasons the cancel flag has been set - write an empty
-     passphrase and close the handle to indicate the cancel state to
-     the backend. */
-  if (dec->opts & OPT_FLAG_CANCEL)
-    {
-      /* Casting the FD to a handle is okay as gpgme uses OS handles. */
-      WriteFile ((HANDLE)fd, "\n", 1, &nwritten, NULL);
-      CloseHandle ((HANDLE)fd);
-      log_debug ("passphrase_callback_box: leave (due to cancel flag)\n");
-      return -1;
-    }
-
-  /* Parse the information to get the keyid we use for caching of the
-     passphrase. If we got suitable information, we will have a proper
-     16 character string in KEYIDSTR; if not KEYIDSTR has been set to
-     empty. */
-  if (pass_info)
-    {
-      /* As of now (gpg 1.4.2) these information are possible:
-
-         1. Standard passphrase requested:
-            "<long main keyid> <long keyid> <keytype> <keylength>"
-         2. Passphrase for symmetric key requested:
-            "<cipher_algo> <s2k_mode> <s2k_hash>"
-         3. PIN for a card requested.
-            "<card_type> <chvno>"
-      
-       For caching we need to use the long keyid from case 1; the main
-       keyid can't be used because a key may have different
-       passphrases on the subkeys.  Caching for symmetrical keys is
-       not possible because there is no information on what
-       key(i.e. passphrase) to use.  Caching of PINs is not yet
-       possible because we don't have information on the card's serial
-       number yet; that must be solved by gpgme. 
-
-       To detect case 1 we simply check whether the first token
-       consists in its entire of 16 hex digits.
-      */
-      const char *s;
-      int i;
-
-      for (s=pass_info, i=0; *s && strchr (allhexdigits, *s) ; s++, i++)
-        ;
-      if (i == 16)
-        {
-          while (*s == ' ')
-            s++;
-          for (i=0; *s && strchr (allhexdigits, *s) && i < 16; s++, i++)
-            keyidstr[i] = *s;
-          keyidstr[i] = 0;
-          if (*s)
-            s++;
-          if (i != 16 || !strchr (allhexdigits, *s))
-            {
-              log_debug ("%s: oops: does not look like pass_info\n", __func__);
-              *keyidstr = 0;
-            }
-        }
-    } 
-  
-  log_debug ("%s: using keyid 0x%s\n", __func__, keyidstr);
-
-  /* Now check how to proceed. */
-  if (prev_was_bad) 
-    {
-      log_debug ("%s: last passphrase was bad\n", __func__);
-      /* Flush a possible cache entry for that keyID. */
-      if (*keyidstr)
-        passcache_put (keyidstr, NULL, 0);
-    }
-  else if (*keyidstr)
-    {
-      dec->pass = passcache_get (keyidstr);
-      log_debug ("%s: getting passphrase for 0x%s from cache: %s\n",
-                 __func__, keyidstr, dec->pass? "hit":"miss");
-    }
-
-  /* Copy the keyID into the context. */
-  assert (strlen (keyidstr) < sizeof dec->keyid);
-  strcpy (dec->keyid, keyidstr);
-
-  /* If we have no cached passphrase, popup the passphrase dialog. */
-  if (!dec->pass)
-    {
-      int rc;
-      const char *s;
-      struct dialog_context_s context;
-
-      memset (&context, 0, sizeof context);
-      context.dec = dec;
-      context.use_as_cb = 1;
-
-      /* Construct the user ID. */
-      if (uid_hint)
-        {
-          /* Skip the first token (keyID). */
-          for (s=uid_hint; *s && *s != ' '; s++)
-             ;
-          while (*s == ' ')
-            s++;
-        }
-      else
-        s = "[no user Id]";
-      xfree (dec->user_id);
-      dec->user_id = utf8_to_native (s);
-      dec->last_was_bad = prev_was_bad;
-      if (!dec->decrypt_cmd)
-        {
-          resid = IDD_DEC;
-          rc = DialogBoxParam (glob_hinst, (LPCSTR)resid,
-                               GetDesktopWindow (),
-                               decrypt_key_dlg_proc, (LPARAM)&context);
-        }
-      else
-        {
-          resid = IDD_DECEXT;
-          rc = DialogBoxParam (glob_hinst, (LPCTSTR)resid,
-                               GetDesktopWindow (),
-                               decrypt_key_ext_dlg_proc, (LPARAM)&context);
-        }
-      if (rc <= 0) 
-        log_debug_w32 (-1, "%s: dialog failed (rc=%d)", __func__, rc);
-      release_keyarray (context.keyarray);
-    }
-  else 
-    log_debug ("%s:%s: dec=%p dec->pass=`[censored]'\n",
-               SRCNAME, __func__, dec);
-
-  /* If we got a passphrase, send it to the FD. */
-  if (dec->pass) 
-    {
-      log_debug ("passphrase_callback_box: sending passphrase ...\n");
-      WriteFile ((HANDLE)fd, dec->pass, strlen (dec->pass), &nwritten, NULL);
-    }
-
-  WriteFile((HANDLE)fd, "\n", 1, &nwritten, NULL);
-
-  log_debug ("passphrase_callback_box: leave\n");
-  return 0;
-}
-
-
-/* Release the context which was used in the passphrase callback. */
-void
-free_decrypt_key (struct passphrase_cb_s *ctx)
-{
-    if (!ctx)
-	return;
-    if (ctx->pass) {
-        wipestring (ctx->pass);
-	xfree (ctx->pass);
-    }
-    xfree (ctx->user_id);
-    xfree(ctx);
-}
diff --git a/src/proto-auto.bmp b/src/proto-auto.bmp
deleted file mode 100644
index 67a9ca3..0000000
Binary files a/src/proto-auto.bmp and /dev/null differ
diff --git a/src/proto-pgpmime.bmp b/src/proto-pgpmime.bmp
deleted file mode 100644
index 750a2b8..0000000
Binary files a/src/proto-pgpmime.bmp and /dev/null differ
diff --git a/src/proto-smime.bmp b/src/proto-smime.bmp
deleted file mode 100644
index 4111b41..0000000
Binary files a/src/proto-smime.bmp and /dev/null differ
diff --git a/src/recipient-dialog.c b/src/recipient-dialog.c
deleted file mode 100644
index a2684f8..0000000
--- a/src/recipient-dialog.c
+++ /dev/null
@@ -1,565 +0,0 @@
-/* recipient-dialog.c
- *	Copyright (C) 2004 Timo Schulz
- *	Copyright (C) 2005, 2006, 2007 g10 Code GmbH
- *
- * This file is part of GpgOL.
- * 
- * GpgOL is free software; you can redistribute it and/or 
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * GpgOL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#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 "common.h"
-#include "gpgol-ids.h"
-#include "dialogs.h"
-
-struct recipient_cb_s 
-{
-  char **unknown_keys;  /* A string array with the names of the
-                           unknown recipients. */
-
-  gpgme_key_t *fnd_keys; /* email address to key mapping list. */  
-
-  /* A bit vector used to return selected options. */
-  unsigned int opts;
-
-  /* A key array to hold all keys. */
-  gpgme_key_t *keyarray;
-  size_t keyarray_count;
-
-  /* The result key Array, i.e. the selected keys.  This array is NULL
-     terminated. */
-  gpgme_key_t *selected_keys;
-  size_t      selected_keys_count;
-};
-
-
-/* Symbolic column IDs. */
-enum klist_col_t 
-{
-  KL_COL_NAME = 0,
-  KL_COL_EMAIL = 1,
-  KL_COL_INFO = 2,
-  KL_COL_KEYID = 3,
-  KL_COL_VALID = 4,
-  /* number of columns. */
-  KL_COL_N = 5
-};
-
-/* Insert the columns, needed to display keys, into the list view HWND. */
-static void
-initialize_rsetbox (HWND hwnd)
-{
-  LVCOLUMN col;
-
-  /* We cannot avoid the casting here because gettext always returns
-     a constant string but the listview interface needs char*. */
-  memset (&col, 0, sizeof (col));
-  col.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
-  col.pszText = (char*)_("Name");
-  col.cx = 100;
-  col.iSubItem = KL_COL_NAME;
-  ListView_InsertColumn (hwnd, KL_COL_NAME, &col);
-  
-  col.pszText = (char*)_("E-Mail");
-  col.cx = 100;
-  col.iSubItem = KL_COL_EMAIL;
-  ListView_InsertColumn (hwnd, KL_COL_EMAIL, &col);
-  
-  col.pszText = (char*)_("Key-Info");
-  col.cx = 100;
-  col.iSubItem = KL_COL_INFO;
-  ListView_InsertColumn (hwnd, KL_COL_INFO, &col);
-  
-  col.pszText = (char*)_("Key ID");
-  col.cx = 80;
-  col.iSubItem = KL_COL_KEYID;
-  ListView_InsertColumn (hwnd, KL_COL_KEYID, &col);
-  
-  col.pszText = (char*)_("Validity");
-  col.cx = 70;
-  col.iSubItem = KL_COL_VALID;
-  ListView_InsertColumn (hwnd, KL_COL_VALID, &col);
-  
-  ListView_SetExtendedListViewStyleEx (hwnd, 0, LVS_EX_FULLROWSELECT);
-}
-
-
-/* Load the key list view control HWND with all useable keys 
-   for encryption. Return the array size in *R_ARRAYSIZE. */
-static gpgme_key_t*
-load_rsetbox (HWND hwnd, size_t *r_arraysize)
-{
-  LVITEM lvi;
-  gpg_error_t err;
-  gpgme_ctx_t ctx;
-  gpgme_key_t key = NULL;
-  gpgme_key_t *keyarray;
-  size_t keyarray_size;
-  size_t pos;
-  char keybuf[128], *s;
-  const char *trust_items[] = 
-    {
-      "Unknown",
-      "Undefined",
-      "Never",
-      "Marginal",
-      "Full",
-      "Ultimate"
-    };
-  enum {COL_NAME, COL_EMAIL, COL_KEYINF, COL_KEYID, COL_TRUST};
-  DWORD val;
-
-  memset (&lvi, 0, sizeof (lvi));
-
-  err = gpgme_new (&ctx);
-  if (err)
-    return NULL;
-
-  err = gpgme_op_keylist_start (ctx, NULL, 0);
-  if (err)
-    {
-      log_error ("failed to initiate key listing: %s\n", gpg_strerror (err));
-      gpgme_release (ctx);
-      return NULL;
-    }
-
-  keyarray_size = 500; 
-  keyarray = xcalloc (keyarray_size, sizeof *keyarray);
-  pos = 0;
-                 
-  while (!gpgme_op_keylist_next (ctx, &key)) 
-    {
-      /* We only want keys capable of encrypting. */
-      if (!key->can_encrypt)
-        {
-          gpgme_key_release (key);
-          continue;
-        }
-      
-      /* Check that the primary key is *not* revoked, expired or invalid */
-      if (key->revoked || key->expired || key->invalid || key->disabled)
-        {
-          gpgme_key_release (key);
-          continue;
-        }
-
-      /* Ignore keys without a user ID or without a subkey */
-      if (!key->uids || !key->subkeys)
-        {
-          gpgme_key_release (key);
-          continue;
-        }
-
-      /* Store the position in the opaque param. */
-      lvi.mask = LVIF_PARAM;
-      lvi.lParam = (LPARAM)pos;
-      ListView_InsertItem (hwnd, &lvi);
-      
-      s = utf8_to_native (key->uids->name);
-      ListView_SetItemText (hwnd, 0, COL_NAME, s);
-      xfree (s);
-      
-      s = key->uids->email;
-      ListView_SetItemText (hwnd, 0, COL_EMAIL, s);
-
-      s = keybuf;
-      *s = 0;
-      s = stpcpy (s, get_pubkey_algo_str (key->subkeys->pubkey_algo));
-      if (key->subkeys->next)
-        {
-          /* Fixme: This is not really correct because we don't know
-             which encryption subkey gpg is going to select. Same
-             holds true for the key length below. */
-          *s++ = '/';
-          s = stpcpy (s, get_pubkey_algo_str
-                      (key->subkeys->next->pubkey_algo));
-        }      
-      
-      *s++ = ' ';
-      if (key->subkeys->next)
-        sprintf (s, "%d", key->subkeys->next->length);
-      else
-        sprintf (s, "%d", key->subkeys->length);
-
-      s = keybuf;
-      ListView_SetItemText (hwnd, 0, COL_KEYINF, s);
-      
-      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 > 5) 
-	val = 0;
-      strcpy (keybuf, trust_items[val]);
-      s = keybuf;
-      ListView_SetItemText (hwnd, 0, COL_TRUST, s);
-
-      if (pos >= keyarray_size)
-        {
-          gpgme_key_t *tmparr;
-          size_t i;
-
-          keyarray_size += 500;
-          tmparr = xcalloc (keyarray_size, sizeof *tmparr);
-          for (i=0; i < pos; i++)
-            tmparr[i] = keyarray[i];
-          xfree (keyarray);
-          keyarray = tmparr;
-        }
-      keyarray[pos++] = key;
-
-    }
-
-  gpgme_op_keylist_end (ctx);
-  gpgme_release (ctx);
-
-  *r_arraysize = pos;
-  return keyarray;
-}
-
-
-/* Release the key array ARRAY as well as all COUNT keys. */
-static void
-release_keyarray (gpgme_key_t *array, size_t count)
-{
-  size_t n;
-
-  if (!array)
-    return;
-  for (n=0; n < count; n++)
-    gpgme_key_release (array[n]);
-  xfree (array);
-}
-
-
-/* Default maximal text size for a column. */
-#define ITEMSIZE 200
-
-/* Return the opaque param of the item with the index IDX.
-   If the function call failed, return -1. */
-static LPARAM
-lv_get_item_param (HWND hwnd, int idx)
-{
-  LVITEM lv;
-  
-  memset (&lv, 0, sizeof (lv));
-  lv.mask = LVIF_PARAM;
-  lv.iItem = idx;
-  if (!ListView_GetItem (hwnd, &lv))
-    return (LPARAM)-1;
-  return lv.lParam;
-}
-
-/* Copy one list view item from one view to another. */
-static void
-copy_item (HWND dlg, int id_from, int pos)
-{
-  HWND src, dst;
-  LVITEM lvi;
-  char item[KL_COL_N][ITEMSIZE];
-  int idx = pos, i;
-  int lparam;
-  
-  src = GetDlgItem (dlg, id_from);
-  dst = GetDlgItem (dlg, id_from==IDC_ENC_RSET1 ?
-                    IDC_ENC_RSET2 : IDC_ENC_RSET1);
-  
-  if (idx == -1)
-    {
-      idx = ListView_GetNextItem (src, -1, LVNI_SELECTED);
-      if (idx == -1)
-        return;
-    }
-  
-  for (i=0; i < KL_COL_N; i++)
-    ListView_GetItemText (src, idx, i, item[i], ITEMSIZE-1);
-
-  /* Before we delete the item, we backup the lparam which
-     holds the position to copy it to the new item. */
-  lparam = (int)lv_get_item_param (src, idx);
-  ListView_DeleteItem (src, idx);
-  
-  /* Add the lparam value from the source item. */
-  memset (&lvi, 0, sizeof (lvi));
-  lvi.mask = LVIF_PARAM;
-  lvi.lParam = lparam;
-  ListView_InsertItem (dst, &lvi);
-  
-  for (i=0; i < KL_COL_N; i++)
-    ListView_SetItemText (dst, 0, i, item[i]);
-}
-
-
-/* Try to find an item with STR as the text in the first column.
-   Return the index of the item or -1 if no item was found. */
-static int
-find_item (HWND hwnd, const char *str)
-{
-  LVFINDINFO fnd;
-  int pos;
-  
-  memset (&fnd, 0, sizeof (fnd));
-  fnd.flags = LVFI_STRING|LVFI_PARTIAL;;
-  fnd.psz = str;
-  pos = ListView_FindItem (hwnd, -1, &fnd);
-  if (pos != -1)
-    return pos;
-  return -1;
-}
-
-
-static void
-initialize_keybox (HWND dlg, struct recipient_cb_s *cb)
-{
-  size_t i;
-  HWND box = GetDlgItem (dlg, IDC_ENC_NOTFOUND);
-  HWND rset = GetDlgItem (dlg, IDC_ENC_RSET1);
-  int n;
-  
-  if (cb->unknown_keys)
-    {
-      for (i=0; cb->unknown_keys[i]; i++)
-        SendMessage (box, LB_ADDSTRING, 0,
-                     (LPARAM)(const char *)cb->unknown_keys[i]);
-    }
-
-  if (!cb->fnd_keys)
-    return;
-  
-  /* Copy all requested keys into the second recipient listview
-     to indicate that these key were automatically picked via
-     the 'From' mailing header. */
-  for (i=0; cb->fnd_keys[i]; i++) 
-    {
-      char *uid = utf8_to_native (cb->fnd_keys[i]->uids->name);
-      
-      n = find_item (rset, uid);
-      if (n != -1)
-	copy_item (dlg, IDC_ENC_RSET1, n);
-      xfree (uid);
-    }  
-}
-
-/* To avoid writing a dialog template for each language we use gettext
-   for the labels and hope that there is enough space in the dialog to
-   fit teh longest translation.  */
-static void
-recipient_dlg_set_labels (HWND dlg)
-{
-  static struct { int itemid; const char *label; } labels[] = {
-    { IDC_ENC_RSET2_T,    N_("Selected recipients:")},
-    { IDC_ENC_NOTFOUND_T, N_("Recipient which were NOT found")},
-    { IDCANCEL,           N_("&Cancel")},
-    { 0, NULL}
-  };
-  int i;
-
-  for (i=0; labels[i].itemid; i++)
-    SetDlgItemText (dlg, labels[i].itemid, _(labels[i].label));
-}  
-
-
-BOOL CALLBACK
-recipient_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
-{
-  static struct recipient_cb_s *rset_cb;
-  NMHDR *notify;
-  HWND hrset;
-  size_t pos;
-  int i, j;
-
-  switch (msg) 
-    {
-    case WM_INITDIALOG:
-      rset_cb = (struct recipient_cb_s *)lparam;
-      assert (rset_cb != NULL);
-      recipient_dlg_set_labels (dlg);
-      initialize_rsetbox (GetDlgItem (dlg, IDC_ENC_RSET1));
-      rset_cb->keyarray = load_rsetbox (GetDlgItem (dlg, IDC_ENC_RSET1),
-                                        &rset_cb->keyarray_count);
-      initialize_rsetbox (GetDlgItem (dlg, IDC_ENC_RSET2));
-
-      if (rset_cb->unknown_keys)
-        initialize_keybox (dlg, rset_cb);
-      else
-        {
-          /* No unknown keys; thus we do not need the unwanted key box. */
-          ShowWindow (GetDlgItem (dlg, IDC_ENC_NOTFOUND_T), SW_HIDE);
-          ShowWindow (GetDlgItem (dlg, IDC_ENC_NOTFOUND), SW_HIDE);
-	}
-
-      center_window (dlg, NULL);
-      SetForegroundWindow (dlg);
-      return TRUE;
-
-    case WM_NOTIFY:
-      notify = (LPNMHDR)lparam;
-      if (notify && notify->code == NM_DBLCLK
-          && (notify->idFrom == IDC_ENC_RSET1
-              || notify->idFrom == IDC_ENC_RSET2))
-        copy_item (dlg, notify->idFrom, -1);
-      break;
-
-    case WM_COMMAND:
-      switch (LOWORD (wparam))
-        {
-	case IDOK:
-          hrset = GetDlgItem (dlg, IDC_ENC_RSET2);
-          if (ListView_GetItemCount (hrset) == 0) 
-            {
-              MessageBox (dlg, 
-                      _("Please select at least one recipient certificate."),
-                      _("Recipient Dialog"), MB_ICONINFORMATION|MB_OK);
-              return TRUE;
-	    }
-
-          for (j=0; rset_cb->fnd_keys && rset_cb->fnd_keys[j]; j++)
-            ;
-          rset_cb->selected_keys_count = ListView_GetItemCount (hrset);
-          rset_cb->selected_keys = xcalloc (rset_cb->selected_keys_count
-                                            + j + 1,
-                                            sizeof *rset_cb->selected_keys);
-          /* Add the selected keys. */
-          for (i=0, pos=0; i < rset_cb->selected_keys_count; i++) 
-            {
-              gpgme_key_t key;
-	      int idata;
-	      
-	      idata = (int)lv_get_item_param (hrset, i);
-              if (idata >= 0 && idata < rset_cb->keyarray_count)
-                {
-                  key = rset_cb->keyarray[idata];
-                  gpgme_key_ref (key);
-                  rset_cb->selected_keys[pos++] = key;
-
-                  switch (key->uids->validity)
-                    {
-                    case GPGME_VALIDITY_FULL:
-                    case GPGME_VALIDITY_ULTIMATE:
-                      break;
-                    default:
-                      /* Force encryption if one key is not fully
-                         trusted.  Actually this is a bit silly but
-                         supposedly here to allow adding an option to
-                         disable this "feature". It is however pretty
-                         much messed up: The default key should never
-                         be processed here but set into the gpg.conf
-                         file becuase it is always trusted.  */
-                      rset_cb->opts |= OPT_FLAG_FORCE;
-                      break;
-                    }
-                }
-              else
-                log_debug ("List item not correctly initialized - ignored\n");
-            }
-          /* Add the already found keys. */
-          for (i=0; rset_cb->fnd_keys && rset_cb->fnd_keys[i]; i++)
-            {
-              gpgme_key_ref (rset_cb->fnd_keys[i]);
-              rset_cb->selected_keys[pos++] = rset_cb->fnd_keys[i];
-            }
-
-          rset_cb->selected_keys_count = pos;
-          EndDialog (dlg, TRUE);
-          break;
-
-	case IDCANCEL:
-	  /* 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;
-    }
-  return FALSE;
-}
-
-
-
-/* Display a recipient dialog to select keys and return all selected
-   keys in RET_RSET.  Returns the selected options which may include
-   OPT_FLAG_CANCEL.  */
-unsigned int 
-recipient_dialog_box (gpgme_key_t **ret_rset)
-{
-  struct recipient_cb_s cb;
-  int resid;
-  
-  *ret_rset = NULL;
-
-  memset (&cb, 0, sizeof (cb));
-  resid = IDD_ENC;
-  DialogBoxParam (glob_hinst, (LPCTSTR)resid, GetDesktopWindow(),
-                  recipient_dlg_proc, (LPARAM)&cb);
-  if (cb.opts & OPT_FLAG_CANCEL)
-    release_keyarray (cb.selected_keys, cb.selected_keys_count);
-  else
-    *ret_rset = cb.selected_keys;
-  release_keyarray (cb.keyarray, cb.keyarray_count);
-  return cb.opts;
-}
-
-
-/* Exactly like recipient_dialog_box with the difference, that this
-   dialog is used when some recipients were not found due to automatic
-   selection. In such a case, the dialog displays the found recipients
-   and the listbox contains the items which were _not_ found.  FND is
-   a NULL terminated array with the keys we already found, UNKNOWn is
-   a string array with names of recipients for whom we don't have a
-   key yet.  RET_RSET returs a NULL termintated array with all
-   selected keys.  The function returns the selected options which may
-   include OPT_FLAG_CANCEL.
-*/
-unsigned int
-recipient_dialog_box2 (gpgme_key_t *fnd, char **unknown,
-		       gpgme_key_t **ret_rset)
-{
-  struct recipient_cb_s cb;
-  int resid;
-  
-  *ret_rset = NULL;
-
-  memset (&cb, 0, sizeof (cb));
-  cb.fnd_keys = fnd;
-  cb.unknown_keys = unknown;
-
-  resid = IDD_ENC;
-  DialogBoxParam (glob_hinst, (LPCTSTR)resid, GetDesktopWindow (),
-		  recipient_dlg_proc, (LPARAM)&cb);
-
-  if (cb.opts & OPT_FLAG_CANCEL)
-    release_keyarray (cb.selected_keys, cb.selected_keys_count);
-  else
-    *ret_rset = cb.selected_keys;
-
-  release_keyarray (cb.keyarray, cb.keyarray_count);
-  return cb.opts;
-}
diff --git a/src/verify-dialog.c b/src/verify-dialog.c
deleted file mode 100644
index 34e9d5a..0000000
--- a/src/verify-dialog.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/* verify-dialog.c
- *	Copyright (C) 2005, 2007 g10 Code GmbH
- *
- * This file is part of GpgOL.
- * 
- * GpgOL is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * GpgOL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include <windows.h>
-#include <time.h>
-
-#include "common.h"
-#include "gpgol-ids.h"
-#include "dialogs.h"
-
-struct dialog_context
-{
-  gpgme_verify_result_t res;
-  gpgme_protocol_t protocol;
-  const char *filename;
-};
-
-
-static char*
-get_timestamp (time_t l)
-{
-    static char buf[64];
-    struct tm * tm;
-
-    if (l == 0) {
-	sprintf (buf, "????" "-??" "-?? ??" ":??" ":??");
-	return buf;
-    }
-	
-    tm = localtime (&l);
-    sprintf (buf, "%04d-%02d-%02d %02d:%02d:%02d",
-	     tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
-	     tm->tm_hour, tm->tm_min, tm->tm_sec);
-    return buf;
-}
-
-
-static int
-load_akalist (HWND dlg, gpgme_key_t key)
-{
-  gpgme_user_id_t u;
-  char *uid;
-  int n = 0;
-  
-  u = key->uids;
-  if (!u->next)
-    return n;
-  for (u=u->next; u; u=u->next) 
-    {
-      uid = utf8_to_native (u->uid);
-      SendDlgItemMessage (dlg, IDC_VRY_AKALIST, LB_ADDSTRING,
-			  0, (LPARAM)(const char*)uid);
-      xfree (uid);
-      n++;
-    }
-  return n;
-}
-
-
-static void 
-load_sigbox (HWND dlg, gpgme_verify_result_t ctx, gpgme_protocol_t protocol)
-{
-  gpgme_error_t err;
-  gpgme_key_t key;
-  char buf[2+16+1];
-  char *p;
-  const char *s;
-  int stat;
-  int valid, no_key = 0, n = 0;
-  
-  s = get_timestamp (ctx->signatures->timestamp);
-  SetDlgItemText (dlg, IDC_VRY_TIME, s);
-  
-  s = ctx->signatures->fpr;
-  if (strlen (s) == 40)
-    strncpy (buf+2, s+40-8, 8);
-  else if (strlen (s) == 32) /* MD5:RSAv3 */
-    strncpy (buf+2, s+32-8, 8);
-  else
-    strncpy (buf+2, s+8, 8);
-  buf[10] = 0;
-  buf[0] = '0'; 
-  buf[1] = 'x';
-  SetDlgItemText (dlg, IDC_VRY_KEYID, buf);
-
-  {
-    gpgme_ctx_t gctx;
-
-    key = NULL;
-    if (!gpgme_new (&gctx))
-      {
-        gpgme_set_protocol (gctx, protocol);
-        err = gpgme_get_key (gctx, buf+2, &key, 0);
-        if (err)
-          {
-            log_debug ("getting key `%s' failed: %s",
-                       buf+2, gpg_strerror (err));
-            key = NULL;
-          }
-        gpgme_release (gctx);
-      }
-  }
-
-  stat = ctx->signatures->summary;
-  if (stat & GPGME_SIGSUM_RED)
-    s = _("BAD signature!");
-  else if (!stat || (stat & GPGME_SIGSUM_GREEN))
-    s = _("Good signature");
-  else if (stat & GPGME_SIGSUM_KEY_REVOKED)
-    s = _("Good signature from revoked certificate");
-  else if (stat & GPGME_SIGSUM_KEY_EXPIRED)
-    s = _("Good signature from expired certificate");
-  else if (stat & GPGME_SIGSUM_SIG_EXPIRED)
-    s = _("Good expired signature");
-  else if (stat & GPGME_SIGSUM_KEY_MISSING) 
-    {
-      s = _("Could not check signature: missing certificate");
-      no_key = 1;
-    }
-  else
-    s = _("Verification error");
-  /* XXX: if we have a key we do _NOT_ trust, stat is 'wrong' */
-  SetDlgItemText (dlg, IDC_VRY_STATUS, s);
-  
-  if (key && key->uids) 
-    {
-      p = utf8_to_native (key->uids->uid);
-      SetDlgItemText (dlg, IDC_VRY_ISSUER, p);
-      xfree (p);
-      
-      n = load_akalist (dlg, key);
-      gpgme_key_release (key);
-      if (n == 0)
-	EnableWindow (GetDlgItem (dlg, IDC_VRY_AKALIST), FALSE);
-    }
-  else 
-    {
-      s = _("User-ID not found");
-      SetDlgItemText (dlg, IDC_VRY_ISSUER, s);
-    }
-  
-  s = get_pubkey_algo_str (ctx->signatures->pubkey_algo);
-  SetDlgItemText (dlg, IDC_VRY_PKALGO, s);
-  
-  valid = ctx->signatures->validity;
-  if (stat & GPGME_SIGSUM_RED)
-    {
-      /* This is a BAD signature; give a hint to the user. */
-      SetDlgItemText (dlg, IDC_VRY_HINT, 
-               _("This may be due to a wrong option setting"));
-    }
-  else if (stat & GPGME_SIGSUM_SIG_EXPIRED) 
-    {
-      const char *fmt;
-    
-      fmt = _("Signature expired on %s");
-      s = get_timestamp (ctx->signatures->exp_timestamp);
-      p = xmalloc (strlen (s)+1+strlen (fmt)+2);
-      sprintf (p, fmt, s);
-      SetDlgItemText (dlg, IDC_VRY_HINT, s);
-      xfree (p);
-    }
-  else if (valid < GPGME_VALIDITY_MARGINAL) 
-    {
-      switch (valid) 
-	{
-	case GPGME_VALIDITY_NEVER:
-	  s = _("Signature issued by a certificate we do NOT trust.");
-	  break;
-	  
-	default:
-	  if (no_key)
-	    s = "";
-	  else
-	    s = _("Signature issued by a non-valid certificate.");
-	  break;
-	}
-      SetDlgItemText (dlg, IDC_VRY_HINT, s);
-    }
-}
-
-
-
-/* To avoid writing a dialog template for each language we use gettext
-   for the labels and hope that there is enough space in the dialog to
-   fit teh longest translation.  */
-static void
-verify_dlg_set_labels (HWND dlg)
-{
-  static struct { int itemid; const char *label; } labels[] = {
-    { IDC_VRY_TIME_T,   N_("Signature made")},
-    { IDC_VRY_PKALGO_T, N_("using")},
-    { IDC_VRY_KEYID_T,  N_("cert-ID")},
-    { IDC_VRY_ISSUER_T, N_("from")},
-    { IDC_VRY_AKALIST_T,N_("also known as")},
-    { 0, NULL}
-  };
-  int i;
-
-  for (i=0; labels[i].itemid; i++)
-    SetDlgItemText (dlg, labels[i].itemid, _(labels[i].label));
-}  
-
-
-
-static BOOL CALLBACK
-verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
-{
-  static struct dialog_context *ctx;
-
-  switch (msg) 
-    {
-    case WM_INITDIALOG:
-      ctx = (struct dialog_context *)lparam;
-      load_sigbox (dlg, ctx->res, ctx->protocol);
-      verify_dlg_set_labels (dlg);
-      center_window (dlg, NULL);
-      SetForegroundWindow (dlg);
-      if (ctx->filename)
-        {
-          const char *s;
-          
-          switch (ctx->protocol)
-            {
-            case GPGME_PROTOCOL_OpenPGP:
-              s = _("PGP/MIME Verification Result");
-              break;
-            case GPGME_PROTOCOL_CMS:
-              s = _("S/MIME Verification Result");
-              break;
-              default:
-                s = "?";
-                break;
-            }
-          
-          char *tmp = xmalloc (strlen (ctx->filename) 
-                               + strlen (s) + 100);
-          strcpy (stpcpy (stpcpy (stpcpy (tmp, s),
-                                  " ("), ctx->filename), ")");
-          SetWindowText (dlg, tmp);
-          xfree (tmp);
-          }
-      break;
-      
-    case WM_COMMAND:
-      switch (LOWORD(wparam))
-        {
-        case IDOK:
-          EndDialog (dlg, TRUE);
-          break;
-        }
-      break;
-    }
-
-  return FALSE;
-}
-
-
-/* Display the verify dialog based on the gpgme result in
-   RES. FILENAME is used to modify the caption of the dialog; it may
-   be NULL. */
-int
-verify_dialog_box (gpgme_protocol_t protocol, 
-                   gpgme_verify_result_t res, const char *filename)
-{
-  struct dialog_context ctx;
-  int resid;
-
-  memset (&ctx,0, sizeof ctx);
-  ctx.res = res;
-  ctx.protocol = protocol;
-  ctx.filename = filename;
-
-  resid = IDD_VRY;
-  DialogBoxParam (glob_hinst, (LPCTSTR)resid, GetDesktopWindow (),
-                  verify_dlg_proc, (LPARAM)&ctx);
-  return res->signatures->summary == GPGME_SIGSUM_GREEN? 0 : -1;
-}

-----------------------------------------------------------------------

Summary of changes:
 src/Makefile.am         |  15 +-
 src/config-dialog.c     |   5 +
 src/engine-assuan.c     |  63 ++--
 src/engine.c            |   4 +-
 src/main.c              |  13 -
 src/mapi32.def          | 164 ----------
 src/olflange-dlgs.cpp   |   6 +
 src/oomhelp.cpp         |   4 +-
 src/passcache.c         | 263 ----------------
 src/passcache.h         |  34 ---
 src/passphrase-dialog.c | 786 ------------------------------------------------
 src/proto-auto.bmp      | Bin 246 -> 0 bytes
 src/proto-pgpmime.bmp   | Bin 246 -> 0 bytes
 src/proto-smime.bmp     | Bin 246 -> 0 bytes
 src/recipient-dialog.c  | 565 ----------------------------------
 src/util.h              |   7 +
 src/verify-dialog.c     | 296 ------------------
 17 files changed, 71 insertions(+), 2154 deletions(-)
 delete mode 100644 src/mapi32.def
 delete mode 100644 src/passcache.c
 delete mode 100644 src/passcache.h
 delete mode 100644 src/passphrase-dialog.c
 delete mode 100644 src/proto-auto.bmp
 delete mode 100644 src/proto-pgpmime.bmp
 delete mode 100644 src/proto-smime.bmp
 delete mode 100644 src/recipient-dialog.c
 delete mode 100644 src/verify-dialog.c


hooks/post-receive
-- 
GnuPG extension for MS Outlook
http://git.gnupg.org




More information about the Gnupg-commits mailing list