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

Contents of /trunk/src/GPGOE.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (show annotations)
Fri Apr 7 10:46:41 2006 UTC (19 years, 1 month ago) by twoaday
File MIME type: text/plain
File size: 3963 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 /* 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 clipboard 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 const char *msg;
89 };
90 typedef struct viewer_ctx_s *viewer_ctx_t;
91
92
93 /*-- GPGOE.c --*/
94 /*EXPORT*/ int gpgoe_initialize (void);
95 /*EXPORT*/ int gpgoe_remove (void);
96
97 /*-- OEProc.c --*/
98 extern HINSTANCE mod_hinst_dll;
99 extern WNDPROC oe_proc_old;
100 extern WNDPROC of_proc_old;
101 extern HANDLE plugin_active;
102 LRESULT CALLBACK oe_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
103 LRESULT CALLBACK of_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
104
105 /*-- OECrypto.c --*/
106 gpgme_error_t oe_handle_mail (plugin_ctx_t ctx);
107
108 /*-- OEMisc.c --*/
109 char* utf8_to_native (const char *string);
110 char* native_to_utf8 (const char *string);
111 char* get_clip_text (HWND hwnd);
112 int set_clip_text (HWND hwnd, const char *text, int nbytes);
113 void show_error (HWND hwnd, const char *caption,
114 UINT type, const char *fmt, ...);
115 void* xcalloc (size_t n, size_t m);
116 char* xstrdup (const char *s);
117 void xfree (void *p);
118
119 /*-- dialogs --*/
120 BOOL CALLBACK encrypt_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
121 LPARAM lparam);
122 BOOL CALLBACK viewer_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
123 LPARAM lparam);
124 BOOL CALLBACK verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
125 LPARAM lparam);
126
127 /* Opaque passphrase callback handle. */
128 struct pass_cb_s;
129 typedef struct pass_cb_s *pass_cb_t;
130
131 gpgme_error_t passphrase_cb (void *hook,
132 const char *uid_hint,
133 const char *passphrase_info,
134 int prev_was_bad, int fd);
135 void free_pass_cb (pass_cb_t cb);
136 pass_cb_t new_pass_cb (HWND main);
137
138 /*-- OENLS.c --*/
139 int setup_gettext (void);
140
141 #endif /* GPGOE_H */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26