1 |
/* GPGOE.h - GnuPG for Outlook Express |
2 |
* Copyright (C) 2001, 2002, 2003, 2006 Timo Schulz |
3 |
* |
4 |
* This file is part of GPGOE. |
5 |
* |
6 |
* GPGOE is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU Lesser General Public License as published by |
8 |
* the Free Software Foundation; either version 2.1 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* GPGOE is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU Lesser General Public License |
17 |
* along with GPGOE; if not, write to the Free Software Foundation, |
18 |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
19 |
*/ |
20 |
|
21 |
#ifndef GPGOE_H |
22 |
#define GPGOE_H |
23 |
|
24 |
/* dummy until gettext support is finished. */ |
25 |
#define _(X) (X) |
26 |
|
27 |
#include <malloc.h> |
28 |
/* wrapper around free. */ |
29 |
#define free_if_alloc(ptr) \ |
30 |
do { \ |
31 |
if (ptr) free (ptr); \ |
32 |
ptr = NULL; \ |
33 |
} while (0) |
34 |
|
35 |
|
36 |
/* Wrapper for memory deallocation but overwrite the buffer before. |
37 |
Useful for sentensive information like PINs or passwords. */ |
38 |
#define wipememory2(_ptr,_set,_len) do { \ |
39 |
volatile char *_vptr = (volatile char *)(_ptr); \ |
40 |
size_t _vlen = (_len); \ |
41 |
while (_vlen) { *_vptr = (_set); _vptr++; _vlen--; } \ |
42 |
} while(0) |
43 |
|
44 |
#define wipememory(_ptr,_len) wipememory2 (_ptr,0,_len) |
45 |
|
46 |
/* OE5 V5.x/V6 command id's. */ |
47 |
#define ID_OE5_SELECTALL 40125 |
48 |
#define ID_OE5_COPY 40484 |
49 |
#define ID_OE5_PASTE 40231 |
50 |
#define ID_OE5_ENCRYPT 40260 |
51 |
#define ID_OE5_SIGN 40299 |
52 |
#define ID_OE5_SEND 40411 |
53 |
#define ID_OE5_PREVMSG 40145 |
54 |
#define ID_OE5_NEXTMSG 40146 |
55 |
|
56 |
/* Common dialogs (GetOpenFileName) */ |
57 |
#define OF_IDOK 1 |
58 |
#define OF_IDFILE 1152 |
59 |
|
60 |
|
61 |
/* Context for the recipient list. */ |
62 |
struct recip_list_s { |
63 |
struct recip_list_s *next; |
64 |
gpgme_key_t key; |
65 |
char *addr; |
66 |
}; |
67 |
typedef struct recip_list_s *recip_list_t; |
68 |
|
69 |
/* Actual plugin context. */ |
70 |
struct plugin_ctx_s { |
71 |
HWND msg_wnd, main_wnd, addr_wnd; |
72 |
HWND to_wnd, cc_wnd, bcc_wnd; |
73 |
char *to; |
74 |
char *cc; |
75 |
char *bcc; |
76 |
int sign; |
77 |
int encrypt; |
78 |
recip_list_t rset; |
79 |
char errbuf[256]; |
80 |
char *orig_text; |
81 |
}; |
82 |
typedef struct plugin_ctx_s *plugin_ctx_t; |
83 |
|
84 |
/* Viewer context. */ |
85 |
struct viewer_ctx_s { |
86 |
const char *msg; |
87 |
}; |
88 |
typedef struct viewer_ctx_s *viewer_ctx_t; |
89 |
|
90 |
|
91 |
/*-- GPGOE.c --*/ |
92 |
/*EXPORT*/ int gpgoe_initialize (void); |
93 |
/*EXPORT*/ int gpgoe_remove (void); |
94 |
|
95 |
/*-- OEProc.c --*/ |
96 |
extern HINSTANCE mod_hinst_dll; |
97 |
extern WNDPROC oe_proc_old; |
98 |
LRESULT CALLBACK oe_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); |
99 |
|
100 |
/*-- OECrypto.c --*/ |
101 |
gpgme_error_t oe_handle_mail (plugin_ctx_t ctx); |
102 |
|
103 |
/*-- OEMisc.c --*/ |
104 |
char* utf8_to_native (const char *string); |
105 |
char* get_clip_text (HWND hwnd); |
106 |
int set_clip_text (HWND hwnd, const char *text, int nbytes); |
107 |
void show_error (HWND hwnd, const char *caption, |
108 |
UINT type, const char *fmt, ...); |
109 |
void* xcalloc (size_t n, size_t m); |
110 |
char* xstrdup (const char *s); |
111 |
|
112 |
/*-- dialogs --*/ |
113 |
BOOL CALLBACK encrypt_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, |
114 |
LPARAM lparam); |
115 |
BOOL CALLBACK viewer_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, |
116 |
LPARAM lparam); |
117 |
BOOL CALLBACK verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, |
118 |
LPARAM lparam); |
119 |
|
120 |
/* Opaque passphrase callback handle. */ |
121 |
struct pass_cb_s; |
122 |
typedef struct pass_cb_s *pass_cb_t; |
123 |
|
124 |
gpgme_error_t passphrase_cb (void *hook, |
125 |
const char *uid_hint, |
126 |
const char *passphrase_info, |
127 |
int prev_was_bad, int fd); |
128 |
void free_pass_cb (pass_cb_t cb); |
129 |
pass_cb_t new_pass_cb (HWND main); |
130 |
|
131 |
#endif /* GPGOE_H */ |