49 |
gpg_clip_encrypt (gpgme_key_t rset[], int always_trust, gpgme_ctx_t *r_ctx) |
gpg_clip_encrypt (gpgme_key_t rset[], int always_trust, gpgme_ctx_t *r_ctx) |
50 |
{ |
{ |
51 |
gpgme_error_t err; |
gpgme_error_t err; |
52 |
|
gpgme_encrypt_flags_t flags; |
53 |
gpgme_ctx_t ctx = NULL; |
gpgme_ctx_t ctx = NULL; |
54 |
gpgme_data_t plain = NULL; |
gpgme_data_t plain = NULL; |
55 |
gpgme_data_t ciph = NULL; |
gpgme_data_t ciph = NULL; |
67 |
err = gpgme_data_new (&ciph); |
err = gpgme_data_new (&ciph); |
68 |
if (err) |
if (err) |
69 |
goto leave; |
goto leave; |
70 |
err = gpgme_op_encrypt (ctx, rset, |
flags = always_trust? GPGME_ENCRYPT_ALWAYS_TRUST : (gpgme_encrypt_flags_t)0; |
71 |
always_trust?GPGME_ENCRYPT_ALWAYS_TRUST : (gpgme_encrypt_flags_t)0, |
err = gpgme_op_encrypt (ctx, rset, flags, plain, ciph); |
|
plain, ciph); |
|
72 |
*r_ctx = ctx; |
*r_ctx = ctx; |
73 |
if (err) |
if (err) |
74 |
goto leave; |
goto leave; |
147 |
gpgme_key_t *rset; |
gpgme_key_t *rset; |
148 |
gpgme_ctx_t ctx=NULL; |
gpgme_ctx_t ctx=NULL; |
149 |
gpgme_error_t err; |
gpgme_error_t err; |
150 |
int force_trust = 0; |
char tmpbuf[64]; |
151 |
int n; |
size_t n; |
152 |
|
int force_trust = 0; |
153 |
|
|
154 |
switch (msg) { |
switch (msg) { |
155 |
case WM_INITDIALOG: |
case WM_INITDIALOG: |
176 |
notify = (NMHDR *)lparam; |
notify = (NMHDR *)lparam; |
177 |
if (notify && notify->code == NM_DBLCLK && |
if (notify && notify->code == NM_DBLCLK && |
178 |
notify->idFrom == IDC_ENCRYPT_KEYLIST) |
notify->idFrom == IDC_ENCRYPT_KEYLIST) |
179 |
PostMessage( dlg, WM_COMMAND, MAKEWPARAM( IDOK, 0 ), 0 ); |
PostMessage( dlg, WM_COMMAND, MAKEWPARAM (IDOK, 0), 0); |
180 |
if (notify && notify->code == LVN_COLUMNCLICK && |
if (notify && notify->code == LVN_COLUMNCLICK && |
181 |
notify->idFrom == IDC_ENCRYPT_KEYLIST) { |
notify->idFrom == IDC_ENCRYPT_KEYLIST) { |
182 |
NMLISTVIEW *p = (LPNMLISTVIEW) lparam; |
NMLISTVIEW *p = (LPNMLISTVIEW) lparam; |
226 |
return FALSE; |
return FALSE; |
227 |
|
|
228 |
case IDC_ENCRYPT_FNDCMD: |
case IDC_ENCRYPT_FNDCMD: |
|
{ |
|
|
char tmpbuf[64]; |
|
|
|
|
229 |
n = GetDlgItemText (dlg, IDC_ENCRYPT_FIND, tmpbuf, DIM (tmpbuf)-1); |
n = GetDlgItemText (dlg, IDC_ENCRYPT_FIND, tmpbuf, DIM (tmpbuf)-1); |
230 |
if (!n) |
if (!n) |
231 |
break; |
break; |
232 |
n = listview_find (lv, tmpbuf); |
n = listview_find (lv, tmpbuf, 0); |
233 |
if (n != -1) { |
if (n != -1) { |
234 |
int oldpos = listview_get_curr_pos (lv); |
int oldpos = listview_get_curr_pos (lv); |
235 |
listview_select_one (lv, n); |
listview_select_one (lv, n); |
236 |
listview_scroll (lv, oldpos, n); |
listview_scroll (lv, oldpos, n); |
237 |
} |
} |
238 |
else |
else |
239 |
log_box (_("Encryption"), MB_ERR, _("No recipient found with '%s'"), tmpbuf); |
log_box (_("Encryption"), MB_ERR, |
240 |
|
_("No recipient found with '%s'"), tmpbuf); |
241 |
break; |
break; |
|
} |
|
242 |
} |
} |
243 |
break; |
break; |
244 |
} |
} |