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

Diff of /trunk/Src/wptSigList.cpp

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

revision 139 by twoaday, Wed Jan 11 12:19:41 2006 UTC revision 208 by twoaday, Mon May 1 12:22:18 2006 UTC
# Line 26  Line 26 
26  #include <windows.h>  #include <windows.h>
27  #include <time.h>  #include <time.h>
28    
29    #include "resource.h"
30  #include "wptGPG.h"  #include "wptGPG.h"
31  #include "wptCommonCtl.h"  #include "wptCommonCtl.h"
32  #include "wptKeylist.h"  #include "wptKeylist.h"
33  #include "wptNLS.h"  #include "wptNLS.h"
 #include "wptUTF8.h"  
34  #include "wptErrors.h"  #include "wptErrors.h"
35  #include "wptTypes.h"  #include "wptTypes.h"
36  #include "wptW32API.h"  #include "wptW32API.h"
37    #include "wptVersion.h"
38    #include "wptContext.h"
39    
40    
41  /* Is the given signature an user-id signature? */  /* Is the given signature an user-id signature? */
# Line 43  Line 45 
45  /* Create a signature list control in @lv with the parent window  /* Create a signature list control in @lv with the parent window
46     given in @ctrl.     given in @ctrl.
47     Return value: 0 on success. */     Return value: 0 on success. */
48  static int  static void
49  siglist_build (listview_ctrl_t * lv, HWND ctrl)  siglist_build (listview_ctrl_t * lv, HWND ctrl)
50  {  {
51      struct listview_ctrl_s *c;      struct listview_ctrl_s *c;
# Line 56  siglist_build (listview_ctrl_t * lv, HWN Line 58  siglist_build (listview_ctrl_t * lv, HWN
58          {5,  68, (char *)_("Expiration")},          {5,  68, (char *)_("Expiration")},
59          {6,  56, (char *)_("Algorithm")},          {6,  56, (char *)_("Algorithm")},
60          {0,   0, NULL}          {0,   0, NULL}
61      };        };
62      int j, rc = 0;      int j;
63        
64      rc = listview_new (&c);      listview_new (&c, ctrl);
     if (rc)  
         return rc;  
     c->ctrl = ctrl;  
65      for  (j=0; implist[j].fieldname != NULL; j++)      for  (j=0; implist[j].fieldname != NULL; j++)
66          listview_add_column (c, &implist[j]);          listview_add_column (c, &implist[j]);
67      listview_set_ext_style (c);      listview_set_ext_style (c);
68        listview_del_all_items (c);
69      *lv = c;      *lv = c;
     return 0;  
70  }  }
71    
72    
# Line 119  add_keysig_item (listview_ctrl_t ctx, in Line 118  add_keysig_item (listview_ctrl_t ctx, in
118     control @lv.     control @lv.
119     Return value: 0 on success. */     Return value: 0 on success. */
120  static int  static int
121  siglist_add_key (listview_ctrl_t lv, gpgme_user_id_t uid,  siglist_add_key (listview_ctrl_t lv, struct native_uid_s *uid,
122                   gpgme_key_sig_t ks, int pos)                   gpgme_key_sig_t ks, int pos)
123  {  {
124      gpgme_key_t key=NULL;      struct winpt_key_s key;
125      char t[128];      char t[128];
126      const char *attr;      const char *attr;
127      const char *s;      const char *s;
# Line 138  siglist_add_key (listview_ctrl_t lv, gpg Line 137  siglist_add_key (listview_ctrl_t lv, gpg
137    
138      attr = NULL;      attr = NULL;
139      if (!uid) {      if (!uid) {
140          get_pubkey (ks->keyid, &key);          memset (&key, 0, sizeof (key));
141          if (key)          winpt_get_pubkey (ks->keyid, &key);
142              attr = key->uids->uid;          if (key.ext != NULL)
143                attr = key.ext->uids->uid;
144      }      }
145      else      else
146          attr = uid->uid;          attr = uid->uid;
147      if (attr && strlen (attr)) {      if (attr && strlen (attr)) {
148          char *uid_utf8 = utf8_to_wincp (attr, strlen (attr));          char *p = uid? m_strdup (attr) : indent_string (attr, 2);
         char *p = uid? m_strdup (uid_utf8) : indent_string (uid_utf8, 2);  
149          listview_add_sub_item (lv, pos, 0, p);          listview_add_sub_item (lv, pos, 0, p);
         free (uid_utf8);  
150          free_if_alloc (p);          free_if_alloc (p);
151      }      }
152      else {      else {
# Line 215  siglist_add_key (listview_ctrl_t lv, gpg Line 213  siglist_add_key (listview_ctrl_t lv, gpg
213  listview_ctrl_t  listview_ctrl_t
214  siglist_load (HWND ctrl, const char *keyid)  siglist_load (HWND ctrl, const char *keyid)
215  {      {    
     gpgme_key_t key;  
     gpgme_user_id_t u;  
216      gpgme_key_sig_t s;      gpgme_key_sig_t s;
217        struct native_uid_s *u;
218        winpt_key_s key;
219      listview_ctrl_t lv;      listview_ctrl_t lv;
220      int pos = 0;      int pos = 0;
221      int rc;      int rc = 0;
222    
223      if (siglist_build (&lv, ctrl))      siglist_build (&lv, ctrl);
224          BUG (NULL);      memset (&key, 0, sizeof (key));
225      rc = get_pubkey(keyid, &key);      if (winpt_get_pubkey (keyid, &key))
     if (rc)  
226          BUG (NULL);          BUG (NULL);
227    
228      for (u=key->uids; u; u = u->next) {      for (u=key.ext->uids; u; u = u->next) {
229          siglist_add_key (lv, u, NULL, pos++);          siglist_add_key (lv, u, NULL, pos++);
230          for (s = u->signatures; s; s = s->next) {          for (s = u->signatures; s; s = s->next) {
231              if (!IS_UID_CERT (s->sig_class))              if (!IS_UID_CERT (s->sig_class))

Legend:
Removed from v.139  
changed lines
  Added in v.208

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26