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

Annotation of /trunk/src/GPGOE.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 24 - (hide annotations)
Tue Dec 13 10:40:30 2011 UTC (13 years, 4 months ago) by twoaday
File MIME type: text/plain
File size: 5105 byte(s)
Commit code for backup purposes.


1 twoaday 1 /* GPGOE.h - GnuPG for Outlook Express
2 twoaday 23 * Copyright (C) 2001, 2002, 2003, 2006, 2007 Timo Schulz
3 twoaday 1 *
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    
17     #ifndef GPGOE_H
18     #define GPGOE_H
19    
20 twoaday 19 /* Macros to support a separate section for variables. */
21     #ifdef __GNUC__
22     #define ATTR_SEC __attribute__((section (".SHARDAT"), shared))
23     #else
24     #define ATTR_SEC
25     #endif
26    
27 twoaday 23 /* How many items we can store in the dictionary */
28 twoaday 19 #define HASH_BUCKETS 3
29 twoaday 24 #define MAX_PASS_LEN 2048
30 twoaday 19
31 twoaday 12 /* gettext support. */
32     const char *gettext (const char *msgid);
33     #define _(X) gettext ((X))
34 twoaday 1
35     #include <malloc.h>
36 twoaday 16 /* safe wrapper around free. */
37 twoaday 1 #define free_if_alloc(ptr) \
38 twoaday 11 do { \
39 twoaday 1 if (ptr) free (ptr); \
40     ptr = NULL; \
41 twoaday 11 } while (0)
42 twoaday 1
43    
44     /* Wrapper for memory deallocation but overwrite the buffer before.
45     Useful for sentensive information like PINs or passwords. */
46     #define wipememory2(_ptr,_set,_len) do { \
47     volatile char *_vptr = (volatile char *)(_ptr); \
48     size_t _vlen = (_len); \
49     while (_vlen) { *_vptr = (_set); _vptr++; _vlen--; } \
50     } while(0)
51    
52     #define wipememory(_ptr,_len) wipememory2 (_ptr,0,_len)
53    
54 twoaday 23 #ifndef DIM
55     #define DIM(v) (sizeof (v) / sizeof ((v)[0]))
56     #endif
57    
58 twoaday 16 /* Dialog IDs for the various operations. */
59 twoaday 12 #define ID_OE_SELECTALL 40125
60     #define ID_OE_COPY 40484
61     #define ID_OE_PASTE 40231
62     #define ID_OE_SAVE_ATT 40104
63 twoaday 1
64 twoaday 12 /* Common dialogs (Get{Open,Save}FileName) */
65     #define ID_OF_OK 1
66     #define ID_OF_CANCEL 2
67     #define ID_OF_OPEN_FILE 1152
68     #define ID_OF_SAVE_FILE 1148
69 twoaday 1
70    
71 twoaday 19 /* Supported plug-in modes. */
72     enum gpgoe_mode_t {
73     GPGOE_MODE_NORMAL = 0,
74     GPGOE_MODE_PLAINREPLY = 1, /* decrypt mails before a reply. */
75     GPGOE_MODE_CACHEPASS = 2, /* cache passphrase. */
76     };
77    
78 twoaday 1 /* Context for the recipient list. */
79     struct recip_list_s {
80     struct recip_list_s *next;
81 twoaday 23 gpgme_key_t key; /* The actual key to use */
82     char *addr; /* The email address. */
83 twoaday 1 };
84     typedef struct recip_list_s *recip_list_t;
85    
86     /* Actual plugin context. */
87     struct plugin_ctx_s {
88     HWND msg_wnd, main_wnd, addr_wnd;
89     HWND to_wnd, cc_wnd, bcc_wnd;
90 twoaday 12 HWND attach;
91 twoaday 1 char *to;
92     char *cc;
93     char *bcc;
94     int sign;
95     int encrypt;
96     recip_list_t rset;
97     char errbuf[256];
98 twoaday 11 char *orig_text;
99 twoaday 12 int use_utf8;
100 twoaday 1 };
101     typedef struct plugin_ctx_s *plugin_ctx_t;
102    
103     /* Viewer context. */
104     struct viewer_ctx_s {
105 twoaday 16 HWND main_wnd;
106 twoaday 1 const char *msg;
107     };
108     typedef struct viewer_ctx_s *viewer_ctx_t;
109    
110 twoaday 23 /* Signature verify context. */
111 twoaday 19 struct verify_ctx_s {
112     gpgme_signature_t sig;
113     gpgme_data_t text;
114     };
115     typedef struct verify_ctx_s *verify_ctx_t;
116    
117 twoaday 11 /*-- GPGOE.c --*/
118 twoaday 23 int gpgoe_initialize (void);
119     int gpgoe_remove (void);
120     void gpgoe_set_active_modes (int mode);
121     int gpgoe_get_active_modes (void);
122 twoaday 11
123 twoaday 1 /*-- OEProc.c --*/
124 twoaday 16 extern plugin_ctx_t oe_plug;
125 twoaday 1 extern HINSTANCE mod_hinst_dll;
126 twoaday 16 extern HANDLE plugin_active;
127    
128     /* support for the mailer window. */
129 twoaday 1 extern WNDPROC oe_proc_old;
130 twoaday 16 LRESULT CALLBACK oe_proc (HWND hwnd, UINT msg,
131     WPARAM wparam, LPARAM lparam);
132    
133     /* support for the common dialogs. */
134 twoaday 12 extern WNDPROC of_proc_old;
135 twoaday 16 LRESULT CALLBACK of_proc (HWND hwnd, UINT msg,
136     WPARAM wparam, LPARAM lparam);
137 twoaday 1
138 twoaday 16 /* support for the main window. */
139     extern WNDPROC oe_main_proc_old;
140     LRESULT CALLBACK oe_main_proc (HWND hwnd, UINT msg,
141     WPARAM wparam, LPARAM lparam);
142    
143    
144 twoaday 1 /*-- OECrypto.c --*/
145     gpgme_error_t oe_handle_mail (plugin_ctx_t ctx);
146 twoaday 16 gpgme_error_t oe_decrypt_msg (HWND main_wnd, char **r_msg);
147 twoaday 1
148     /*-- OEMisc.c --*/
149 twoaday 16 void center_window (HWND hwndChild, HWND parent);
150 twoaday 1 char* utf8_to_native (const char *string);
151 twoaday 12 char* native_to_utf8 (const char *string);
152 twoaday 1 char* get_clip_text (HWND hwnd);
153     int set_clip_text (HWND hwnd, const char *text, int nbytes);
154     void show_error (HWND hwnd, const char *caption,
155     UINT type, const char *fmt, ...);
156     void* xcalloc (size_t n, size_t m);
157     char* xstrdup (const char *s);
158 twoaday 12 void xfree (void *p);
159 twoaday 16 void quote_msg_text (const char *inp, char **r_outp);
160 twoaday 1
161     /*-- dialogs --*/
162     BOOL CALLBACK encrypt_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
163     LPARAM lparam);
164     BOOL CALLBACK viewer_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
165     LPARAM lparam);
166     BOOL CALLBACK verify_dlg_proc (HWND dlg, UINT msg, WPARAM wparam,
167     LPARAM lparam);
168    
169 twoaday 11 /* Opaque passphrase callback handle. */
170 twoaday 1 struct pass_cb_s;
171     typedef struct pass_cb_s *pass_cb_t;
172    
173     gpgme_error_t passphrase_cb (void *hook,
174     const char *uid_hint,
175     const char *passphrase_info,
176     int prev_was_bad, int fd);
177     void free_pass_cb (pass_cb_t cb);
178     pass_cb_t new_pass_cb (HWND main);
179 twoaday 18 int pass_cb_cancelled (pass_cb_t cb);
180 twoaday 19 void reset_pass_cache (void);
181 twoaday 1
182 twoaday 12 /*-- OENLS.c --*/
183     int setup_gettext (void);
184    
185 twoaday 1 #endif /* GPGOE_H */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26