39 |
#include "wptRegistry.h" |
#include "wptRegistry.h" |
40 |
#include "wptDlgs.h" |
#include "wptDlgs.h" |
41 |
#include "wptUTF8.h" |
#include "wptUTF8.h" |
42 |
|
#include "StringBuffer.h" |
43 |
|
|
44 |
|
|
45 |
/* Encrypt the contents of the clipboard with the keys in @rset. |
/* Encrypt the contents of the clipboard with the keys in @rset. |
100 |
gpgme_encrypt_result_t res; |
gpgme_encrypt_result_t res; |
101 |
gpgme_invalid_key_t k; |
gpgme_invalid_key_t k; |
102 |
gpgme_key_t key; |
gpgme_key_t key; |
103 |
|
StringBuffer p; |
104 |
size_t len=0; |
size_t len=0; |
105 |
const char *keyid; |
const char *keyid; |
106 |
const char *warn = _("key not found"); |
const char *warn = _("key not found"); |
107 |
char *uid, *p; |
char *uid; |
108 |
|
|
109 |
if (!ctx) |
if (!ctx) |
110 |
return -1; |
return -1; |
119 |
len += strlen (warn) + strlen (k->fpr)+8 + 2 + 4; |
len += strlen (warn) + strlen (k->fpr)+8 + 2 + 4; |
120 |
} |
} |
121 |
|
|
122 |
p = (char *)calloc (1, len+64); |
p = _("Recipients unsuable for encryption:\n"); |
|
if (!p) |
|
|
BUG (NULL); |
|
|
strcpy (p, _("Recipients unsuable for encryption:\n")); |
|
123 |
for (k = res->invalid_recipients; k; k = k->next) { |
for (k = res->invalid_recipients; k; k = k->next) { |
124 |
if (!get_pubkey (k->fpr, &key)) { |
if (!get_pubkey (k->fpr, &key)) { |
125 |
uid = utf8_to_native (key->uids->name); |
uid = utf8_to_native (key->uids->name); |
129 |
uid = strdup (warn); |
uid = strdup (warn); |
130 |
keyid = k->fpr; |
keyid = k->fpr; |
131 |
} |
} |
132 |
strcat (p, keyid); |
p = p + keyid + " : " + uid + "\n"; |
|
strcat (p, " : "); |
|
|
strcat (p, uid); |
|
|
strcat (p, "\n"); |
|
133 |
safe_free (uid); |
safe_free (uid); |
134 |
} |
} |
135 |
msg_box (dlg, p, _("Encryption"), MB_ERR); |
msg_box (dlg, p.getBuffer (), _("Encryption"), MB_ERR); |
|
safe_free (p); |
|
136 |
return 0; |
return 0; |
137 |
} |
} |
138 |
|
|