[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdepim/libkdenetwork/gpgmepp
From: Marc Mutz <Marc.Mutz () uni-bielefeld ! de>
Date: 2004-05-31 17:28:56
Message-ID: 20040531172856.DF823126E1 () office ! kde ! org
[Download RAW message or body]
CVS commit by mutz:
gpgme_key_t now provides it's own keylist_mode, so use it when available
A util.h 1.1 [GPL (v2+)]
M +1 -2 Makefile.am 1.7
M +11 -0 configure.in.in 1.13
M +3 -37 context.cpp 1.12
M +13 -1 key.cpp 1.12
--- kdepim/libkdenetwork/gpgmepp/Makefile.am #1.6:1.7
@@ -23,5 +23,5 @@
engineinfo.h
-noinst_HEADERS = context_p.h data_p.h shared.h callbacks.h gpgme-0-3-compat.h \
result_p.h +noinst_HEADERS = context_p.h data_p.h shared.h callbacks.h \
gpgme-0-3-compat.h result_p.h util.h
lib_LTLIBRARIES = libgpgme++.la
@@ -45,3 +45,2 @@
libgpgme___la_DEPENDENCIES = $(GPGME_LIBS_DEP)
-include ../../admin/Doxyfile.am
--- kdepim/libkdenetwork/gpgmepp/configure.in.in #1.12:1.13
@@ -111,4 +111,15 @@
AC_MSG_RESULT([no])
])
+
+ AC_MSG_CHECKING([if gpgme has gpgme_key_t->keylist_mode])
+ AC_TRY_COMPILE([#include <gpgme.h>], [
+ gpgme_key_t key = 0;
+ key->keylist_mode = 0;
+ ], [
+ AC_DEFINE(HAVE_GPGME_KEY_T_KEYLIST_MODE, 1, [Define to 1 if your \
gpgme's gpgme_key_t has the keylist_mode member]) + \
AC_MSG_RESULT([yes]) + ], [
+ AC_MSG_RESULT([no])
+ ])
CFLAGS="$kdepim_gpgmepp_save_cflags"
LIBS="$kdepim_gpgmepp_save_libs"
--- kdepim/libkdenetwork/gpgmepp/context.cpp #1.11:1.12
@@ -37,4 +37,5 @@
#include "data_p.h"
#include "context_p.h"
+#include "util.h"
#include <gpgme.h>
@@ -135,23 +137,4 @@ namespace GpgME {
}
- static inline gpgme_keylist_mode_t add_to_gpgme_keylist_mode_t( unsigned int \
oldmode, unsigned int newmodes ) {
- if ( newmodes & Context::Local ) oldmode |= GPGME_KEYLIST_MODE_LOCAL;
- if ( newmodes & Context::Extern ) oldmode |= GPGME_KEYLIST_MODE_EXTERN;
- if ( newmodes & Context::Signatures ) oldmode |= GPGME_KEYLIST_MODE_SIGS;
- if ( newmodes & Context::Validate ) {
-#ifdef HAVE_GPGME_KEYLIST_MODE_VALIDATE
- oldmode |= GPGME_KEYLIST_MODE_VALIDATE;
-#elif !defined(NDEBUG)
- std::cerr << "GpgME::Context: ignoring Valdidate keylist flag (gpgme too \
old)." << std::endl;
-#endif
- }
-#ifndef NDEBUG
- if ( newmodes & \
~(Context::Local|Context::Extern|Context::Signatures|Context::Validate) \
)
- cerr << "GpgME::Context: keylist mode must be one of Local, "
- "Extern, Signatures, or Validate, or a combination thereof!" << endl;
-#endif
- return static_cast<gpgme_keylist_mode_t>( oldmode );
- }
-
void Context::setKeyListMode( unsigned int mode ) {
gpgme_set_keylist_mode( d->ctx, add_to_gpgme_keylist_mode_t( 0, mode ) );
@@ -165,22 +148,5 @@ namespace GpgME {
unsigned int Context::keyListMode() const {
- const unsigned int cur = gpgme_get_keylist_mode( d->ctx );
- unsigned int result = 0;
- if ( cur & GPGME_KEYLIST_MODE_LOCAL ) result |= Local;
- if ( cur & GPGME_KEYLIST_MODE_EXTERN ) result |= Extern;
- if ( cur & GPGME_KEYLIST_MODE_SIGS ) result |= Signatures;
-#ifdef HAVE_GPGME_KEYLIST_MODE_VALIDATE
- if ( cur & GPGME_KEYLIST_MODE_VALIDATE ) result |= Validate;
-#endif
-#ifndef NDEBUG
- if ( cur & ~(GPGME_KEYLIST_MODE_LOCAL|
- GPGME_KEYLIST_MODE_EXTERN|
-#ifdef HAVE_GPGME_KEYLIST_MODE_VALIDATE
- GPGME_KEYLIST_MODE_VALIDATE|
-#endif
- GPGME_KEYLIST_MODE_SIGS) )
- std::cerr << "GpgME::Context: WARNING: gpgme_get_keylist_mode() returned an \
unknown flag!" << std::endl;
-#endif // NDEBUG
- return result;
+ return convert_from_gpgme_keylist_mode_t( gpgme_get_keylist_mode( d->ctx ) );
}
--- kdepim/libkdenetwork/gpgmepp/key.cpp #1.11:1.12
@@ -24,4 +24,6 @@
#include <gpgmepp/key.h>
+#include "util.h"
+
#include <gpgme.h>
@@ -36,5 +38,11 @@ namespace GpgME {
struct Key::Private {
Private( gpgme_key_t aKey, unsigned int aMode )
- : key( aKey ), mode( aMode ) {}
+ : key( aKey ),
+#ifdef HAVE_GPGME_KEY_T_KEYLIST_MODE
+ mode( 0 )
+#else
+ mode( aMode )
+#endif
+ {}
gpgme_key_t key;
unsigned int mode;
@@ -258,5 +266,9 @@ namespace GpgME {
unsigned int Key::keyListMode() const {
+#ifdef HAVE_GPGME_KEY_T_KEYLIST_MODE
+ return d->key ? convert_from_gpgme_keylist_mode_t( d->key->keylist_mode ) : 0 ;
+#else
return d ? d->mode : 0 ;
+#endif
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic