/[winpt]/trunk/Src/wptMAPI.cpp
ViewVC logotype

Diff of /trunk/Src/wptMAPI.cpp

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

revision 22 by twoaday, Wed Aug 10 11:33:35 2005 UTC revision 23 by twoaday, Fri Sep 30 10:10:16 2005 UTC
# Line 17  Line 17 
17   * along with WinPT; if not, write to the Free Software Foundation,   * along with WinPT; if not, write to the Free Software Foundation,
18   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19   */   */
20    #if 0 /* low:priority XXX port the code */
21  #include <windows.h>  #include <windows.h>
22  #include <stdio.h>  #include <stdio.h>
23  #include <mapi.h>  #include <mapi.h>
# Line 75  mapi_deinit (void) Line 75  mapi_deinit (void)
75    
76    
77  int  int
78  mapi_send_ascfile (char * ascfile)  mapi_send_ascfile (char *ascfile)
79  {  {
80      LHANDLE hd;      LHANDLE hd;
81      int rc;      int rc;
# Line 101  fail: Line 101  fail:
101    
102    
103  int  int
104  mapi_send_pubkey (const char * keyid, char * keyfile)  mapi_send_pubkey (const char *keyid, char *keyfile)
105  {  {
106      LHANDLE hd;      LHANDLE hd;
107      const char * fmt;      const char * fmt;
# Line 146  free_mapi_msg (MapiMessage * msg) Line 146  free_mapi_msg (MapiMessage * msg)
146    
147    
148  static void  static void
149  free_recip_tab (MapiRecipDesc * recip, size_t n)  free_recip_tab (MapiRecipDesc *recip, size_t n)
150  {  {
151      size_t i;      size_t i;
152    
# Line 209  conv_recipients (gpgme_recipients_t rset Line 209  conv_recipients (gpgme_recipients_t rset
209    
210    
211  static char *  static char *
212  secure_attachment (gpgme_recipients_t rset, const char * fname)  secure_attachment (gpgme_recipients_t rset, const char *fname)
213  {  {
214      char tmpdir[512+32], * p;      char tmpdir[512+32], * p;
215      gpgme_recipients_t addrs;      gpgme_recipients_t addrs;
# Line 229  secure_attachment (gpgme_recipients_t rs Line 229  secure_attachment (gpgme_recipients_t rs
229      rc = gpgme_new (&ctx);      rc = gpgme_new (&ctx);
230      if (rc)      if (rc)
231          return NULL;          return NULL;
232      gpgme_control (ctx, GPGME_CTRL_ARMOR, 1);      gpgme_set_armor (ctx, 1);
     gpgme_control (ctx, GPGME_CTRL_FORCETRUST, 1);  
233      addrs = conv_recipients (rset);      addrs = conv_recipients (rset);
234      if (!addrs) {      if (!addrs) {
235          msg_box (NULL, _("No valid mail addresses found."), _("Secure Attachment"), MB_ERR);          msg_box (NULL, _("No valid mail addresses found."), _("Secure Attachment"), MB_ERR);
# Line 259  secure_message (gpgme_recipients_t rset, Line 258  secure_message (gpgme_recipients_t rset,
258      rc = gpgme_new (&ctx);      rc = gpgme_new (&ctx);
259      if (rc)      if (rc)
260          return NULL;          return NULL;
261      gpgme_control (ctx, GPGME_CTRL_ARMOR, 1);      gpgme_set_armor (ctx, 1);
     gpgme_control (ctx, GPGME_CTRL_FORCETRUST, 1);  
262    
263      addrs = conv_recipients (rset);      addrs = conv_recipients (rset);
264      rc = gpgme_data_new_from_mem (&in, data, strlen (data), 1);      rc = gpgme_data_new_from_mem (&in, data, strlen (data), 1);
# Line 269  secure_message (gpgme_recipients_t rset, Line 267  secure_message (gpgme_recipients_t rset,
267          return NULL;          return NULL;
268      }      }
269      gpgme_data_new (&out);      gpgme_data_new (&out);
270            rc = gpgme_op_encrypt (ctx, addrs, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
     rc = gpgme_op_encrypt (ctx, addrs, in, out);  
271      if (rc)      if (rc)
272          log_box (_("Secure Message"), MB_ERR, "Could not encrypt the data");          log_box (_("Secure Message"), MB_ERR, "Could not encrypt the data");
273    
274      p = gpgme_data_release_and_return_string (out);      p = gpgme_data_release_and_get_mem (&n);
275        p[n] = 0;
276    
277      gpgme_data_release (in);      gpgme_data_release (in);
278      gpgme_release (ctx);      gpgme_release (ctx);
# Line 286  secure_message (gpgme_recipients_t rset, Line 284  secure_message (gpgme_recipients_t rset,
284    
285  int  int
286  mapi_send_message (gpgme_recipients_t rset, const char * msgtxt,  mapi_send_message (gpgme_recipients_t rset, const char * msgtxt,
287                     const char * subject, const char ** files, size_t nfiles)                     const char * subject, const char **files, size_t nfiles)
288  {  {
289      LHANDLE hd;      LHANDLE hd;
290      MapiMessage * msg;      MapiMessage * msg;
# Line 381  add_recipient (gpgme_recipients_t * r_rs Line 379  add_recipient (gpgme_recipients_t * r_rs
379          log_box (_("Add Recipient"), MB_ERR, _("Could not find key for '%s'"), addr);          log_box (_("Add Recipient"), MB_ERR, _("Could not find key for '%s'"), addr);
380          return -1;          return -1;
381      }      }
382      s = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, 0);      s = key->uids->uid;
383      if (s)      if (s)
384          gpgme_recipients_add_name (*r_rset, s);          gpgme_recipients_add_name (*r_rset, s);
385      return 0;      return 0;
# Line 416  winpt_mail_proc (HWND dlg, UINT msg, WPA Line 414  winpt_mail_proc (HWND dlg, UINT msg, WPA
414    
415      switch (msg) {      switch (msg) {
416      case WM_INITDIALOG:      case WM_INITDIALOG:
417          center_window (dlg);          center_window (dlg, NULL);
418          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
419          break;          break;
420    
# Line 455  winpt_mail_proc (HWND dlg, UINT msg, WPA Line 453  winpt_mail_proc (HWND dlg, UINT msg, WPA
453    
454      return FALSE;      return FALSE;
455  } /* winpt_mail_proc */  } /* winpt_mail_proc */
456    #endif

Legend:
Removed from v.22  
changed lines
  Added in v.23

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26