1 |
/* OEProc.c - OE window procedures |
/* OEProc.c - OE window procedure |
2 |
* Copyright (C) 2001, 2002, 2003, 2006 Timo Schulz |
* Copyright (C) 2001, 2002, 2003, 2006 Timo Schulz |
3 |
* |
* |
4 |
* This file is part of GPGOE. |
* This file is part of GPGOE. |
34 |
#define ID_OE_SEND 40411 |
#define ID_OE_SEND 40411 |
35 |
#define ID_OE_PREVMSG 40145 |
#define ID_OE_PREVMSG 40145 |
36 |
#define ID_OE_NEXTMSG 40146 |
#define ID_OE_NEXTMSG 40146 |
37 |
|
#define ID_OE_ATTACH 40237 |
38 |
|
|
39 |
/* Outlook select charset IDs. */ |
/* Outlook select charset IDs. */ |
40 |
#define ID_OE_CP_UTF8 42540 |
#define ID_OE_CP_UTF8 42540 |
45 |
#define ID_OE_CP_LATIN9 42535 |
#define ID_OE_CP_LATIN9 42535 |
46 |
|
|
47 |
/* Global plugin structure. */ |
/* Global plugin structure. */ |
48 |
static plugin_ctx_t oe_plug; |
plugin_ctx_t oe_plug; |
49 |
|
|
50 |
/* We show a warning for the attachment problem, but only once. */ |
/* We show a warning for the attachment problem, but only once. */ |
51 |
static int attach_warn_shown = 0; |
static int attach_warn_shown = 0; |
57 |
HANDLE plugin_active = NULL; |
HANDLE plugin_active = NULL; |
58 |
|
|
59 |
|
|
|
/* Return the Outlook main window handle. */ |
|
|
HWND |
|
|
outlook_get_main_window (void) |
|
|
{ |
|
|
if (!oe_plug) |
|
|
return GetActiveWindow (); |
|
|
return oe_plug->main_wnd; |
|
|
} |
|
|
|
|
60 |
|
|
61 |
/* Display a warning that the attachments of the mail will be |
/* Display a warning that the attachments of the mail will be |
62 |
sent in cleartext. */ |
sent in cleartext. */ |
152 |
} |
} |
153 |
|
|
154 |
|
|
155 |
/* Try to figure out if the message is from the inbox or |
/* Try to figure out if the message is from the inbox or the outbox folder. */ |
|
the outbox folder. */ |
|
156 |
int |
int |
157 |
window_is_inbox (HWND to_hwnd) |
window_is_inbox (HWND to_hwnd) |
158 |
{ |
{ |
159 |
/* |
char wclass[200]; |
160 |
XXX: we need to check the express version otherwise early |
|
161 |
V6 versions will not work. |
if (GetDlgCtrlID (to_hwnd) == 1028 && |
162 |
if (GetWindowLong (to_hwnd, GWL_STYLE) & ES_READONLY) |
GetClassName (to_hwnd, wclass, sizeof (wclass)-1) > 0 |
163 |
return 1; |
&& !strcmp (wclass, "RichEdit20W")) |
|
*/ |
|
|
if (GetDlgCtrlID (to_hwnd) == 1028) |
|
164 |
return 1; |
return 1; |
165 |
return 0; |
return 0; |
166 |
} |
} |
180 |
/* Initialize the plugin context: |
/* Initialize the plugin context: |
181 |
Find all windows the plugin need to handle messages. |
Find all windows the plugin need to handle messages. |
182 |
The text of the recipients fields is only used when the message comes |
The text of the recipients fields is only used when the message comes |
183 |
from the outbox, because the inbox fields are readonly. |
from the outbox, because the inbox fields are readonly. */ |
|
>= OE 5.5 uses a newer RichEdit control! */ |
|
184 |
int |
int |
185 |
plugin_init (plugin_ctx_t ctx, HWND main, int is_inbox) |
plugin_init (plugin_ctx_t ctx, HWND main, int is_inbox) |
186 |
{ |
{ |
193 |
|
|
194 |
ctx->main_wnd = main; |
ctx->main_wnd = main; |
195 |
ctx->addr_wnd = FindWindowEx (main, NULL, "OE_Envelope", NULL); |
ctx->addr_wnd = FindWindowEx (main, NULL, "OE_Envelope", NULL); |
196 |
ctx->to_wnd = FindWindowEx (ctx->addr_wnd, NULL, "RICHEDIT", NULL); |
ctx->to_wnd = FindWindowEx (ctx->addr_wnd, NULL, "RichEdit20W", NULL); |
197 |
if (!ctx->to_wnd) |
ctx->cc_wnd = FindWindowEx (ctx->addr_wnd, ctx->to_wnd, "RichEdit20W", NULL); |
198 |
ctx->to_wnd = FindWindowEx (ctx->addr_wnd, NULL, "RichEdit20W", NULL); |
ctx->bcc_wnd = FindWindowEx (ctx->addr_wnd, ctx->cc_wnd, "RichEdit20W", NULL); |
199 |
ctx->cc_wnd = FindWindowEx (ctx->addr_wnd, ctx->to_wnd, "RICHEDIT", NULL); |
|
|
if (!ctx->cc_wnd) |
|
|
ctx->cc_wnd = FindWindowEx (ctx->addr_wnd, ctx->to_wnd, |
|
|
"RichEdit20W", NULL); |
|
|
ctx->bcc_wnd = FindWindowEx (ctx->addr_wnd, ctx->cc_wnd, "RICHEDIT", NULL); |
|
|
if (!ctx->bcc_wnd) |
|
|
ctx->bcc_wnd = FindWindowEx (ctx->addr_wnd, ctx->cc_wnd, |
|
|
"RichEdit20W", NULL); |
|
200 |
ctx->to = NULL; |
ctx->to = NULL; |
201 |
ctx->cc = NULL; |
ctx->cc = NULL; |
202 |
ctx->bcc = NULL; |
ctx->bcc = NULL; |
253 |
control would not be displayed. */ |
control would not be displayed. */ |
254 |
LoadLibrary ("RichEd32.Dll"); |
LoadLibrary ("RichEd32.Dll"); |
255 |
setup_gettext(); |
setup_gettext(); |
256 |
plugin_active = CreateEvent (NULL, TRUE, /*TRUE*/FALSE, NULL); |
plugin_active = CreateEvent (NULL, TRUE, FALSE, NULL); |
257 |
plugin_preload_done = 1; |
plugin_preload_done = 1; |
258 |
} |
} |
|
/* |
|
|
else |
|
|
SetEvent (plugin_active); |
|
|
*/ |
|
259 |
initialized = 0; |
initialized = 0; |
260 |
plugin_new (&oe_plug); |
plugin_new (&oe_plug); |
261 |
break; |
break; |
299 |
oe_plug->use_utf8 = 0; |
oe_plug->use_utf8 = 0; |
300 |
break; |
break; |
301 |
|
|
302 |
|
case ID_OE_ATTACH: |
303 |
|
break; |
304 |
|
|
305 |
case ID_OE_ENCRYPT: |
case ID_OE_ENCRYPT: |
306 |
encr_msg ^= 1; |
encr_msg ^= 1; |
307 |
break; |
break; |