18 |
* along with WinPT; if not, write to the Free Software Foundation, |
* along with WinPT; if not, write to the Free Software Foundation, |
19 |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
20 |
*/ |
*/ |
|
|
|
21 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
22 |
#include <config.h> |
#include <config.h> |
23 |
#endif |
#endif |
56 |
return err; |
return err; |
57 |
|
|
58 |
gpgme_set_armor (ctx, 1); |
gpgme_set_armor (ctx, 1); |
59 |
|
gpgme_set_textmode (ctx, 1); |
60 |
|
|
61 |
err = gpg_data_new_from_clipboard (&plain, 0); |
err = gpg_data_new_from_clipboard (&plain, 0); |
62 |
if (err) |
if (err) |
63 |
goto leave; |
goto leave; |
64 |
err = gpgme_data_new (&ciph); |
err = gpgme_data_new (&ciph); |
65 |
if (err) |
if (err) |
66 |
goto leave; |
goto leave; |
67 |
err = gpgme_op_encrypt (ctx, rset, |
err = gpgme_op_encrypt (ctx, rset, |
68 |
always_trust?GPGME_ENCRYPT_ALWAYS_TRUST : (gpgme_encrypt_flags_t)0, |
always_trust?GPGME_ENCRYPT_ALWAYS_TRUST : (gpgme_encrypt_flags_t)0, |
69 |
plain, ciph); |
plain, ciph); |
109 |
p = (char *)calloc (1, len+64); |
p = (char *)calloc (1, len+64); |
110 |
if (!p) |
if (!p) |
111 |
BUG (NULL); |
BUG (NULL); |
112 |
sprintf (p, _("Recipients unsuable for encryption:\n")); |
strcpy (p, _("Recipients unsuable for encryption:\n")); |
113 |
for (k = res->invalid_recipients; k; k = k->next) { |
for (k = res->invalid_recipients; k; k = k->next) { |
114 |
get_pubkey (k->fpr, &key); |
get_pubkey (k->fpr, &key); |
115 |
strcat (p, key->subkeys->keyid+8); |
strcat (p, key->subkeys->keyid+8); |
132 |
gpgme_key_t *rset; |
gpgme_key_t *rset; |
133 |
gpgme_ctx_t ctx=NULL; |
gpgme_ctx_t ctx=NULL; |
134 |
gpgme_error_t err; |
gpgme_error_t err; |
135 |
refresh_cache_s rcs = {0}; |
int force_trust = 0; |
|
int force_trust = 0, opt = 0; |
|
136 |
int kmode = reg_prefs.keylist_mode? KEYLIST_ENCRYPT_MIN : KEYLIST_ENCRYPT; |
int kmode = reg_prefs.keylist_mode? KEYLIST_ENCRYPT_MIN : KEYLIST_ENCRYPT; |
137 |
int n; |
int n; |
138 |
|
|
139 |
switch( msg ) { |
switch( msg ) { |
140 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
141 |
SetWindowText( dlg, _("Encryption") ); |
SetWindowText (dlg, _("Encryption")); |
142 |
|
SetDlgItemText (dlg, IDC_ENCRYPT_FNDCMD, _("&Find")); |
143 |
|
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
144 |
kc = keycache_get_ctx( KEYCACHE_PUB ); |
kc = keycache_get_ctx( KEYCACHE_PUB ); |
145 |
if( !kc ) |
if( !kc ) |
146 |
BUG( NULL ); |
BUG( NULL ); |
148 |
kmode, KEY_SORT_USERID); |
kmode, KEY_SORT_USERID); |
149 |
center_window( dlg, NULL ); |
center_window( dlg, NULL ); |
150 |
SetForegroundWindow( dlg ); |
SetForegroundWindow( dlg ); |
|
set_active_window( dlg ); |
|
151 |
return TRUE; |
return TRUE; |
152 |
|
|
153 |
case WM_DESTROY: |
case WM_DESTROY: |
|
reset_active_window( ); |
|
154 |
if( lv ) { |
if( lv ) { |
155 |
keylist_delete( lv ); |
keylist_delete( lv ); |
156 |
lv = NULL; |
lv = NULL; |
163 |
notify = (NMHDR *)lparam; |
notify = (NMHDR *)lparam; |
164 |
if (notify && notify->code == NM_DBLCLK && |
if (notify && notify->code == NM_DBLCLK && |
165 |
notify->idFrom == IDC_ENCRYPT_KEYLIST) |
notify->idFrom == IDC_ENCRYPT_KEYLIST) |
166 |
PostMessage( dlg, WM_COMMAND, MAKEWPARAM( IDOK, 0 ), NULL ); |
PostMessage( dlg, WM_COMMAND, MAKEWPARAM( IDOK, 0 ), 0 ); |
167 |
if (notify && notify->code == LVN_COLUMNCLICK && |
if (notify && notify->code == LVN_COLUMNCLICK && |
168 |
notify->idFrom == IDC_ENCRYPT_KEYLIST ) { |
notify->idFrom == IDC_ENCRYPT_KEYLIST ) { |
169 |
NMLISTVIEW *p = (LPNMLISTVIEW) lparam; |
NMLISTVIEW *p = (LPNMLISTVIEW) lparam; |
217 |
case IDC_ENCRYPT_FNDCMD: |
case IDC_ENCRYPT_FNDCMD: |
218 |
{ |
{ |
219 |
char tmpbuf[64]; |
char tmpbuf[64]; |
|
int n; |
|
220 |
|
|
221 |
n = GetDlgItemText (dlg, IDC_ENCRYPT_FIND, tmpbuf, DIM (tmpbuf)-1); |
n = GetDlgItemText (dlg, IDC_ENCRYPT_FIND, tmpbuf, DIM (tmpbuf)-1); |
222 |
if (!n) |
if (!n) |