--- trunk/src/GPGOE.h 2006/04/07 10:46:41 12 +++ trunk/src/GPGOE.h 2007/08/18 10:55:14 23 @@ -1,5 +1,5 @@ /* GPGOE.h - GnuPG for Outlook Express - * Copyright (C) 2001, 2002, 2003, 2006 Timo Schulz + * Copyright (C) 2001, 2002, 2003, 2006, 2007 Timo Schulz * * This file is part of GPGOE. * @@ -12,22 +12,27 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with GPGOE; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifndef GPGOE_H #define GPGOE_H +/* Macros to support a separate section for variables. */ +#ifdef __GNUC__ +#define ATTR_SEC __attribute__((section (".SHARDAT"), shared)) +#else +#define ATTR_SEC +#endif + +/* How many items we can store in the dictionary */ +#define HASH_BUCKETS 3 + /* gettext support. */ const char *gettext (const char *msgid); #define _(X) gettext ((X)) - #include -/* wrapper around free. */ +/* safe wrapper around free. */ #define free_if_alloc(ptr) \ do { \ if (ptr) free (ptr); \ @@ -45,7 +50,11 @@ #define wipememory(_ptr,_len) wipememory2 (_ptr,0,_len) -/* Dialog IDs for clipboard operations. */ +#ifndef DIM +#define DIM(v) (sizeof (v) / sizeof ((v)[0])) +#endif + +/* Dialog IDs for the various operations. */ #define ID_OE_SELECTALL 40125 #define ID_OE_COPY 40484 #define ID_OE_PASTE 40231 @@ -58,11 +67,18 @@ #define ID_OF_SAVE_FILE 1148 +/* Supported plug-in modes. */ +enum gpgoe_mode_t { + GPGOE_MODE_NORMAL = 0, + GPGOE_MODE_PLAINREPLY = 1, /* decrypt mails before a reply. */ + GPGOE_MODE_CACHEPASS = 2, /* cache passphrase. */ +}; + /* Context for the recipient list. */ struct recip_list_s { struct recip_list_s *next; - gpgme_key_t key; - char *addr; + gpgme_key_t key; /* The actual key to use */ + char *addr; /* The email address. */ }; typedef struct recip_list_s *recip_list_t; @@ -85,27 +101,51 @@ /* Viewer context. */ struct viewer_ctx_s { + HWND main_wnd; const char *msg; }; typedef struct viewer_ctx_s *viewer_ctx_t; +/* Signature verify context. */ +struct verify_ctx_s { + gpgme_signature_t sig; + gpgme_data_t text; +}; +typedef struct verify_ctx_s *verify_ctx_t; /*-- GPGOE.c --*/ -/*EXPORT*/ int gpgoe_initialize (void); -/*EXPORT*/ int gpgoe_remove (void); +int gpgoe_initialize (void); +int gpgoe_remove (void); +void gpgoe_set_active_modes (int mode); +int gpgoe_get_active_modes (void); /*-- OEProc.c --*/ +extern plugin_ctx_t oe_plug; extern HINSTANCE mod_hinst_dll; +extern HANDLE plugin_active; + +/* support for the mailer window. */ extern WNDPROC oe_proc_old; +LRESULT CALLBACK oe_proc (HWND hwnd, UINT msg, + WPARAM wparam, LPARAM lparam); + +/* support for the common dialogs. */ extern WNDPROC of_proc_old; -extern HANDLE plugin_active; -LRESULT CALLBACK oe_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); -LRESULT CALLBACK of_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); +LRESULT CALLBACK of_proc (HWND hwnd, UINT msg, + WPARAM wparam, LPARAM lparam); + +/* support for the main window. */ +extern WNDPROC oe_main_proc_old; +LRESULT CALLBACK oe_main_proc (HWND hwnd, UINT msg, + WPARAM wparam, LPARAM lparam); + /*-- OECrypto.c --*/ gpgme_error_t oe_handle_mail (plugin_ctx_t ctx); +gpgme_error_t oe_decrypt_msg (HWND main_wnd, char **r_msg); /*-- OEMisc.c --*/ +void center_window (HWND hwndChild, HWND parent); char* utf8_to_native (const char *string); char* native_to_utf8 (const char *string); char* get_clip_text (HWND hwnd); @@ -115,6 +155,7 @@ void* xcalloc (size_t n, size_t m); char* xstrdup (const char *s); void xfree (void *p); +void quote_msg_text (const char *inp, char **r_outp); /*-- dialogs --*/ BOOL CALLBACK encrypt_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, @@ -134,6 +175,8 @@ int prev_was_bad, int fd); void free_pass_cb (pass_cb_t cb); pass_cb_t new_pass_cb (HWND main); +int pass_cb_cancelled (pass_cb_t cb); +void reset_pass_cache (void); /*-- OENLS.c --*/ int setup_gettext (void);