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

Diff of /trunk/Src/wptKeylist.cpp

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

revision 40 by werner, Thu Oct 27 15:25:13 2005 UTC revision 41 by twoaday, Fri Oct 28 07:15:26 2005 UTC
# Line 18  Line 18 
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   */   */
 #ifdef HAVE_CONFIG_H  
 #include <config.h>  
 #endif  
   
 #include <windows.h>  
21  #include <windows.h>  #include <windows.h>
22  #include <commctrl.h>  #include <commctrl.h>
23  #include <time.h>  #include <time.h>
# Line 221  get_key_algo (gpgme_key_t key, int keyid Line 216  get_key_algo (gpgme_key_t key, int keyid
216    
217    
218  const char*  const char*
219  get_key_created( long timestamp )  get_key_created (long timestamp)
220  {  {
221      static char timebuf[128];      static char timebuf[128];
222      struct tm *warp;      struct tm *warp;
# Line 235  get_key_created( long timestamp ) Line 230  get_key_created( long timestamp )
230  } /* get_key_created */  } /* get_key_created */
231    
232    
233    /* Return a string presentation of the time @timestamp. */
234  const char*  const char*
235  get_key_expire_date (long timestamp)  get_key_expire_date (long timestamp)
236  {  {
# Line 244  get_key_expire_date (long timestamp) Line 240  get_key_expire_date (long timestamp)
240      if( !timestamp )      if( !timestamp )
241          return _("Never");          return _("Never");
242      warp = localtime( &timestamp );      warp = localtime( &timestamp );
243      _snprintf( timebuf, sizeof timebuf -1, "%04d-%02d-%02d",      _snprintf (timebuf, sizeof timebuf -1, "%04d-%02d-%02d",
244                  warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday );                 warp->tm_year + 1900, warp->tm_mon + 1, warp->tm_mday);
245      return timebuf;      return timebuf;
246  } /* get_key_expire_date */  }
247    
248    
249  const char*  const char*
# Line 382  get_key_status (gpgme_key_t key, int uid Line 378  get_key_status (gpgme_key_t key, int uid
378      memset (fmt, 0, sizeof (fmt));      memset (fmt, 0, sizeof (fmt));
379      if (listmode) {      if (listmode) {
380          if (key->revoked)          if (key->revoked)
381              sprintf (fmt, "Revoked");              sprintf (fmt, _("Revoked"));
382          else if (key->expired)          else if (key->expired)
383              sprintf (fmt, "Expired");              sprintf (fmt, _("Expired"));
384          else if (key->disabled)          else if (key->disabled)
385              sprintf (fmt, "Disabled");              sprintf (fmt, _("Disabled"));
386          /* if the key has a special status, we don't continue to figure out          /* if the key has a special status, we don't continue to figure out
387             what any user-id validities. */             what any user-id validities. */
388          if (strlen (fmt) > 0)          if (strlen (fmt) > 0)
# Line 815  keylist_add_key (listview_ctrl_t lv, int Line 811  keylist_add_key (listview_ctrl_t lv, int
811      int uids, rc = 0, i, n = 0;      int uids, rc = 0, i, n = 0;
812      gpgme_subkey_t k;      gpgme_subkey_t k;
813    
814        /* if the entire key is disabled, just return. */
815        if (key->disabled)
816            return 0;
817    
818      for (k=key->subkeys, i = 0; i < count_subkeys (key); i++, k=k->next) {      for (k=key->subkeys, i = 0; i < count_subkeys (key); i++, k=k->next) {
819          if (k->invalid) {          if (k->invalid) {
820              log_debug ("keylist_add_key: invalid key \"%s\"\n", key->uids->name);              log_debug ("keylist_add_key: invalid key \"%s\"\n", key->uids->name);
# Line 853  keylist_add_key (listview_ctrl_t lv, int Line 853  keylist_add_key (listview_ctrl_t lv, int
853              }              }
854          }                }      
855          else if (mode & KEYLIST_SIGN) {          else if (mode & KEYLIST_SIGN) {
856              if ( k->can_sign              if (k->can_sign
857                  && find_secret_key( key )                  && find_secret_key (key)
858                  && key_is_useable (k))                  && key_is_useable (k)) {
             {  
859                  rc = do_addkey (lv, key, -1, i, -1);                  rc = do_addkey (lv, key, -1, i, -1);
860                  if( rc )                  if (rc)
861                      return rc;                        return rc;  
862              }              }
863          }                }      
# Line 1052  seclist_init (HWND dlg, int ctlid, int f Line 1051  seclist_init (HWND dlg, int ctlid, int f
1051      gpg_keycache_rewind (kc);      gpg_keycache_rewind (kc);
1052            
1053      while (!gpg_keycache_next_key (kc, 1, &key)) {      while (!gpg_keycache_next_key (kc, 1, &key)) {
1054          char * inf = NULL, * uid = NULL;          char *inf = NULL, *uid = NULL;
1055          const char * id;          const char *id;
1056          const char * keyid;          const char *keyid;
1057          int algo;          int algo;
1058          size_t size = 0;          size_t size = 0;
1059    
# Line 1065  seclist_init (HWND dlg, int ctlid, int f Line 1064  seclist_init (HWND dlg, int ctlid, int f
1064          keyid = key->subkeys->keyid;          keyid = key->subkeys->keyid;
1065          algo = key->subkeys->pubkey_algo;          algo = key->subkeys->pubkey_algo;
1066          if (!id || !keyid)          if (!id || !keyid)
1067              continue; /* fixme: error? */                    continue;
1068          if (!key_is_useable (key->subkeys))          if (key->disabled || !key_is_useable (key->subkeys))
1069              continue;              continue;
1070    
1071          uid = utf8_to_wincp (id, strlen (id));          uid = utf8_to_wincp (id, strlen (id));

Legend:
Removed from v.40  
changed lines
  Added in v.41

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26