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 |
*/ |
*/ |
|
#if 0 /* low:priority XXX port the code */ |
|
20 |
#include <windows.h> |
#include <windows.h> |
21 |
#include <stdio.h> |
#include <stdio.h> |
22 |
#include <mapi.h> |
#include <mapi.h> |
72 |
} |
} |
73 |
} /* mapi_deinit */ |
} /* mapi_deinit */ |
74 |
|
|
75 |
|
#if 0 /* low:priority XXX port the code */ |
76 |
int |
int |
77 |
mapi_send_ascfile (char *ascfile) |
mapi_send_ascfile (char *ascfile) |
78 |
{ |
{ |
244 |
} /* secure_attachment */ |
} /* secure_attachment */ |
245 |
|
|
246 |
|
|
247 |
static char * |
static gpgme_error_t |
248 |
secure_message (gpgme_recipients_t rset, const char * data) |
secure_message (gpgme_recipients_t rset, const char *data, |
249 |
|
char *enc_msg, size_t *r_enclen) |
250 |
{ |
{ |
251 |
gpgme_recipients_t addrs; |
gpgme_recipients_t addrs; |
252 |
gpgme_error_t rc; |
gpgme_error_t rc; |
264 |
rc = gpgme_data_new_from_mem (&in, data, strlen (data), 1); |
rc = gpgme_data_new_from_mem (&in, data, strlen (data), 1); |
265 |
if (rc) { |
if (rc) { |
266 |
gpgme_release (ctx); |
gpgme_release (ctx); |
267 |
return NULL; |
return rc; |
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, GPGME_ENCRYPT_ALWAYS_TRUST, 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_get_mem (&n); |
*r_enc_msg = gpgme_data_release_and_get_mem (&n); |
275 |
p[n] = 0; |
*r_enclen = n; |
276 |
|
|
277 |
gpgme_data_release (in); |
gpgme_data_release (in); |
278 |
gpgme_release (ctx); |
gpgme_release (ctx); |
279 |
gpgme_recipients_release (addrs); |
gpgme_recipients_release (addrs); |
280 |
|
|
281 |
return p; |
return rc; |
282 |
} /* secure_message */ |
} /* secure_message */ |
283 |
|
|
284 |
|
|
293 |
char * p; |
char * p; |
294 |
const char * s; |
const char * s; |
295 |
void * ctx=NULL; |
void * ctx=NULL; |
296 |
size_t n, i=0; |
size_t n, i=0, encmsg_len=0; |
297 |
int rc; |
int rc; |
298 |
|
|
299 |
if (!init) |
if (!init) |
311 |
p = msg->lpszSubject = strdup (subject); |
p = msg->lpszSubject = strdup (subject); |
312 |
if (!p) |
if (!p) |
313 |
BUG (0); |
BUG (0); |
314 |
p = msg->lpszNoteText = secure_message (rset, msgtxt); |
p = msg->lpszNoteText = secure_message (rset, msgtxt, &p, &encmsg_len); |
315 |
if (!p) |
if (!p) |
316 |
BUG (0); |
BUG (0); |
317 |
n = msg->nRecipCount = gpgme_recipients_count (rset); |
n = msg->nRecipCount = gpgme_recipients_count (rset); |
367 |
static int |
static int |
368 |
add_recipient (gpgme_recipients_t * r_rset, const char * addr) |
add_recipient (gpgme_recipients_t * r_rset, const char * addr) |
369 |
{ |
{ |
370 |
gpgme_keycache_t pub = keycache_get_ctx (1); |
gpg_keycache_t pub = keycache_get_ctx (1); |
371 |
gpgme_key_t key; |
gpgme_key_t key; |
372 |
gpgme_error_t rc; |
gpgme_error_t rc; |
373 |
const char * s; |
const char * s; |