/[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 47 by werner, Mon Oct 31 14:04:59 2005 UTC revision 129 by twoaday, Fri Dec 30 13:56:10 2005 UTC
# Line 1  Line 1 
1  /* wptMAPI.cpp  /* wptMAPI.cpp
2   *      Copyright (C) 2003, 2004 Timo Schulz   *      Copyright (C) 2003, 2004, 2005 Timo Schulz
3   *   *
4   * This file is part of WinPT.   * This file is part of WinPT.
5   *   *
# Line 22  Line 22 
22  #endif  #endif
23    
24  #include <windows.h>  #include <windows.h>
 #include <windows.h>  
25  #include <stdio.h>  #include <stdio.h>
26  #include <mapi.h>  #include <mapi.h>
27    
 extern HINSTANCE glob_hinst;  
   
28  #include "resource.h"  #include "resource.h"
29  #include "wptTypes.h"  #include "wptTypes.h"
30  #include "wptErrors.h"  #include "wptErrors.h"
31  #include "wptW32API.h"  #include "wptW32API.h"
32  #include "wptGPG.h"  #include "wptGPG.h"
33    #include "wptVersion.h"
34    
35  static LPMAPILOGON          mapi_logon = NULL;  static LPMAPILOGON          mapi_logon = NULL;
36  static LPMAPILOGOFF         mapi_logoff = NULL;      static LPMAPILOGOFF         mapi_logoff = NULL;    
# Line 45  static int                 init = 0; Line 42  static int                 init = 0;
42  #define load_one_fnc(cast, hlib, name) (cast)GetProcAddress ((hlib), name)  #define load_one_fnc(cast, hlib, name) (cast)GetProcAddress ((hlib), name)
43    
44    
45    /* Load MAPI library and set function pointers.
46       Return value: 0 on success. */
47  int  int
48  mapi_init (void)  mapi_init (void)
49  {  {
# Line 64  mapi_init (void) Line 63  mapi_init (void)
63      init = 1;      init = 1;
64    
65      return 0;      return 0;
66  } /* mapi_init */  }
67    
68    
69    /* Free library and cleanup. */
70  void  void
71  mapi_deinit (void)  mapi_deinit (void)
72  {  {
# Line 75  mapi_deinit (void) Line 75  mapi_deinit (void)
75          hlib = NULL;          hlib = NULL;
76          init = 0;          init = 0;
77      }      }
78  } /* mapi_deinit */  }
79    
80  #if 0 /* low:priority XXX port the code */  
81    /* Send the file given in @ascfile via the MAPI mechanism. */
82  int  int
83  mapi_send_ascfile (char *ascfile)  mapi_send_ascfile (char *ascfile)
84  {  {
# Line 104  fail: Line 105  fail:
105  }  }
106    
107    
108    /* Send a public key stored in @keyfile with the keyid @keyid
109       via the MAPI mechanism to a mail recipient.
110       Return value: SUCCESS_SUCCESS on succes. */
111  int  int
112  mapi_send_pubkey (const char *keyid, char *keyfile)  mapi_send_pubkey (const char *keyid, char *keyfile)
113  {  {
# Line 135  fail: Line 139  fail:
139      mapi_logoff (hd, 0, 0, 0);      mapi_logoff (hd, 0, 0, 0);
140      free_if_alloc (keyinf);      free_if_alloc (keyinf);
141      return rc;      return rc;
142  } /* mapi_send_pubkey */  }
143    
144    
145    #if 0 /* low:priority XXX port the code */
146  static void  static void
147  free_mapi_msg (MapiMessage * msg)  free_mapi_msg (MapiMessage * msg)
148  {  {
# Line 371  mapi_send_message (gpgme_recipients_t rs Line 376  mapi_send_message (gpgme_recipients_t rs
376    
377    
378  static int  static int
379  add_recipient (gpgme_recipients_t * r_rset, const char * addr)  add_recipient (gpgme_recipients_t *r_rset, const char *addr)
380  {  {
381      gpg_keycache_t pub = keycache_get_ctx (1);      gpg_keycache_t pub = keycache_get_ctx (1);
382      gpgme_key_t key;      gpgme_key_t key;
383      gpgme_error_t rc;      gpgme_error_t rc;
384      const char * s;      char *uid;
385    
386      if (!*r_rset)      if (!*r_rset)
387          gpgme_recipients_new (&(*r_rset));          gpgme_recipients_new (&(*r_rset));
# Line 385  add_recipient (gpgme_recipients_t * r_rs Line 390  add_recipient (gpgme_recipients_t * r_rs
390          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);
391          return -1;          return -1;
392      }      }
393      s = key->uids->uid;      if (key->uids->uid) {
394      if (s)          uid = utf8_to_wincp2 (key->uids->uid);
395          gpgme_recipients_add_name (*r_rset, s);          gpgme_recipients_add_name (*r_rset, uid);
396            free_if_alloc (uid);
397        }
398      return 0;      return 0;
399  } /* add_recipient */  } /* add_recipient */
400    

Legend:
Removed from v.47  
changed lines
  Added in v.129

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26