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

Diff of /trunk/Src/wptKeyCache.cpp

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

revision 147 by twoaday, Fri Jan 13 14:21:16 2006 UTC revision 150 by twoaday, Wed Jan 18 11:52:45 2006 UTC
# Line 503  keycache_reload_photo (gpg_keycache_t ct Line 503  keycache_reload_photo (gpg_keycache_t ct
503    
504  /* Return the next key which was updated. Before it is  /* Return the next key which was updated. Before it is
505     returned the update flag is cleared.     returned the update flag is cleared.
506       @r_status is 1 for a new key and 2 for an updated key.
507     Return value: 0 on success. */     Return value: 0 on success. */
508  gpgme_error_t  gpgme_error_t
509  gpg_keycache_next_updated_key (gpg_keycache_t ctx,  gpg_keycache_next_updated_key (gpg_keycache_t ctx,
510                                 struct keycache_s **r_obj)                                 struct keycache_s **r_obj,
511                                   int *r_status)
512  {  {
513      struct keycache_s *c;      struct keycache_s *c;
514    
515      for (c = ctx->item; c; c = c->next) {      for (c = ctx->item; c; c = c->next) {
516          if (c->flags == 1) {          if (c->flags != 0) {
517                *r_status = c->flags;
518              c->flags = 0;              c->flags = 0;
519              *r_obj = c;              *r_obj = c;
520              return 0;              return 0;
# Line 535  gpg_keycache_update_key (gpg_keycache_t Line 538  gpg_keycache_update_key (gpg_keycache_t
538      err = gpgme_new (&gctx);      err = gpgme_new (&gctx);
539      if (err)      if (err)
540          return err;          return err;
541        gpgme_set_keylist_mode  (gctx, GPGME_KEYLIST_MODE_SIGS);
542      err = gpgme_get_key (gctx, keyid, &key, is_sec);      err = gpgme_get_key (gctx, keyid, &key, is_sec);
543      gpgme_release (gctx);      gpgme_release (gctx);
544      if (err)      if (err)
# Line 544  gpg_keycache_update_key (gpg_keycache_t Line 548  gpg_keycache_update_key (gpg_keycache_t
548          log_debug ("keycache update: keyid=%s %p\r\n", keyid, pub);          log_debug ("keycache update: keyid=%s %p\r\n", keyid, pub);
549          gpgme_key_release (fndkey);          gpgme_key_release (fndkey);
550          c->key = key;          c->key = key;
551          c->flags = 1;          c->flags = KC_FLAG_UPD;
552          if (is_sec && pub != NULL &&          if (is_sec && pub != NULL &&
553              !gpg_keycache_find_key (pub, keyid, 0, &fndkey)) {              !gpg_keycache_find_key (pub, keyid, 0, &fndkey)) {
554              log_debug ("keycache update: set public part %p\r\n", fndkey);              log_debug ("keycache update: set public part %p\r\n", fndkey);
# Line 568  gpg_keycache_update_key (gpg_keycache_t Line 572  gpg_keycache_update_key (gpg_keycache_t
572              }              }
573          }          }
574          if (c)          if (c)
575              c->flags = 1;              c->flags = KC_FLAG_ADD;
576      }      }
577      return 0;      return 0;
578  }  }
# Line 746  keycache_next_key (gpg_keycache_t ctx, i Line 750  keycache_next_key (gpg_keycache_t ctx, i
750          *r_key = NULL;          *r_key = NULL;
751          return gpg_error (GPG_ERR_EOF);          return gpg_error (GPG_ERR_EOF);
752      }      }
753            if (ctx->tmp->flags != 0)
754            ctx->tmp->flags = 0; /* reset the 'updated' status. */
755      *r_key = flags? ctx->tmp->pubpart->key : ctx->tmp->key;      *r_key = flags? ctx->tmp->pubpart->key : ctx->tmp->key;
756      *c = ctx->tmp = ctx->tmp->next;      *c = ctx->tmp = ctx->tmp->next;
757      ctx->pos++;      ctx->pos++;

Legend:
Removed from v.147  
changed lines
  Added in v.150

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26