/[winpt]/trunk/Src/wptPassphraseCB.cpp
ViewVC logotype

Diff of /trunk/Src/wptPassphraseCB.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3 by twoaday, Mon Jan 31 11:02:21 2005 UTC revision 4 by twoaday, Sun Feb 6 11:11:40 2005 UTC
# Line 41  Line 41 
41    
42    
43  BOOL CALLBACK  BOOL CALLBACK
44  passphrase_callback_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam )  passphrase_callback_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
45  {      {    
46      static passphrase_cb_s * c;      static passphrase_cb_s * c;
47      static int yes = 1;      static int hide = 1;
48      gpgme_key_t key;      gpgme_key_t key;
49      const char * s, * id;      const char * s, * id;
50      char info[768] = {0};      char info[768] = {0};
# Line 53  passphrase_callback_proc( HWND dlg, UINT Line 53  passphrase_callback_proc( HWND dlg, UINT
53    
54      switch( msg )  {      switch( msg )  {
55      case WM_INITDIALOG:      case WM_INITDIALOG:
56            hide = 1;
57          c = (passphrase_cb_s *)lparam;          c = (passphrase_cb_s *)lparam;
58          if( !c )          if (!c)
59              BUG( NULL );              BUG (0);
60          SetWindowText( dlg, c->title );          SetWindowText (dlg, c->title);
61          if( c->gpg_cmd == GPG_CMD_DECRYPT ) {          if (c->gpg_cmd == GPG_CMD_DECRYPT) {
62              SetDlgItemText( dlg, IDC_DECRYPT_LISTINF,              SetDlgItemText( dlg, IDC_DECRYPT_LISTINF,
63                  _("Encrypted with the following public key(s)") );                  _("Encrypted with the following public key(s)") );
64              CheckDlgButton( dlg, IDC_DECRYPT_HIDE, BST_CHECKED );              CheckDlgButton( dlg, IDC_DECRYPT_HIDE, BST_CHECKED );
# Line 116  passphrase_callback_proc( HWND dlg, UINT Line 117  passphrase_callback_proc( HWND dlg, UINT
117                  if ( LOWORD( wparam ) == IDC_DECRYPT_HIDE                  if ( LOWORD( wparam ) == IDC_DECRYPT_HIDE
118                      || LOWORD( wparam ) == IDC_DECRYPT_SIGN_HIDE ) {                      || LOWORD( wparam ) == IDC_DECRYPT_SIGN_HIDE ) {
119                      HWND hwnd;                      HWND hwnd;
120                      yes ^= 1;                      hide ^= 1;
121                      hwnd = GetDlgItem( dlg, item_ctrl_id( c->gpg_cmd ) );                      hwnd = GetDlgItem( dlg, item_ctrl_id( c->gpg_cmd ) );
122                      SendMessage( hwnd, EM_SETPASSWORDCHAR, yes? '*' : 0, 0 );                      SendMessage( hwnd, EM_SETPASSWORDCHAR, hide? '*' : 0, 0 );
123                      SetFocus( hwnd );                      SetFocus( hwnd );
124                  }                  }
125              }              }
126    
127              switch( LOWORD( wparam ) ) {              switch (LOWORD (wparam)) {
128              case IDOK:              case IDOK:  
129                  /* fixme: the item is even cached when the passphrase is not                  /* fixme: the item is even cached when the passphrase is not
130                            correct, which means that the user needs to delete all                            correct, which means that the user needs to delete all
131                            cached entries to continue. */                            cached entries to continue. */
132                  GetDlgItemText( dlg, item_ctrl_id( c->gpg_cmd ), c->pwd, sizeof c->pwd -1 );                  GetDlgItemText (dlg, item_ctrl_id (c->gpg_cmd), c->pwd, sizeof (c->pwd) -1);
133                  if( reg_prefs.cache_time > 0 && !c->is_card ) {                  if (reg_prefs.cache_time > 0 && !c->is_card && !strstr (c->keyid, "missing")) {
134                      if( agent_get_cache( c->keyid, &item ) )                                          if (agent_get_cache (c->keyid, &item))
135                          agent_unlock_cache_entry( &item );                          agent_unlock_cache_entry (&item);
136                      else                      else
137                          agent_put_cache( c->keyid, c->pwd, reg_prefs.cache_time );                          agent_put_cache (c->keyid, c->pwd, reg_prefs.cache_time);
138                  }                  }
139                  EndDialog( dlg, TRUE );                  EndDialog (dlg, TRUE);
140                  return TRUE;                  return TRUE;
141                                    
142              case IDCANCEL:              case IDCANCEL:
143                  SetDlgItemText( dlg, item_ctrl_id( c->gpg_cmd ), ""  );                  SetDlgItemText (dlg, item_ctrl_id (c->gpg_cmd), "" );
144                  c->cancel = 1;                  c->cancel = 1;
145                  EndDialog( dlg, FALSE );                  EndDialog (dlg, FALSE);
146                  return FALSE;                  return FALSE;
147              }              }
148              break;              break;

Legend:
Removed from v.3  
changed lines
  Added in v.4

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26