diff options
author | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-22 18:30:08 +0000 |
---|---|---|
committer | mataes2007 <mataes2007@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-11-22 18:30:08 +0000 |
commit | 4101ee8ff9bc818f40dc0173b1434761f187597f (patch) | |
tree | 15ace4a23c2d13b1c4b506a54887b1ec196ee007 /GnuPG/keys.cpp | |
parent | da1c34bde32e040a0a431ffb809c3b1e425dc558 (diff) |
added GnuPG
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@197 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'GnuPG/keys.cpp')
-rw-r--r-- | GnuPG/keys.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/GnuPG/keys.cpp b/GnuPG/keys.cpp new file mode 100644 index 0000000..d944927 --- /dev/null +++ b/GnuPG/keys.cpp @@ -0,0 +1,62 @@ +#include "gnupgplugin.h"
+
+typedef char tkeyuserid[keyuseridsize];
+
+tkeyuserid *keyuserids[2];
+int keyuseridcount[2];
+
+void initKeyUserIDs(const int atype)
+{
+ keyuseridcount[atype]=0;
+ keyuserids[atype]=NULL;
+}
+
+void updateKeyUserIDs(const int atype)
+{
+ char *pos;
+ gpgResult gpgresult;
+ char keyuserid[keyuseridsize];
+ char *buffer=NULL;
+
+ releaseKeyUserIDs(atype);
+ initKeyUserIDs(atype);
+
+ gpgresult=(atype==publickeyuserid)
+ ?gpgListPublicKeys(&buffer)
+ :gpgListSecretKeys(&buffer);
+
+ if (gpgresult!=gpgSuccess)
+ {
+ ErrorMessage(txterror,
+ (atype==publickeyuserid
+ ?txtlistpublickeysfailed
+ :txtlistsecretkeysfailed),
+ txtverifyoptions);
+ return;
+ }
+
+ for (pos=buffer; (pos=getNextPart(keyuserid,pos,txtcrlf)); )
+ {
+ keyuseridcount[atype]++;
+ keyuserids[atype]=(char(*)[512])
+ mir_realloc(keyuserids[atype],sizeof(tkeyuserid)*keyuseridcount[atype]);
+ strcpy(keyuserids[atype][keyuseridcount[atype]-1],keyuserid);
+ }
+
+ fnFALSE(&buffer);
+}
+
+void releaseKeyUserIDs(const int atype)
+{
+ mir_free(keyuserids[atype]);
+}
+
+char *getKeyUserID(const int atype, const int aindex)
+{
+ return keyuserids[atype][aindex];
+}
+
+int getKeyUserIDCount(const int atype)
+{
+ return keyuseridcount[atype];
+}
|