/[gpgoe]/trunk/src/GPGOE.h
ViewVC logotype

Contents of /trunk/src/GPGOE.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 16 - (show annotations)
Tue Apr 11 06:56:23 2006 UTC (19 years ago) by twoaday
File MIME type: text/plain
File size: 4464 byte(s)


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 /* gettext support. */
25 const char *gettext (const char *msgid);
26 #define _(X) gettext ((X))
27
28
29 #include <malloc.h>
30 /* safe wrapper around free. */
31 #define free_if_alloc(ptr) \
32 do { \
33 if (ptr) free (ptr); \
34 ptr = NULL; \
35 } while (0)
36
37
38 /* Wrapper for memory deallocation but overwrite the buffer before.
39 Useful for sentensive information like PINs or passwords. */
40 #define wipememory2(_ptr,_set,_len) do { \
41 volatile char *_vptr = (volatile char *)(_ptr); \
42 size_t _vlen = (_len); \
43 while (_vlen) { *_vptr = (_set); _vptr++; _vlen--; } \
44 } while(0)
45
46 #define wipememory(_ptr,_len) wipememory2 (_ptr,0,_len)
47
48 /* Dialog IDs for the various operations. */
49 #define ID_OE_SELECTALL 40125
50 #define ID_OE_COPY 40484
51 #define ID_OE_PASTE 40231
52 #define ID_OE_SAVE_ATT 40104
53
54 /* Common dialogs (Get{Open,Save}FileName) */
55 #define ID_OF_OK 1
56 #define ID_OF_CANCEL 2
57 #define ID_OF_OPEN_FILE 1152
58 #define ID_OF_SAVE_FILE 1148
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 HWND attach;
74 char *to;
75 char *cc;
76 char *bcc;
77 int sign;
78 int encrypt;
79 recip_list_t rset;
80 char errbuf[256];
81 char *orig_text;
82 int use_utf8;
83 };
84 typedef struct plugin_ctx_s *plugin_ctx_t;
85
86 /* Viewer context. */
87 struct viewer_ctx_s {
88 HWND main_wnd;
89 const char *msg;
90 };
91 typedef struct viewer_ctx_s *viewer_ctx_t;
92
93
94 /*-- GPGOE.c --*/
95 /*EXPORT*/ int gpgoe_initialize (void);
96 /*EXPORT*/ int gpgoe_remove (void);
97
98 /*-- OEProc.c --*/
99 extern plugin_ctx_t oe_plug;
100 extern HINSTANCE mod_hinst_dll;
101 extern HANDLE plugin_active;
102
103 /* support for the mailer window. */
104 extern WNDPROC oe_proc_old;
105 LRESULT CALLBACK oe_proc (HWND hwnd, UINT msg,
106 WPARAM wparam, LPARAM lparam);
107
108 /* support for the common dialogs. */
109 extern WNDPROC of_proc_old;
110 LRESULT CALLBACK of_proc (HWND hwnd, UINT msg,
111 WPARAM wparam, LPARAM lparam);
112
113 /* support for the main window. */
114 extern WNDPROC oe_main_proc_old;
115 LRESULT CALLBACK oe_main_proc (HWND hwnd, UINT msg,
116 WPARAM wparam, LPARAM lparam);
117
118
119 /*-- OECrypto.c --*/
120 gpgme_error_t oe_handle_mail (plugin_ctx_t ctx);
121 gpgme_error_t oe_decrypt_msg (HWND main_wnd, char **r_msg);
122
123 /*-- OEMisc.c --*/
124 void center_window (HWND hwndChild, HWND parent);
125 char* utf8_to_native (const char *string);
126 char* native_to_utf8 (const char *string);
127 char* get_clip_text (HWND hwnd);
128 int set_clip_text (HWND hwnd, const char *text, int nbytes);
129 void show_error (HWND hwnd, const char *caption,
130 UINT type, const char *fmt, ...);
131 void* xcalloc (size_t n, size_t m);
132 char* xstrdup (const char *s);
133 void xfree (void *p);
134 void quote_msg_text (const char *inp, char **r_outp);
135
136 /*-- dialogs --*/
137 BOOL CALLBACK encrypt_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
138 LPARAM lparam);
139 BOOL CALLBACK viewer_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
140 LPARAM lparam);
141 BOOL CALLBACK verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
142 LPARAM lparam);
143
144 /* Opaque passphrase callback handle. */
145 struct pass_cb_s;
146 typedef struct pass_cb_s *pass_cb_t;
147
148 gpgme_error_t passphrase_cb (void *hook,
149 const char *uid_hint,
150 const char *passphrase_info,
151 int prev_was_bad, int fd);
152 void free_pass_cb (pass_cb_t cb);
153 pass_cb_t new_pass_cb (HWND main);
154 void free_pass_cache (void);
155
156 /*-- OENLS.c --*/
157 int setup_gettext (void);
158
159 #endif /* GPGOE_H */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26