/[gpgoe]/trunk/src/OEProc.c
ViewVC logotype

Diff of /trunk/src/OEProc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 15 by twoaday, Fri Apr 7 10:46:41 2006 UTC revision 16 by twoaday, Tue Apr 11 06:56:23 2006 UTC
# Line 1  Line 1 
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.
# Line 34  Line 34 
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
# Line 44  Line 45 
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;
# Line 56  static int plugin_preload_done = 0; Line 57  static int plugin_preload_done = 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. */
# Line 160  get_address_text (HWND main, HWND edit) Line 152  get_address_text (HWND main, HWND edit)
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  }  }
# Line 191  mail_count_attachments (plugin_ctx_t ctx Line 180  mail_count_attachments (plugin_ctx_t ctx
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  {  {
# Line 205  plugin_init (plugin_ctx_t ctx, HWND main Line 193  plugin_init (plugin_ctx_t ctx, HWND main
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;
# Line 272  oe_proc (HWND hwnd, UINT msg, WPARAM wpa Line 253  oe_proc (HWND hwnd, UINT msg, WPARAM wpa
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;
# Line 322  oe_proc (HWND hwnd, UINT msg, WPARAM wpa Line 299  oe_proc (HWND hwnd, UINT msg, WPARAM wpa
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;

Legend:
Removed from v.15  
changed lines
  Added in v.16

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26