[svn] GPGol - r102 - trunk/src
svn author twoaday
cvs at cvs.gnupg.org
Tue Sep 20 13:35:33 CEST 2005
Author: twoaday
Date: 2005-09-20 13:35:31 +0200 (Tue, 20 Sep 2005)
New Revision: 102
Added:
trunk/src/attach.cpp
trunk/src/attach.h
Modified:
trunk/src/ChangeLog
trunk/src/Makefile.am
trunk/src/gpgmsg.cpp
trunk/src/intern.h
trunk/src/myexchext.h
trunk/src/olflange-def.h
trunk/src/olflange.cpp
trunk/src/olflange.h
trunk/src/passphrase-dialog.c
trunk/src/recipient-dialog.c
trunk/src/rfc822parse.c
trunk/src/verify-dialog.c
trunk/src/watcher.cpp
Log:
See ChangeLog.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/ChangeLog 2005-09-20 11:35:31 UTC (rev 102)
@@ -1,3 +1,17 @@
+2005-09-20 Timo Schulz <ts at g10code.com>
+
+ * attach.c: New.
+ * attach.h: New.
+ * olflange.cpp (CGPGExchExt): Allocate class for
+ attached file events.
+ (QueryInterface): Return interface pointer for
+ attached file events.
+ * passphrase-dialog.c (load_secbox): Use new GPGME
+ interface.
+ (get_pubkey_algo_str): New.
+ * verify-dialog.c (load_sigbox): Likewise.
+ * recipient-dialog.c (load_recipbox): Likewise.
+
2005-09-19 Werner Koch <wk at g10code.com>
* msgcache.c (flush_if_needed): New.
@@ -2,3 +16,2 @@
(msgcache_put): use it.
-
* intern.h (opt): New compatibility flags AUTO_DECRYPT and
@@ -8,12 +21,9 @@
* olflange.cpp (InstallCommands): Use watcher stuff only when this
option has been enabled.
* gpgmsg.cpp (decrypt): Take care of NO_ATTESTATION.
-
* main.c (DllMain): Removed debug output; this should not be
used before initialization!
-
* watcher.cpp: Include config.h. Removed weird line endings.
-
* gpgmsg.cpp (encrypt_and_sign): Call SaveChanges.
2005-09-15 Timo Schulz <ts at g10code.com>
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/Makefile.am 2005-09-20 11:35:31 UTC (rev 102)
@@ -43,7 +43,8 @@
verify-dialog.c \
mymapi.h mymapitags.h \
vasprintf.c \
- watcher.cpp
+ watcher.cpp \
+ attach.cpp attach.h
gpgol_LDADD = gpgol.def \
$(GPGME_LIBS) mapi32.dll -lshell32 -lgdi32 -lcomdlg32
Added: trunk/src/attach.cpp
===================================================================
--- trunk/src/attach.cpp 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/attach.cpp 2005-09-20 11:35:31 UTC (rev 102)
@@ -0,0 +1,57 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <windows.h>
+
+#include "mymapi.h"
+#include "mymapitags.h"
+#include "myexchext.h"
+#include "olflange-def.h"
+#include "olflange.h"
+#include "attach.h"
+#include "util.h"
+
+
+STDMETHODIMP
+CGPGExchExtAttachedFileEvents::OnReadPattFromSzFile
+ (LPATTACH att, LPTSTR lpszFile, ULONG ulFlags)
+{
+ log_debug ("%s: att=%p lpszFile=%s ulFlags=%lx\n",
+ __func__, att, lpszFile, ulFlags);
+ return S_FALSE;
+}
+
+
+STDMETHODIMP
+CGPGExchExtAttachedFileEvents::OnWritePattToSzFile
+ (LPATTACH att, LPTSTR lpszFile, ULONG ulFlags)
+{
+ log_debug ("%s: att=%p lpszFile=%s ulFlags=%lx\n",
+ __func__, att, lpszFile, ulFlags);
+ return S_FALSE;
+}
+
+
+STDMETHODIMP
+CGPGExchExtAttachedFileEvents::QueryDisallowOpenPatt (LPATTACH att)
+{
+ log_debug ("%s: att=%p\n", __func__, att);
+ return S_FALSE;
+}
+
+
+STDMETHODIMP
+CGPGExchExtAttachedFileEvents::OnOpenPatt (LPATTACH att)
+{
+ log_debug ("%s: att=%p\n", __func__, att);
+ return S_FALSE;
+}
+
+
+
+STDMETHODIMP
+CGPGExchExtAttachedFileEvents::OnOpenSzFile (LPTSTR lpszFile, ULONG ulFlags)
+{
+ log_debug ("%s: lpszFile=%s ulflags=%lx\n", __func__, lpszFile, ulFlags);
+ return S_FALSE;
+}
Added: trunk/src/attach.h
===================================================================
--- trunk/src/attach.h 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/attach.h 2005-09-20 11:35:31 UTC (rev 102)
@@ -0,0 +1,64 @@
+
+#ifndef ATTACH_H
+#define ATTACH_H
+
+#include "util.h"
+
+class CGPGExchExtAttachedFileEvents : public IExchExtAttachedFileEvents
+{
+private:
+ CGPGExchExt *m_pExchExt;
+ ULONG m_ref;
+
+public:
+ CGPGExchExtAttachedFileEvents (CGPGExchExt *pParentInterface)
+ {
+ m_pExchExt = pParentInterface;
+ m_ref = 0;
+ }
+
+
+ inline STDMETHODIMP_(ULONG) AddRef (void)
+ {
+ ++m_ref;
+ return m_ref;
+ }
+
+ inline STDMETHODIMP_(ULONG) Release (void)
+ {
+ ULONG count = --m_ref;
+ if (!count)
+ delete this;
+ return count;
+ }
+
+ STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR *ppvObj)
+ {
+ *ppvObj = NULL;
+ if (riid == IID_IExchExtAttachedFileEvents)
+ {
+ *ppvObj = (LPVOID)this;
+ AddRef ();
+ return S_OK;
+ }
+
+ if (riid == IID_IUnknown)
+ {
+ *ppvObj = (LPVOID)m_pExchExt;
+ m_pExchExt->AddRef ();
+ return S_OK;
+ }
+ log_debug ("%s: request for unknown interface\n", __func__);
+ return E_NOINTERFACE;
+ }
+
+ STDMETHODIMP OnReadPattFromSzFile (LPATTACH att, LPTSTR lpszFile,
+ ULONG ulFlags);
+ STDMETHODIMP OnWritePattToSzFile (LPATTACH att, LPTSTR lpszFile,
+ ULONG ulFlags);
+ STDMETHODIMP QueryDisallowOpenPatt (LPATTACH att);
+ STDMETHODIMP OnOpenPatt (LPATTACH att);
+ STDMETHODIMP OnOpenSzFile (LPTSTR lpszFile, ULONG ulFlags);
+};
+
+#endif /*ATTACH_H*/
Modified: trunk/src/gpgmsg.cpp
===================================================================
--- trunk/src/gpgmsg.cpp 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/gpgmsg.cpp 2005-09-20 11:35:31 UTC (rev 102)
@@ -1342,7 +1342,6 @@
}
}
-
leave:
/* FIXME: What to do with already encrypted attachments if some of
the encrypted (or other operations) failed? */
Modified: trunk/src/intern.h
===================================================================
--- trunk/src/intern.h 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/intern.h 2005-09-20 11:35:31 UTC (rev 102)
@@ -139,6 +139,7 @@
const char *pass_info,
int prev_was_bad, int fd);
void free_decrypt_key (struct decrypt_key_s * ctx);
+const char *get_pubkey_algo_str (gpgme_pubkey_algo_t id);
/*-- config-dialog.c --*/
void config_dialog_box (HWND parent);
Modified: trunk/src/myexchext.h
===================================================================
--- trunk/src/myexchext.h 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/myexchext.h 2005-09-20 11:35:31 UTC (rev 102)
@@ -1,337 +1,365 @@
-/* myexchext.h - Simple replacement for exchext.h
-
- * This file defines the interface used by Exchange extensions. It
- * has been compiled by g10 Code GmbH from several sources describing
- * the interface.
- *
- * Revisions:
- * 2005-08-12 Initial version.
- *
- */
-
-#ifndef EXCHEXT_H
-#define EXCHEXT_H
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-}
-#endif
-#endif
-
-#include <commctrl.h>
-#include <unknwn.h>
-#include "mymapi.h"
-
-
-/* Constants used by Install. */
-#define EECONTEXT_SESSION 0x00000001
-#define EECONTEXT_VIEWER 0x00000002
-#define EECONTEXT_REMOTEVIEWER 0x00000003
-#define EECONTEXT_SEARCHVIEWER 0x00000004
-#define EECONTEXT_ADDRBOOK 0x00000005
-#define EECONTEXT_SENDNOTEMESSAGE 0x00000006
-#define EECONTEXT_READNOTEMESSAGE 0x00000007
-#define EECONTEXT_SENDPOSTMESSAGE 0x00000008
-#define EECONTEXT_READPOSTMESSAGE 0x00000009
-#define EECONTEXT_READREPORTMESSAGE 0x0000000A
-#define EECONTEXT_SENDRESENDMESSAGE 0x0000000B
-#define EECONTEXT_PROPERTYSHEETS 0x0000000C
-#define EECONTEXT_ADVANCEDCRITERIA 0x0000000D
-#define EECONTEXT_TASK 0x0000000E
-
-/* Constants for GetVersion. */
-#define EECBGV_GETBUILDVERSION 0x00000001
-#define EECBGV_GETACTUALVERSION 0x00000002
-#define EECBGV_GETVIRTUALVERSION 0x00000004
-#define EECBGV_BUILDVERSION_MAJOR 0x000d0000
-#define EECBGV_BUILDVERSION_MAJOR_MASK 0xffff0000
-#define EECBGV_BUILDVERSION_MINOR_MASK 0x0000ffff
-
-/* Some toolbar IDs. */
-#define EETBID_STANDARD 0x00000001
-
-/* Constants use for QueryHelpText. */
-#define EECQHT_STATUS 0x00000001
-#define EECQHT_TOOLTIP 0x00000002
-
-/* Flags use by the methods of IExchExtPropertySheets. */
-#define EEPS_MESSAGE 0x00000001
-#define EEPS_FOLDER 0x00000002
-#define EEPS_STORE 0x00000003
-#define EEPS_TOOLSOPTIONS 0x00000004
-
-/* Flags used by OnFooComplete. */
-#define EEME_FAILED 0x00000001
-#define EEME_COMPLETE_FAILED 0x00000002
-
-
-/* Command IDs. */
-#define EECMDID_ToolsCustomizeToolbar 134
-#define EECMDID_ToolsOptions 136
-
-
-/* GUIDs */
-DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-
-DEFINE_OLEGUID(IID_IUnknown, 0x00000000, 0, 0);
-DEFINE_OLEGUID(IID_IDispatch, 0x00020400, 0, 0);
-
-DEFINE_OLEGUID(IID_IExchExtCallback, 0x00020d10, 0, 0);
-DEFINE_OLEGUID(IID_IExchExt, 0x00020d11, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtCommands, 0x00020d12, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtUserEvents, 0x00020d13, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtSessionEvents, 0x00020d14, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtMessageEvents, 0x00020d15, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtAttachedFileEvents,0x00020d16, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtPropertySheets, 0x00020d17, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtAdvancedCriteria, 0x00020d18, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtModeless, 0x00020d19, 0, 0);
-DEFINE_OLEGUID(IID_IExchExtModelessCallback, 0x00020d1a, 0, 0);
-DEFINE_OLEGUID(IID_IOutlookExtCallback, 0x0006720d, 0, 0);
-
-
-/* Type definitions. */
-
-/* Parameters for the toolbar entries for
- IExchExtCommands::InstallCommands. */
-struct TBENTRY
-{
- HWND hwnd;
- ULONG tbid;
- ULONG ulFlags;
- UINT itbbBase;
-};
-typedef struct TBENTRY TBENTRY;
-typedef struct TBENTRY *LPTBENTRY;
-
-
-
-
-
-
-/**** Class declarations. ***/
-typedef struct IExchExt IExchExt;
-typedef IExchExt *LPEXCHEXT;
-
-typedef struct IExchExtMessageEvents IExchExtMessageEvents;
-typedef IExchExtMessageEvents *LPEXCHEXTMESSAGEEVENTS;
-
-typedef struct IExchExtCommands IExchExtCommands;
-typedef IExchExtCommands *LPEXCHEXTCOMMANDS;
-
-typedef struct IExchExtPropertySheets IExchExtPropertySheets;
-typedef IExchExtPropertySheets *LPEXCHEXTPROPERTYSHEETS;
-
-typedef struct IExchExtCallback IExchExtCallback;
-typedef IExchExtCallback *LPEXCHEXTCALLBACK;
-
-typedef struct IOutlookExtCallback IOutlookExtCallback;
-typedef IOutlookExtCallback *LPOUTLOOKEXTCALLBACK;
-
-/* The next classes are not yet defined. but if so they should go here. */
-typedef struct IExchExtModeless IExchExtModeless;
-typedef IExchExtModeless *LPEXCHEXTMODELESS;
-typedef struct IExchExtModelessCallback IExchExtModelessCallback;
-typedef IExchExtModelessCallback *LPEXCHEXTMODELESSCALLBACK;
-
-
-
-
-/*** Class declarations of classes defined elsewhere. ***/
-struct IMAPISession;
-typedef struct IMAPISession *LPMAPISESSION;
-
-struct IAddrBook;
-typedef struct IAddrBook *LPADRBOOK;
-
-struct IMAPIFolder;
-typedef struct IMAPIFolder *LPMAPIFOLDER;
-
-struct IMAPIProp;
-typedef struct IMAPIProp *LPMAPIPROP;
-
-struct IPersistMessage;
-typedef struct IPersistMessage *LPPERSISTMESSAGE;
-
-struct IMAPIMessageSite;
-typedef struct IMAPIMessageSite *LPMAPIMESSAGESITE;
-
-struct IMAPIViewContext;
-typedef struct IMAPIViewContext *LPMAPIVIEWCONTEXT;
-
-
-
-/*** Types derived from the above class definitions. ***/
-
-/* Callback used to load an extension. */
-typedef LPEXCHEXT (CALLBACK *LPFNEXCHEXTENTRY)(void);
-
-/* Parameters for the IExchExtCallback::ChooseFolder. */
-typedef UINT (STDAPICALLTYPE *LPEECFHOOKPROC)(HWND, UINT, WPARAM, LPARAM);
-
-struct EXCHEXTCHOOSEFOLDER
-{
- UINT cbLength;
- HWND hwnd;
- LPTSTR szCaption;
- LPTSTR szLabel;
- LPTSTR szHelpFile;
- ULONG ulHelpID;
- HINSTANCE hinst;
- UINT uiDlgID;
- LPEECFHOOKPROC lpeecfhp;
- DWORD dwHookData;
- ULONG ulFlags;
- LPMDB pmdb;
- LPMAPIFOLDER pfld;
- LPTSTR szName;
- DWORD dwReserved1;
- DWORD dwReserved2;
- DWORD dwReserved3;
-};
-typedef struct EXCHEXTCHOOSEFOLDER EXCHEXTCHOOSEFOLDER;
-typedef struct EXCHEXTCHOOSEFOLDER *LPEXCHEXTCHOOSEFOLDER;
-
-
-
-
-/**** Class definitions. ***/
-
-EXTERN_C const IID IID_IExchExt;
-#undef INTERFACE
-#define INTERFACE IExchExt
-DECLARE_INTERFACE_(IExchExt, IUnknown)
-{
- /*** IUnknown methods. ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- /*** IExchExt methods. ***/
- STDMETHOD(Install)(THIS_ LPEXCHEXTCALLBACK, ULONG, ULONG) PURE;
-};
-
-
-
-EXTERN_C const IID IID_IExchExtMessageEvents;
-#undef INTERFACE
-#define INTERFACE IExchExtMessageEvents
-DECLARE_INTERFACE_(IExchExtMessageEvents, IUnknown)
-{
- /*** IUnknown methods. ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- /*** IExchExtMessageEvents methods. ***/
- STDMETHOD(OnRead)(THIS_ LPEXCHEXTCALLBACK) PURE;
- STDMETHOD(OnReadComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE;
- STDMETHOD(OnWrite)(THIS_ LPEXCHEXTCALLBACK) PURE;
- STDMETHOD(OnWriteComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE;
- STDMETHOD(OnCheckNames)(THIS_ LPEXCHEXTCALLBACK) PURE;
- STDMETHOD(OnCheckNamesComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE;
- STDMETHOD(OnSubmit)(THIS_ LPEXCHEXTCALLBACK) PURE;
- STDMETHOD_(void, OnSubmitComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE;
-};
-
-
-
-EXTERN_C const IID IID_IExchExtCommands;
-#undef INTERFACE
-#define INTERFACE IExchExtCommands
-DECLARE_INTERFACE_(IExchExtCommands, IUnknown)
-{
- /*** IUnknown methods. ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- /*** IExchExtCommands methods. ***/
- STDMETHOD(InstallCommands)(THIS_ LPEXCHEXTCALLBACK, HWND, HMENU,
- UINT*, LPTBENTRY, UINT, ULONG) PURE;
- STDMETHOD_(void, InitMenu)(THIS_ LPEXCHEXTCALLBACK) PURE;
- STDMETHOD(DoCommand)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE;
- STDMETHOD(Help)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE;
- STDMETHOD(QueryHelpText)(THIS_ UINT, ULONG, LPTSTR, UINT) PURE;
- STDMETHOD(QueryButtonInfo)(THIS_ ULONG, UINT, LPTBBUTTON,
- LPTSTR, UINT, ULONG) PURE;
- STDMETHOD(ResetToolbar)(THIS_ ULONG, ULONG) PURE;
-};
-
-
-
-EXTERN_C const IID IID_IExchExtPropertySheets;
-#undef INTERFACE
-#define INTERFACE IExchExtPropertySheets
-DECLARE_INTERFACE_(IExchExtPropertySheets, IUnknown)
-{
- /*** IUnknown methods. ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- /*** IExchExtPropertySheet methods. ***/
- STDMETHOD_(ULONG, GetMaxPageCount)(THIS_ ULONG) PURE;
- STDMETHOD(GetPages)(THIS_ LPEXCHEXTCALLBACK, ULONG,
- LPPROPSHEETPAGE, ULONG*) PURE;
- STDMETHOD_(void, FreePages)(THIS_ LPPROPSHEETPAGE, ULONG, ULONG) PURE;
-};
-
-
-
-EXTERN_C const IID IID_IExchExtCallback;
-#undef INTERFACE
-#define INTERFACE IExchExtCallback
-DECLARE_INTERFACE_(IExchExtCallback, IUnknown)
-{
- /*** IUnknown methods. ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- /*** IExchExtCallback methods. ***/
- STDMETHOD(GetVersion)(THIS_ ULONG*, ULONG) PURE;
- STDMETHOD(GetWindow)(THIS_ HWND*) PURE;
- STDMETHOD(GetMenu)(THIS_ HMENU*) PURE;
- STDMETHOD(GetToolbar)(THIS_ ULONG, HWND*) PURE;
- STDMETHOD(GetSession)(THIS_ LPMAPISESSION*, LPADRBOOK*) PURE;
- STDMETHOD(GetObject)(THIS_ LPMDB*, LPMAPIPROP*) PURE;
- STDMETHOD(GetSelectionCount)(THIS_ ULONG*) PURE;
- STDMETHOD(GetSelectionItem)(THIS_ ULONG, ULONG*, LPENTRYID*, ULONG*,
- LPTSTR, ULONG, ULONG*, ULONG) PURE;
- STDMETHOD(GetMenuPos)(THIS_ ULONG, HMENU*, ULONG*, ULONG*, ULONG) PURE;
- STDMETHOD(GetSharedExtsDir)(THIS_ LPTSTR, ULONG, ULONG) PURE;
- STDMETHOD(GetRecipients)(THIS_ LPADRLIST*) PURE;
- STDMETHOD(SetRecipients)(THIS_ LPADRLIST) PURE;
- STDMETHOD(GetNewMessageSite)(THIS_ ULONG, LPMAPIFOLDER, LPPERSISTMESSAGE,
- LPMESSAGE*, LPMAPIMESSAGESITE*,
- LPMAPIVIEWCONTEXT*, ULONG) PURE;
- STDMETHOD(RegisterModeless)(THIS_ LPEXCHEXTMODELESS,
- LPEXCHEXTMODELESSCALLBACK*) PURE;
- STDMETHOD(ChooseFolder)(THIS_ LPEXCHEXTCHOOSEFOLDER) PURE;
-};
-
-
-
-EXTERN_C const IID IID_IOutlookExtCallback;
-#undef INTERFACE
-#define INTERFACE IOutlookExtCallback
-DECLARE_INTERFACE_(IOutlookExtCallback, IUnknown)
-{
- /*** IUnknown methods. ***/
- STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
- STDMETHOD_(ULONG, AddRef)(THIS) PURE;
- STDMETHOD_(ULONG, Release)(THIS) PURE;
-
- /*** IOutlookExtCallback. **/
- STDMETHOD(GetObject)(LPUNKNOWN *ppunk);
- STDMETHOD(GetOfficeCharacter)(void **ppmsotfc);
-};
-
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif /*EXCHEXT_H*/
+/* myexchext.h - Simple replacement for exchext.h
+
+ * This file defines the interface used by Exchange extensions. It
+ * has been compiled by g10 Code GmbH from several sources describing
+ * the interface.
+ *
+ * Revisions:
+ * 2005-08-12 Initial version.
+ * 2005-09-18 Add IExchExtAttachedFileEvents.
+ *
+ */
+
+#ifndef EXCHEXT_H
+#define EXCHEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+}
+#endif
+#endif
+
+#include <commctrl.h>
+#include <unknwn.h>
+#include "mymapi.h"
+
+
+/* Constants used by Install. */
+#define EECONTEXT_SESSION 0x00000001
+#define EECONTEXT_VIEWER 0x00000002
+#define EECONTEXT_REMOTEVIEWER 0x00000003
+#define EECONTEXT_SEARCHVIEWER 0x00000004
+#define EECONTEXT_ADDRBOOK 0x00000005
+#define EECONTEXT_SENDNOTEMESSAGE 0x00000006
+#define EECONTEXT_READNOTEMESSAGE 0x00000007
+#define EECONTEXT_SENDPOSTMESSAGE 0x00000008
+#define EECONTEXT_READPOSTMESSAGE 0x00000009
+#define EECONTEXT_READREPORTMESSAGE 0x0000000A
+#define EECONTEXT_SENDRESENDMESSAGE 0x0000000B
+#define EECONTEXT_PROPERTYSHEETS 0x0000000C
+#define EECONTEXT_ADVANCEDCRITERIA 0x0000000D
+#define EECONTEXT_TASK 0x0000000E
+
+/* Constants for GetVersion. */
+#define EECBGV_GETBUILDVERSION 0x00000001
+#define EECBGV_GETACTUALVERSION 0x00000002
+#define EECBGV_GETVIRTUALVERSION 0x00000004
+#define EECBGV_BUILDVERSION_MAJOR 0x000d0000
+#define EECBGV_BUILDVERSION_MAJOR_MASK 0xffff0000
+#define EECBGV_BUILDVERSION_MINOR_MASK 0x0000ffff
+
+/* Some toolbar IDs. */
+#define EETBID_STANDARD 0x00000001
+
+/* Constants use for QueryHelpText. */
+#define EECQHT_STATUS 0x00000001
+#define EECQHT_TOOLTIP 0x00000002
+
+/* Flags use by the methods of IExchExtPropertySheets. */
+#define EEPS_MESSAGE 0x00000001
+#define EEPS_FOLDER 0x00000002
+#define EEPS_STORE 0x00000003
+#define EEPS_TOOLSOPTIONS 0x00000004
+
+/* Flags used by OnFooComplete. */
+#define EEME_FAILED 0x00000001
+#define EEME_COMPLETE_FAILED 0x00000002
+
+
+/* Command IDs. */
+#define EECMDID_ToolsCustomizeToolbar 134
+#define EECMDID_ToolsOptions 136
+
+
+/* GUIDs */
+DEFINE_GUID(GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+
+DEFINE_OLEGUID(IID_IUnknown, 0x00000000, 0, 0);
+DEFINE_OLEGUID(IID_IDispatch, 0x00020400, 0, 0);
+
+DEFINE_OLEGUID(IID_IExchExtCallback, 0x00020d10, 0, 0);
+DEFINE_OLEGUID(IID_IExchExt, 0x00020d11, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtCommands, 0x00020d12, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtUserEvents, 0x00020d13, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtSessionEvents, 0x00020d14, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtMessageEvents, 0x00020d15, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtAttachedFileEvents,0x00020d16, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtPropertySheets, 0x00020d17, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtAdvancedCriteria, 0x00020d18, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtModeless, 0x00020d19, 0, 0);
+DEFINE_OLEGUID(IID_IExchExtModelessCallback, 0x00020d1a, 0, 0);
+DEFINE_OLEGUID(IID_IOutlookExtCallback, 0x0006720d, 0, 0);
+
+
+/* Type definitions. */
+
+/* Parameters for the toolbar entries for
+ IExchExtCommands::InstallCommands. */
+struct TBENTRY
+{
+ HWND hwnd;
+ ULONG tbid;
+ ULONG ulFlags;
+ UINT itbbBase;
+};
+typedef struct TBENTRY TBENTRY;
+typedef struct TBENTRY *LPTBENTRY;
+
+
+
+
+
+
+/**** Class declarations. ***/
+typedef struct IExchExt IExchExt;
+typedef IExchExt *LPEXCHEXT;
+
+typedef struct IExchExtMessageEvents IExchExtMessageEvents;
+typedef IExchExtMessageEvents *LPEXCHEXTMESSAGEEVENTS;
+
+typedef struct IExchExtCommands IExchExtCommands;
+typedef IExchExtCommands *LPEXCHEXTCOMMANDS;
+
+typedef struct IExchExtPropertySheets IExchExtPropertySheets;
+typedef IExchExtPropertySheets *LPEXCHEXTPROPERTYSHEETS;
+
+typedef struct IExchExtCallback IExchExtCallback;
+typedef IExchExtCallback *LPEXCHEXTCALLBACK;
+
+typedef struct IOutlookExtCallback IOutlookExtCallback;
+typedef IOutlookExtCallback *LPOUTLOOKEXTCALLBACK;
+
+/* The next classes are not yet defined. but if so they should go here. */
+typedef struct IExchExtModeless IExchExtModeless;
+typedef IExchExtModeless *LPEXCHEXTMODELESS;
+typedef struct IExchExtModelessCallback IExchExtModelessCallback;
+typedef IExchExtModelessCallback *LPEXCHEXTMODELESSCALLBACK;
+
+
+
+
+/*** Class declarations of classes defined elsewhere. ***/
+struct IMAPISession;
+typedef struct IMAPISession *LPMAPISESSION;
+
+struct IAddrBook;
+typedef struct IAddrBook *LPADRBOOK;
+
+struct IMAPIFolder;
+typedef struct IMAPIFolder *LPMAPIFOLDER;
+
+struct IMAPIProp;
+typedef struct IMAPIProp *LPMAPIPROP;
+
+struct IPersistMessage;
+typedef struct IPersistMessage *LPPERSISTMESSAGE;
+
+struct IMAPIMessageSite;
+typedef struct IMAPIMessageSite *LPMAPIMESSAGESITE;
+
+struct IMAPIViewContext;
+typedef struct IMAPIViewContext *LPMAPIVIEWCONTEXT;
+
+
+
+/*** Types derived from the above class definitions. ***/
+
+/* Callback used to load an extension. */
+typedef LPEXCHEXT (CALLBACK *LPFNEXCHEXTENTRY)(void);
+
+/* Parameters for the IExchExtCallback::ChooseFolder. */
+typedef UINT (STDAPICALLTYPE *LPEECFHOOKPROC)(HWND, UINT, WPARAM, LPARAM);
+
+struct EXCHEXTCHOOSEFOLDER
+{
+ UINT cbLength;
+ HWND hwnd;
+ LPTSTR szCaption;
+ LPTSTR szLabel;
+ LPTSTR szHelpFile;
+ ULONG ulHelpID;
+ HINSTANCE hinst;
+ UINT uiDlgID;
+ LPEECFHOOKPROC lpeecfhp;
+ DWORD dwHookData;
+ ULONG ulFlags;
+ LPMDB pmdb;
+ LPMAPIFOLDER pfld;
+ LPTSTR szName;
+ DWORD dwReserved1;
+ DWORD dwReserved2;
+ DWORD dwReserved3;
+};
+typedef struct EXCHEXTCHOOSEFOLDER EXCHEXTCHOOSEFOLDER;
+typedef struct EXCHEXTCHOOSEFOLDER *LPEXCHEXTCHOOSEFOLDER;
+
+
+
+
+/**** Class definitions. ***/
+
+EXTERN_C const IID IID_IExchExt;
+#undef INTERFACE
+#define INTERFACE IExchExt
+DECLARE_INTERFACE_(IExchExt, IUnknown)
+{
+ /*** IUnknown methods. ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
+ STDMETHOD_(ULONG, AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG, Release)(THIS) PURE;
+
+ /*** IExchExt methods. ***/
+ STDMETHOD(Install)(THIS_ LPEXCHEXTCALLBACK, ULONG, ULONG) PURE;
+};
+
+
+
+EXTERN_C const IID IID_IExchExtMessageEvents;
+#undef INTERFACE
+#define INTERFACE IExchExtMessageEvents
+DECLARE_INTERFACE_(IExchExtMessageEvents, IUnknown)
+{
+ /*** IUnknown methods. ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
+ STDMETHOD_(ULONG, AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG, Release)(THIS) PURE;
+
+ /*** IExchExtMessageEvents methods. ***/
+ STDMETHOD(OnRead)(THIS_ LPEXCHEXTCALLBACK) PURE;
+ STDMETHOD(OnReadComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE;
+ STDMETHOD(OnWrite)(THIS_ LPEXCHEXTCALLBACK) PURE;
+ STDMETHOD(OnWriteComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE;
+ STDMETHOD(OnCheckNames)(THIS_ LPEXCHEXTCALLBACK) PURE;
+ STDMETHOD(OnCheckNamesComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE;
+ STDMETHOD(OnSubmit)(THIS_ LPEXCHEXTCALLBACK) PURE;
+ STDMETHOD_(void, OnSubmitComplete)(THIS_ LPEXCHEXTCALLBACK, ULONG) PURE;
+};
+
+
+
+EXTERN_C const IID IID_IExchExtCommands;
+#undef INTERFACE
+#define INTERFACE IExchExtCommands
+DECLARE_INTERFACE_(IExchExtCommands, IUnknown)
+{
+ /*** IUnknown methods. ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
+ STDMETHOD_(ULONG, AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG, Release)(THIS) PURE;
+
+ /*** IExchExtCommands methods. ***/
+ STDMETHOD(InstallCommands)(THIS_ LPEXCHEXTCALLBACK, HWND, HMENU,
+ UINT*, LPTBENTRY, UINT, ULONG) PURE;
+ STDMETHOD_(void, InitMenu)(THIS_ LPEXCHEXTCALLBACK) PURE;
+ STDMETHOD(DoCommand)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE;
+ STDMETHOD(Help)(THIS_ LPEXCHEXTCALLBACK, UINT) PURE;
+ STDMETHOD(QueryHelpText)(THIS_ UINT, ULONG, LPTSTR, UINT) PURE;
+ STDMETHOD(QueryButtonInfo)(THIS_ ULONG, UINT, LPTBBUTTON,
+ LPTSTR, UINT, ULONG) PURE;
+ STDMETHOD(ResetToolbar)(THIS_ ULONG, ULONG) PURE;
+};
+
+
+
+EXTERN_C const IID IID_IExchExtPropertySheets;
+#undef INTERFACE
+#define INTERFACE IExchExtPropertySheets
+DECLARE_INTERFACE_(IExchExtPropertySheets, IUnknown)
+{
+ /*** IUnknown methods. ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
+ STDMETHOD_(ULONG, AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG, Release)(THIS) PURE;
+
+ /*** IExchExtPropertySheet methods. ***/
+ STDMETHOD_(ULONG, GetMaxPageCount)(THIS_ ULONG) PURE;
+ STDMETHOD(GetPages)(THIS_ LPEXCHEXTCALLBACK, ULONG,
+ LPPROPSHEETPAGE, ULONG*) PURE;
+ STDMETHOD_(void, FreePages)(THIS_ LPPROPSHEETPAGE, ULONG, ULONG) PURE;
+};
+
+
+
+EXTERN_C const IID IID_IExchExtCallback;
+#undef INTERFACE
+#define INTERFACE IExchExtCallback
+DECLARE_INTERFACE_(IExchExtCallback, IUnknown)
+{
+ /*** IUnknown methods. ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
+ STDMETHOD_(ULONG, AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG, Release)(THIS) PURE;
+
+ /*** IExchExtCallback methods. ***/
+ STDMETHOD(GetVersion)(THIS_ ULONG*, ULONG) PURE;
+ STDMETHOD(GetWindow)(THIS_ HWND*) PURE;
+ STDMETHOD(GetMenu)(THIS_ HMENU*) PURE;
+ STDMETHOD(GetToolbar)(THIS_ ULONG, HWND*) PURE;
+ STDMETHOD(GetSession)(THIS_ LPMAPISESSION*, LPADRBOOK*) PURE;
+ STDMETHOD(GetObject)(THIS_ LPMDB*, LPMAPIPROP*) PURE;
+ STDMETHOD(GetSelectionCount)(THIS_ ULONG*) PURE;
+ STDMETHOD(GetSelectionItem)(THIS_ ULONG, ULONG*, LPENTRYID*, ULONG*,
+ LPTSTR, ULONG, ULONG*, ULONG) PURE;
+ STDMETHOD(GetMenuPos)(THIS_ ULONG, HMENU*, ULONG*, ULONG*, ULONG) PURE;
+ STDMETHOD(GetSharedExtsDir)(THIS_ LPTSTR, ULONG, ULONG) PURE;
+ STDMETHOD(GetRecipients)(THIS_ LPADRLIST*) PURE;
+ STDMETHOD(SetRecipients)(THIS_ LPADRLIST) PURE;
+ STDMETHOD(GetNewMessageSite)(THIS_ ULONG, LPMAPIFOLDER, LPPERSISTMESSAGE,
+ LPMESSAGE*, LPMAPIMESSAGESITE*,
+ LPMAPIVIEWCONTEXT*, ULONG) PURE;
+ STDMETHOD(RegisterModeless)(THIS_ LPEXCHEXTMODELESS,
+ LPEXCHEXTMODELESSCALLBACK*) PURE;
+ STDMETHOD(ChooseFolder)(THIS_ LPEXCHEXTCHOOSEFOLDER) PURE;
+};
+
+
+
+EXTERN_C const IID IID_IOutlookExtCallback;
+#undef INTERFACE
+#define INTERFACE IOutlookExtCallback
+DECLARE_INTERFACE_(IOutlookExtCallback, IUnknown)
+{
+ /*** IUnknown methods. ***/
+ STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
+ STDMETHOD_(ULONG, AddRef)(THIS) PURE;
+ STDMETHOD_(ULONG, Release)(THIS) PURE;
+
+ /*** IOutlookExtCallback. **/
+ STDMETHOD(GetObject)(LPUNKNOWN *ppunk);
+ STDMETHOD(GetOfficeCharacter)(void **ppmsotfc);
+};
+
+// Flag values for IExchExtAttachedFileEvents::OpenSzFile
+#define EEAFE_OPEN (0x00000001)
+#define EEAFE_PRINT (0x00000002)
+#define EEAFE_QUICKVIEW (0x00000003)
+
+#undef INTERFACE
+#define INTERFACE IExchExtAttachedFileEvents
+
+DECLARE_INTERFACE_(IExchExtAttachedFileEvents, IUnknown)
+{
+ // *** IUnknown methods ***
+ STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * lppvObj) PURE;
+ STDMETHOD_(ULONG,AddRef) (THIS) PURE;
+ STDMETHOD_(ULONG,Release) (THIS) PURE;
+
+ // *** IExchExtAttachedFileEvents methods ***
+ STDMETHOD(OnReadPattFromSzFile)(THIS_ LPATTACH lpatt, LPTSTR lpszFile,
+ ULONG ulFlags) PURE;
+ STDMETHOD(OnWritePattToSzFile)(THIS_ LPATTACH lpatt, LPTSTR lpszFile,
+ ULONG ulFlags) PURE;
+ STDMETHOD(QueryDisallowOpenPatt)(THIS_ LPATTACH lpatt) PURE;
+ STDMETHOD(OnOpenPatt)(THIS_ LPATTACH lpatt) PURE;
+ STDMETHOD(OnOpenSzFile)(THIS_ LPTSTR lpszFile, ULONG ulFlags) PURE;
+};
+typedef IExchExtAttachedFileEvents FAR * LPEXCHEXTATTACHEDFILEEVENTS;
+
+EXTERN_C const IID IID_IExchExtAttachedFileEvents;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*EXCHEXT.h*/
Modified: trunk/src/olflange-def.h
===================================================================
--- trunk/src/olflange-def.h 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/olflange-def.h 2005-09-20 11:35:31 UTC (rev 102)
@@ -25,7 +25,7 @@
class CGPGExchExtMessageEvents;
class CGPGExchExtCommands;
class CGPGExchExtPropertySheets;
-class CGPGExchApp;
+class CGPGExchExtAttachedFileEvents;
bool GPGOptionsDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
Modified: trunk/src/olflange.cpp
===================================================================
--- trunk/src/olflange.cpp 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/olflange.cpp 2005-09-20 11:35:31 UTC (rev 102)
@@ -43,6 +43,7 @@
#include "olflange-ids.h"
#include "olflange-def.h"
#include "olflange.h"
+#include "attach.h"
#define CLSIDSTR_GPGOL "{42d30988-1a3a-11da-c687-000d6080e735}"
DEFINE_GUID(CLSID_GPGOL, 0x42d30988, 0x1a3a, 0x11da,
@@ -462,8 +463,9 @@
m_pExchExtMessageEvents = new CGPGExchExtMessageEvents (this);
m_pExchExtCommands = new CGPGExchExtCommands (this);
m_pExchExtPropertySheets = new CGPGExchExtPropertySheets (this);
+ m_pExchExtAttachedFileEvents = new CGPGExchExtAttachedFileEvents (this);
if (!m_pExchExtMessageEvents || !m_pExchExtCommands
- || !m_pExchExtPropertySheets)
+ || !m_pExchExtPropertySheets || !m_pExchExtAttachedFileEvents)
out_of_core ();
if (!g_initdll)
@@ -506,35 +508,43 @@
STDMETHODIMP
CGPGExchExt::QueryInterface(REFIID riid, LPVOID *ppvObj)
{
- HRESULT hr = S_OK;
-
- *ppvObj = NULL;
-
- if ((riid == IID_IUnknown) || (riid == IID_IExchExt)) {
- *ppvObj = (LPUNKNOWN) this;
+ HRESULT hr = S_OK;
+
+ *ppvObj = NULL;
+
+ if ((riid == IID_IUnknown) || (riid == IID_IExchExt))
+ {
+ *ppvObj = (LPUNKNOWN) this;
}
- else if (riid == IID_IExchExtMessageEvents) {
- *ppvObj = (LPUNKNOWN) m_pExchExtMessageEvents;
- m_pExchExtMessageEvents->SetContext (m_lContext);
+ else if (riid == IID_IExchExtMessageEvents)
+ {
+ *ppvObj = (LPUNKNOWN) m_pExchExtMessageEvents;
+ m_pExchExtMessageEvents->SetContext (m_lContext);
}
- else if (riid == IID_IExchExtCommands) {
- *ppvObj = (LPUNKNOWN)m_pExchExtCommands;
- m_pExchExtCommands->SetContext (m_lContext);
+ else if (riid == IID_IExchExtCommands)
+ {
+ *ppvObj = (LPUNKNOWN)m_pExchExtCommands;
+ m_pExchExtCommands->SetContext (m_lContext);
}
- else if (riid == IID_IExchExtPropertySheets) {
- if (m_lContext != EECONTEXT_PROPERTYSHEETS)
- return E_NOINTERFACE;
- *ppvObj = (LPUNKNOWN) m_pExchExtPropertySheets;
+ else if (riid == IID_IExchExtPropertySheets)
+ {
+ if (m_lContext != EECONTEXT_PROPERTYSHEETS)
+ return E_NOINTERFACE;
+ *ppvObj = (LPUNKNOWN) m_pExchExtPropertySheets;
}
- else
- hr = E_NOINTERFACE;
-
- /* On success we need to bump up the reference counter for the
- requested object. */
- if (*ppvObj)
- ((LPUNKNOWN)*ppvObj)->AddRef();
-
- /*log_debug("QueryInterface %d\n", __LINE__);*/
+ else if (riid == IID_IExchExtAttachedFileEvents)
+ {
+ *ppvObj = (LPUNKNOWN)m_pExchExtAttachedFileEvents;
+ }
+ else
+ hr = E_NOINTERFACE;
+
+ /* On success we need to bump up the reference counter for the
+ requested object. */
+ if (*ppvObj)
+ ((LPUNKNOWN)*ppvObj)->AddRef();
+
+ /*log_debug("QueryInterface %d\n", __LINE__);*/
return hr;
}
Modified: trunk/src/olflange.h
===================================================================
--- trunk/src/olflange.h 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/olflange.h 2005-09-20 11:35:31 UTC (rev 102)
@@ -33,35 +33,36 @@
class CGPGExchExt : public IExchExt
{
public:
- CGPGExchExt();
- virtual ~CGPGExchExt();
+ CGPGExchExt();
+ virtual ~CGPGExchExt();
public:
- HWND m_hWndExchange; /* Handle of the exchange window. */
- /* parameter for sending mails */
- BOOL m_gpgEncrypt;
- BOOL m_gpgSign;
-
+ HWND m_hWndExchange; /* Handle of the exchange window. */
+ /* parameter for sending mails */
+ BOOL m_gpgEncrypt;
+ BOOL m_gpgSign;
+
private:
- ULONG m_lRef;
- ULONG m_lContext;
+ ULONG m_lRef;
+ ULONG m_lContext;
+
+ /* pointer to the other extension objects */
+ CGPGExchExtMessageEvents* m_pExchExtMessageEvents;
+ CGPGExchExtCommands* m_pExchExtCommands;
+ CGPGExchExtPropertySheets* m_pExchExtPropertySheets;
+ CGPGExchExtAttachedFileEvents *m_pExchExtAttachedFileEvents;
- /* pointer to the other extension objects */
- CGPGExchExtMessageEvents* m_pExchExtMessageEvents;
- CGPGExchExtCommands* m_pExchExtCommands;
- CGPGExchExtPropertySheets* m_pExchExtPropertySheets;
-
public:
- STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj);
- inline STDMETHODIMP_(ULONG) AddRef() { ++m_lRef; return m_lRef; };
- inline STDMETHODIMP_(ULONG) Release()
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj);
+ inline STDMETHODIMP_(ULONG) AddRef() { ++m_lRef; return m_lRef; };
+ inline STDMETHODIMP_(ULONG) Release()
{
- ULONG lCount = --m_lRef;
- if (!lCount)
- delete this;
- return lCount;
+ ULONG lCount = --m_lRef;
+ if (!lCount)
+ delete this;
+ return lCount;
};
- STDMETHODIMP Install(LPEXCHEXTCALLBACK pEECB, ULONG lContext, ULONG lFlags);
+ STDMETHODIMP Install(LPEXCHEXTCALLBACK pEECB, ULONG lContext, ULONG lFlags);
};
/*
Modified: trunk/src/passphrase-dialog.c
===================================================================
--- trunk/src/passphrase-dialog.c 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/passphrase-dialog.c 2005-09-20 11:35:31 UTC (rev 102)
@@ -114,14 +114,13 @@
r = rset;
for (;;)
{
- const char *uid;
err = gpgme_op_keylist_next (keyctx, &key);
if (err)
break;
- uid = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, 0);
- if (uid != NULL)
+
+ if (key && key->uids != NULL)
SendDlgItemMessage (dlg, ctlid, LB_ADDSTRING, 0,
- (LPARAM)(const char *)uid);
+ (LPARAM)(const char *)key->uids->uid);
gpgme_key_release (key);
key = NULL;
r = r->next;
@@ -134,58 +133,80 @@
}
+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:
+ return "ELG";
+
+ default:
+ break;
+ }
+
+ return "???";
+}
+
+
static void
load_secbox (HWND dlg, int ctlid)
{
- gpgme_key_t sk;
- size_t n=0, doloop=1;
- void *ctx=NULL;
+ gpgme_key_t sk;
+ size_t n=0, doloop=1;
+ void *ctx=NULL;
+
+ enum_gpg_seckeys (NULL, &ctx);
+ while (doloop)
+ {
+ const char *name, *email, *keyid, *algo;
+ char *p;
+
+ if (enum_gpg_seckeys (&sk, &ctx))
+ doloop = 0;
+
+ if (sk->revoked || sk->expired || sk->disabled || sk->invalid)
+ continue;
+ if (!sk->uids)
+ continue;
- enum_gpg_seckeys (NULL, &ctx);
- while (doloop) {
- const char *name, *email, *keyid, *algo;
- char *p;
-
- if (enum_gpg_seckeys (&sk, &ctx))
- doloop = 0;
-
- if (gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_REVOKED, NULL, 0) ||
- gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_EXPIRED, NULL, 0) ||
- gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_INVALID, NULL, 0))
- continue;
-
- name = gpgme_key_get_string_attr (sk, GPGME_ATTR_NAME, NULL, 0);
- email = gpgme_key_get_string_attr (sk, GPGME_ATTR_EMAIL, NULL, 0);
- keyid = gpgme_key_get_string_attr (sk, GPGME_ATTR_KEYID, NULL, 0);
- algo = gpgme_key_get_string_attr (sk, GPGME_ATTR_ALGO, NULL, 0);
- if (!email)
- email = "";
- p = (char *)xcalloc (1, strlen (name) + strlen (email) + 17 + 32);
- if (email && strlen (email))
- sprintf (p, "%s <%s> (0x%s, %s)", name, email, keyid+8, algo);
- else
- sprintf (p, "%s (0x%s, %s)", name, keyid+8, algo);
- SendDlgItemMessage (dlg, ctlid, CB_ADDSTRING, 0,
- (LPARAM)(const char *) p);
- xfree (p);
+ name = sk->uids->name;
+ email = sk->uids->email;
+ keyid = sk->subkeys->keyid;
+ algo = get_pubkey_algo_str (sk->subkeys->pubkey_algo);
+ if (!email)
+ email = "";
+ p = (char *)xcalloc (1, strlen (name) + strlen (email) + 17 + 32);
+ if (email && strlen (email))
+ sprintf (p, "%s <%s> (0x%s, %s)", name, email, keyid+8, algo);
+ else
+ sprintf (p, "%s (0x%s, %s)", name, keyid+8, algo);
+ SendDlgItemMessage (dlg, ctlid, CB_ADDSTRING, 0,
+ (LPARAM)(const char *) p);
+ xfree (p);
}
-
- ctx = NULL;
- reset_gpg_seckeys (&ctx);
- doloop = 1;
- n = 0;
- while (doloop) {
- if (enum_gpg_seckeys (&sk, &ctx))
- doloop = 0;
- if (gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_REVOKED, NULL, 0) ||
- gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_EXPIRED, NULL, 0) ||
- gpgme_key_get_ulong_attr (sk, GPGME_ATTR_KEY_INVALID, NULL, 0))
- continue;
- SendDlgItemMessage (dlg, ctlid, CB_SETITEMDATA, n, (LPARAM)(DWORD)sk);
- n++;
+
+ ctx = NULL;
+ reset_gpg_seckeys (&ctx);
+ doloop = 1;
+ n = 0;
+ while (doloop)
+ {
+ if (enum_gpg_seckeys (&sk, &ctx))
+ doloop = 0;
+ if (sk->revoked || sk->expired || sk->invalid || sk->disabled)
+ continue;
+ SendDlgItemMessage (dlg, ctlid, CB_SETITEMDATA, n, (LPARAM)(DWORD)sk);
+ n++;
}
- SendDlgItemMessage (dlg, ctlid, CB_SETCURSEL, 0, 0);
- reset_gpg_seckeys (&ctx);
+ SendDlgItemMessage (dlg, ctlid, CB_SETCURSEL, 0, 0);
+ reset_gpg_seckeys (&ctx);
}
Modified: trunk/src/recipient-dialog.c
===================================================================
--- trunk/src/recipient-dialog.c 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/recipient-dialog.c 2005-09-20 11:35:31 UTC (rev 102)
@@ -27,6 +27,7 @@
#include "gpgol-ids.h"
#include "keycache.h"
#include "intern.h"
+#include "util.h"
struct recipient_cb_s {
char **unknown_keys;
@@ -84,65 +85,69 @@
static void
load_rsetbox (HWND hwnd)
{
-
- LVITEM lvi;
- DWORD val;
- char keybuf[128];
- const char * s;
- const char * trust_items[] = {
- "UNKNOWN",
+ LVITEM lvi;
+ gpgme_key_t key = NULL;
+ void *ctx = NULL;
+ char keybuf[128], *s;
+ const char * trust_items[] =
+ {
+ "UNKNOWN",
"UNDEFINED",
"NEVER",
"MARGINAL",
"FULL",
- "ULTIMATE"
+ "ULTIMATE"
};
- void *ctx=NULL;
- size_t doloop=1;
- gpgme_key_t key=NULL;
+ enum {COL_NAME, COL_EMAIL, COL_KEYINF, COL_KEYID, COL_TRUST};
+ DWORD val;
+ size_t doloop=1;
- memset (&lvi, 0, sizeof (lvi));
- cleanup_keycache_objects (); /*XXX: rewrite the entire key cache! */
- enum_gpg_keys (NULL, &ctx);
- while (doloop) {
- if (enum_gpg_keys(&key, &ctx))
- doloop = 0;
- if (!gpgme_key_get_ulong_attr (key, GPGME_ATTR_CAN_ENCRYPT, NULL, 0))
- continue;
- /* check that the primary key is *not* revoked, expired or invalid */
- if (gpgme_key_get_ulong_attr (key, GPGME_ATTR_KEY_REVOKED, NULL, 0)
- || gpgme_key_get_ulong_attr (key, GPGME_ATTR_KEY_EXPIRED, NULL, 0)
- || gpgme_key_get_ulong_attr (key, GPGME_ATTR_KEY_INVALID, NULL, 0))
- continue;
- ListView_InsertItem (hwnd, &lvi);
+ memset (&lvi, 0, sizeof (lvi));
+ cleanup_keycache_objects (); /*XXX: rewrite the entire key cache! */
+ enum_gpg_keys (NULL, &ctx);
+ while (doloop)
+ {
+ if (enum_gpg_keys(&key, &ctx))
+ doloop = 0;
+ if (!key->subkeys->can_encrypt)
+ continue;
+
+ /* check that the primary key is *not* revoked, expired or invalid */
+ if (key->revoked || key->expired || key->invalid || key->disabled)
+ continue;
+ if (!key->uids)
+ continue;
+ ListView_InsertItem (hwnd, &lvi);
+
+ s = key->uids->name;
+ ListView_SetItemText (hwnd, 0, COL_NAME, s);
+
+ s = key->uids->email;
+ ListView_SetItemText (hwnd, 0, COL_EMAIL, s);
+
+ s = (char*)get_pubkey_algo_str (key->subkeys->pubkey_algo);
+ sprintf (keybuf, "%s", s);
+ if (key->subkeys->next)
+ {
+ s = (char*)get_pubkey_algo_str (key->subkeys->next->pubkey_algo);
+ sprintf (keybuf+strlen (keybuf), "/%s", s);
+ }
+ strcat (keybuf, " ");
+ if (key->subkeys->next)
+ sprintf (keybuf+strlen (keybuf), "%d", key->subkeys->next->length);
+ else
+ sprintf (keybuf+strlen (keybuf), "%d", key->subkeys->length);
- s = gpgme_key_get_string_attr( key, GPGME_ATTR_NAME, NULL, 0 );
- ListView_SetItemText( hwnd, 0, 0, (char *)s );
-
- s = gpgme_key_get_string_attr( key, GPGME_ATTR_EMAIL, NULL, 0 );
- ListView_SetItemText( hwnd, 0, 1, (char *)s );
-
- s = gpgme_key_get_string_attr( key, GPGME_ATTR_ALGO, NULL, 0 );
- sprintf( keybuf, "%s", s );
- if( (s = gpgme_key_get_string_attr( key, GPGME_ATTR_ALGO, NULL, 1 )) )
- sprintf( keybuf+strlen( keybuf ), "/%s", s );
- strcat( keybuf, " " );
- if( (val = gpgme_key_get_ulong_attr( key, GPGME_ATTR_LEN, NULL, 1 )) )
- sprintf( keybuf+strlen( keybuf ), "%ld", val );
- else {
- val = gpgme_key_get_ulong_attr( key, GPGME_ATTR_LEN, NULL, 0 );
- sprintf( keybuf+strlen( keybuf ), "%ld", val );
- }
- s = keybuf;
- ListView_SetItemText( hwnd, 0, 2, (char *) s );
-
- s = gpgme_key_get_string_attr( key, GPGME_ATTR_KEYID, NULL, 0 ) + 8;
- ListView_SetItemText( hwnd, 0, 3, (char *)s );
-
- val = gpgme_key_get_ulong_attr (key, GPGME_ATTR_VALIDITY, NULL, 0);
- if (val < 0 || val > 5) val = 0;
- s = (char *)trust_items[val];
- ListView_SetItemText (hwnd, 0, 4, (char *)s);
+ s = keybuf;
+ ListView_SetItemText (hwnd, 0, COL_KEYINF, s);
+
+ ListView_SetItemText( hwnd, 0, COL_KEYID, key->subkeys->keyid+8);
+
+ val = key->uids->validity;
+ if (val < 0 || val > 5)
+ val = 0;
+ s = (char *)trust_items[val];
+ ListView_SetItemText (hwnd, 0, COL_TRUST, s);
}
}
@@ -365,39 +370,43 @@
recipient_dialog_box2 (gpgme_key_t *fnd, char **unknown, size_t n,
gpgme_key_t **ret_rset, int *ret_opts)
{
- struct recipient_cb_s *cb;
- int i;
-
- cb = xcalloc (1, sizeof (struct recipient_cb_s));
- cb->n = n;
- cb->fnd_keys = xcalloc (n+1, sizeof (char*));
- for (i = 0; i < (int)n; i++) {
- const char *name;
- if (fnd[i] == NULL) {
- cb->fnd_keys[i] = xstrdup ("User-ID not found");
- continue;
- }
- name = gpgme_key_get_string_attr (fnd[i], GPGME_ATTR_NAME, NULL, 0);
- if (!name)
- name = "User-ID not found";
- cb->fnd_keys[i] = xstrdup (name);
+ struct recipient_cb_s *cb;
+ int i;
+
+ cb = xcalloc (1, sizeof (struct recipient_cb_s));
+ cb->n = n;
+ cb->fnd_keys = xcalloc (n+1, sizeof (char*));
+ for (i = 0; i < (int)n; i++)
+ {
+ const char *name;
+ if (fnd[i] == NULL) {
+ cb->fnd_keys[i] = xstrdup (_("User-ID not found"));
+ continue;
+ }
+ name = fnd[i]->uids->uid;
+ if (!name)
+ name = _("User-ID not found");
+ cb->fnd_keys[i] = xstrdup (name);
}
- cb->unknown_keys = unknown;
- DialogBoxParam (glob_hinst, (LPCTSTR)IDD_ENC, GetDesktopWindow (),
- recipient_dlg_proc, (LPARAM)cb);
- if (cb->opts & OPT_FLAG_CANCEL) {
- *ret_opts = cb->opts;
- *ret_rset = NULL;
+ cb->unknown_keys = unknown;
+ DialogBoxParam (glob_hinst, (LPCTSTR)IDD_ENC, GetDesktopWindow (),
+ recipient_dlg_proc, (LPARAM)cb);
+ if (cb->opts & OPT_FLAG_CANCEL)
+ {
+ *ret_opts = cb->opts;
+ *ret_rset = NULL;
}
- else {
- *ret_rset = keycache_to_key_array (cb->rset);
- keycache_free (cb->rset);
+ else
+ {
+ *ret_rset = keycache_to_key_array (cb->rset);
+ keycache_free (cb->rset);
}
- for (i = 0; i < (int)n; i++) {
- xfree (cb->fnd_keys[i]);
- cb->fnd_keys[i] = NULL;
+ for (i = 0; i < (int)n; i++)
+ {
+ xfree (cb->fnd_keys[i]);
+ cb->fnd_keys[i] = NULL;
}
- xfree (cb->fnd_keys);
- xfree (cb);
- return 0;
+ xfree (cb->fnd_keys);
+ xfree (cb);
+ return 0;
}
Modified: trunk/src/rfc822parse.c
===================================================================
--- trunk/src/rfc822parse.c 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/rfc822parse.c 2005-09-20 11:35:31 UTC (rev 102)
@@ -155,7 +155,6 @@
*name = *name - 'A' + 'a';
}
-
static char *
stpcpy (char *a,const char *b)
{
@@ -166,7 +165,6 @@
return (char*)a;
}
-
/* If a callback has been registerd, call it for the event of type
EVENT. */
static int
Modified: trunk/src/verify-dialog.c
===================================================================
--- trunk/src/verify-dialog.c 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/verify-dialog.c 2005-09-20 11:35:31 UTC (rev 102)
@@ -28,6 +28,7 @@
#include "gpgol-ids.h"
#include "keycache.h"
#include "intern.h"
+#include "util.h"
struct dialog_context
{
@@ -76,95 +77,96 @@
static void
load_sigbox (HWND dlg, gpgme_verify_result_t ctx)
{
- gpgme_key_t key;
- char *s, buf[2+16+1];
- char *p;
- 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);
- /*key = find_gpg_key (buf+2, 0);*/
- key = get_gpg_key (buf+2);
-
- stat = ctx->signatures->summary;
- if (stat & GPGME_SIGSUM_GREEN)
- s = "Good signature";
- else if (stat & GPGME_SIGSUM_RED)
- s = "BAD signature!";
- else if (stat & GPGME_SIGSUM_KEY_REVOKED)
- s = "Good signature from revoked key";
- else if (stat & GPGME_SIGSUM_KEY_EXPIRED)
- s = "Good signature from expired key";
- else if (stat & GPGME_SIGSUM_SIG_EXPIRED)
- s = "Good expired signature";
- else if (stat & GPGME_SIGSUM_KEY_MISSING) {
- s = "Could not check signature: missing key";
- no_key = 1;
+ gpgme_key_t key;
+ char *s, buf[2+16+1];
+ char *p;
+ 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);
+ key = get_gpg_key (buf+2);
+
+ stat = ctx->signatures->summary;
+ if (stat & GPGME_SIGSUM_GREEN)
+ s = _("Good signature");
+ else if (stat & GPGME_SIGSUM_RED)
+ s = _("BAD signature!");
+ else if (stat & GPGME_SIGSUM_KEY_REVOKED)
+ s = _("Good signature from revoked key");
+ else if (stat & GPGME_SIGSUM_KEY_EXPIRED)
+ s = _("Good signature from expired key");
+ else if (stat & GPGME_SIGSUM_SIG_EXPIRED)
+ s = _("Good expired signature");
+ else if (stat & GPGME_SIGSUM_KEY_MISSING)
+ {
+ s = _("Could not check signature: missing key");
+ 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) {
- s = (char*)gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, 0);
- SetDlgItemText (dlg, IDC_VRY_ISSUER, s);
-
- n = load_akalist (dlg, key);
- gpgme_key_release (key);
- if (n == 0)
- EnableWindow (GetDlgItem (dlg, IDC_VRY_AKALIST), FALSE);
+ 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)
+ {
+ s = key->uids->uid;
+ SetDlgItemText (dlg, IDC_VRY_ISSUER, s);
+
+ 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);
+ else
+ {
+ s = _("User-ID not found");
+ SetDlgItemText (dlg, IDC_VRY_ISSUER, s);
}
-
- switch (ctx->signatures->pubkey_algo) {
- case GPGME_PK_RSA: s = "RSA"; break;
- case GPGME_PK_DSA: s = "DSA"; break;
- default: s = "???"; break;
+
+ s = (char *)get_pubkey_algo_str (ctx->signatures->pubkey_algo);
+ SetDlgItemText (dlg, IDC_VRY_PKALGO, s);
+
+ valid = ctx->signatures->validity;
+ if (stat & GPGME_SIGSUM_SIG_EXPIRED)
+ {
+ 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);
}
- SetDlgItemText (dlg, IDC_VRY_PKALGO, s);
-
- valid = ctx->signatures->validity;
- if (stat & GPGME_SIGSUM_SIG_EXPIRED) {
- 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) {
+ else if (valid < GPGME_VALIDITY_MARGINAL)
+ {
+ switch (valid)
+ {
case GPGME_VALIDITY_NEVER:
- s = "Signature issued by a key we do NOT trust.";
- break;
-
+ s = "Signature issued by a key we do NOT trust.";
+ break;
+
default:
- if (no_key)
- s = "";
- else
- s = "Signature issued by a non-valid key.";
- break;
+ if (no_key)
+ s = "";
+ else
+ s = "Signature issued by a non-valid key.";
+ break;
}
- SetDlgItemText (dlg, IDC_VRY_HINT, s);
+ SetDlgItemText (dlg, IDC_VRY_HINT, s);
}
}
Modified: trunk/src/watcher.cpp
===================================================================
--- trunk/src/watcher.cpp 2005-09-19 17:21:55 UTC (rev 101)
+++ trunk/src/watcher.cpp 2005-09-20 11:35:31 UTC (rev 102)
@@ -20,7 +20,6 @@
*/
#include <config.h>
-
#include <windows.h>
#include <stdio.h>
#include <gpgme.h>
@@ -81,6 +80,7 @@
}
+/* Decrypt a single message. */
static void
decrypt_message (HWND hwnd, LPMESSAGE msg)
{
@@ -92,9 +92,19 @@
msg = NULL;
}
-
-/* XXX: describe what we are doing here! */
-
+/* This hook procedure allows to monitor all windows which are created
+ * and/or activated.
+ * We use it to find the new opened message window and start automatically
+ * the decryption code. The pre-condition is, that the new window has the
+ * proper window class and a child window with valid OpenPGP data.
+ *
+ * We cannot use the HCBT_CREATEWND alone because at the point the hook
+ * procedure is called, the window is only about to be created but the
+ * procedure has not finished yet. Plus the child windows are not yet
+ * created. Thus we check if the new window has the proper class. If
+ * this window is then activated, we call the decryption code and reset
+ * the window handle so the decryption is only called once.
+ */
static LRESULT CALLBACK
cbt_proc (int code, WPARAM w, LPARAM l)
{
More information about the Gnupg-commits
mailing list