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 |
#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 |
{ |
{ |
79 |
LHANDLE hd; |
LHANDLE hd; |
80 |
int rc; |
int rc; |
100 |
|
|
101 |
|
|
102 |
int |
int |
103 |
mapi_send_pubkey (const char * keyid, char * keyfile) |
mapi_send_pubkey (const char *keyid, char *keyfile) |
104 |
{ |
{ |
105 |
LHANDLE hd; |
LHANDLE hd; |
106 |
const char * fmt; |
const char * fmt; |
145 |
|
|
146 |
|
|
147 |
static void |
static void |
148 |
free_recip_tab (MapiRecipDesc * recip, size_t n) |
free_recip_tab (MapiRecipDesc *recip, size_t n) |
149 |
{ |
{ |
150 |
size_t i; |
size_t i; |
151 |
|
|
208 |
|
|
209 |
|
|
210 |
static char * |
static char * |
211 |
secure_attachment (gpgme_recipients_t rset, const char * fname) |
secure_attachment (gpgme_recipients_t rset, const char *fname) |
212 |
{ |
{ |
213 |
char tmpdir[512+32], * p; |
char tmpdir[512+32], * p; |
214 |
gpgme_recipients_t addrs; |
gpgme_recipients_t addrs; |
228 |
rc = gpgme_new (&ctx); |
rc = gpgme_new (&ctx); |
229 |
if (rc) |
if (rc) |
230 |
return NULL; |
return NULL; |
231 |
gpgme_control (ctx, GPGME_CTRL_ARMOR, 1); |
gpgme_set_armor (ctx, 1); |
|
gpgme_control (ctx, GPGME_CTRL_FORCETRUST, 1); |
|
232 |
addrs = conv_recipients (rset); |
addrs = conv_recipients (rset); |
233 |
if (!addrs) { |
if (!addrs) { |
234 |
msg_box (NULL, _("No valid mail addresses found."), _("Secure Attachment"), MB_ERR); |
msg_box (NULL, _("No valid mail addresses found."), _("Secure Attachment"), MB_ERR); |
257 |
rc = gpgme_new (&ctx); |
rc = gpgme_new (&ctx); |
258 |
if (rc) |
if (rc) |
259 |
return NULL; |
return NULL; |
260 |
gpgme_control (ctx, GPGME_CTRL_ARMOR, 1); |
gpgme_set_armor (ctx, 1); |
|
gpgme_control (ctx, GPGME_CTRL_FORCETRUST, 1); |
|
261 |
|
|
262 |
addrs = conv_recipients (rset); |
addrs = conv_recipients (rset); |
263 |
rc = gpgme_data_new_from_mem (&in, data, strlen (data), 1); |
rc = gpgme_data_new_from_mem (&in, data, strlen (data), 1); |
266 |
return NULL; |
return NULL; |
267 |
} |
} |
268 |
gpgme_data_new (&out); |
gpgme_data_new (&out); |
269 |
|
rc = gpgme_op_encrypt (ctx, addrs, GPGME_ENCRYPT_ALWAYS_TRUST, in, out); |
|
rc = gpgme_op_encrypt (ctx, addrs, in, out); |
|
270 |
if (rc) |
if (rc) |
271 |
log_box (_("Secure Message"), MB_ERR, "Could not encrypt the data"); |
log_box (_("Secure Message"), MB_ERR, "Could not encrypt the data"); |
272 |
|
|
273 |
p = gpgme_data_release_and_return_string (out); |
p = gpgme_data_release_and_get_mem (&n); |
274 |
|
p[n] = 0; |
275 |
|
|
276 |
gpgme_data_release (in); |
gpgme_data_release (in); |
277 |
gpgme_release (ctx); |
gpgme_release (ctx); |
283 |
|
|
284 |
int |
int |
285 |
mapi_send_message (gpgme_recipients_t rset, const char * msgtxt, |
mapi_send_message (gpgme_recipients_t rset, const char * msgtxt, |
286 |
const char * subject, const char ** files, size_t nfiles) |
const char * subject, const char **files, size_t nfiles) |
287 |
{ |
{ |
288 |
LHANDLE hd; |
LHANDLE hd; |
289 |
MapiMessage * msg; |
MapiMessage * msg; |
378 |
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); |
379 |
return -1; |
return -1; |
380 |
} |
} |
381 |
s = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, 0); |
s = key->uids->uid; |
382 |
if (s) |
if (s) |
383 |
gpgme_recipients_add_name (*r_rset, s); |
gpgme_recipients_add_name (*r_rset, s); |
384 |
return 0; |
return 0; |
413 |
|
|
414 |
switch (msg) { |
switch (msg) { |
415 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
416 |
center_window (dlg); |
center_window (dlg, NULL); |
417 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
418 |
break; |
break; |
419 |
|
|
452 |
|
|
453 |
return FALSE; |
return FALSE; |
454 |
} /* winpt_mail_proc */ |
} /* winpt_mail_proc */ |
455 |
|
#endif |