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 |
#ifdef __cplusplus |
25 |
extern "C" { |
26 |
#endif |
27 |
|
28 |
/* dummy until gettext support is finished. */ |
29 |
#define _(X) (X) |
30 |
|
31 |
#include <malloc.h> |
32 |
/* wrapper around free. */ |
33 |
#define free_if_alloc(ptr) \ |
34 |
do { \ |
35 |
if (ptr) free (ptr); \ |
36 |
ptr = NULL; \ |
37 |
} while (0) |
38 |
|
39 |
|
40 |
/* Wrapper for memory deallocation but overwrite the buffer before. |
41 |
Useful for sentensive information like PINs or passwords. */ |
42 |
#define wipememory2(_ptr,_set,_len) do { \ |
43 |
volatile char *_vptr = (volatile char *)(_ptr); \ |
44 |
size_t _vlen = (_len); \ |
45 |
while (_vlen) { *_vptr = (_set); _vptr++; _vlen--; } \ |
46 |
} while(0) |
47 |
|
48 |
#define wipememory(_ptr,_len) wipememory2 (_ptr,0,_len) |
49 |
|
50 |
/* OE5 V5.x/V6 command id's. */ |
51 |
#define ID_OE5_SELECTALL 40125 |
52 |
#define ID_OE5_COPY 40484 |
53 |
#define ID_OE5_PASTE 40231 |
54 |
#define ID_OE5_ENCRYPT 40260 |
55 |
#define ID_OE5_SIGN 40299 |
56 |
#define ID_OE5_SEND 40411 |
57 |
#define ID_OE5_PREVMSG 40145 |
58 |
#define ID_OE5_NEXTMSG 40146 |
59 |
|
60 |
/* Common dialogs (GetOpenFileName) */ |
61 |
#define OF_IDOK 1 |
62 |
#define OF_IDFILE 1152 |
63 |
|
64 |
/* Config dialog id's */ |
65 |
#define ID_OE5_CFGENCRYPT 1053 |
66 |
#define ID_OE5_CFGSIGN 1052 |
67 |
#define ID_OE5_CFGDETAILS 2118 |
68 |
#define ID_OE5_CFGUID 2112 |
69 |
#define ID_OE5_UIDREQ 2117 |
70 |
|
71 |
|
72 |
/* Context for the recipient list. */ |
73 |
struct recip_list_s { |
74 |
struct recip_list_s *next; |
75 |
gpgme_key_t key; |
76 |
char *addr; |
77 |
}; |
78 |
typedef struct recip_list_s *recip_list_t; |
79 |
|
80 |
/* Actual plugin context. */ |
81 |
struct plugin_ctx_s { |
82 |
HWND msg_wnd, main_wnd, addr_wnd; |
83 |
HWND to_wnd, cc_wnd, bcc_wnd; |
84 |
char *to; |
85 |
char *cc; |
86 |
char *bcc; |
87 |
int sign; |
88 |
int encrypt; |
89 |
recip_list_t rset; |
90 |
char errbuf[256]; |
91 |
}; |
92 |
typedef struct plugin_ctx_s *plugin_ctx_t; |
93 |
|
94 |
/* Viewer context. */ |
95 |
struct viewer_ctx_s { |
96 |
const char *msg; |
97 |
}; |
98 |
typedef struct viewer_ctx_s *viewer_ctx_t; |
99 |
|
100 |
|
101 |
/*-- OEProc.c --*/ |
102 |
extern HINSTANCE mod_hinst_dll; |
103 |
extern WNDPROC oe_proc_old; |
104 |
LRESULT CALLBACK oe_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam); |
105 |
|
106 |
/*-- GPGOE.c --*/ |
107 |
int gpgoe_initialize (void); |
108 |
int gpgoe_remove (void); |
109 |
|
110 |
/*-- OECrypto.c --*/ |
111 |
gpgme_error_t oe_handle_mail (plugin_ctx_t ctx); |
112 |
|
113 |
/*-- OEMisc.c --*/ |
114 |
char* utf8_to_native (const char *string); |
115 |
char* get_clip_text (HWND hwnd); |
116 |
int set_clip_text (HWND hwnd, const char *text, int nbytes); |
117 |
void show_error (HWND hwnd, const char *caption, |
118 |
UINT type, const char *fmt, ...); |
119 |
void* xcalloc (size_t n, size_t m); |
120 |
char* xstrdup (const char *s); |
121 |
|
122 |
/*-- dialogs --*/ |
123 |
BOOL CALLBACK encrypt_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, |
124 |
LPARAM lparam); |
125 |
BOOL CALLBACK viewer_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, |
126 |
LPARAM lparam); |
127 |
BOOL CALLBACK verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, |
128 |
LPARAM lparam); |
129 |
BOOL CALLBACK pass_cb_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, |
130 |
LPARAM lparam); |
131 |
|
132 |
struct pass_cb_s; |
133 |
typedef struct pass_cb_s *pass_cb_t; |
134 |
|
135 |
gpgme_error_t passphrase_cb (void *hook, |
136 |
const char *uid_hint, |
137 |
const char *passphrase_info, |
138 |
int prev_was_bad, int fd); |
139 |
void free_pass_cb (pass_cb_t cb); |
140 |
pass_cb_t new_pass_cb (HWND main); |
141 |
|
142 |
#ifdef __cplusplus |
143 |
} |
144 |
#endif |
145 |
|
146 |
#endif /* GPGOE_H */ |