[Pkg-gnupg-commit] [gpgme] 263/412: Cpp: Add support for all EncryptionFlags

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit 17372393798ea5e2d6838f3dd1e001dd4a66c941
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Aug 9 13:07:30 2016 +0200

    Cpp: Add support for all EncryptionFlags
    
    * lang/cpp/src/context.h (EncryptionFlags): Extend.
    * lang/cpp/src/context.cpp (encryptflags2encryptflags): Ditto.
---
 lang/cpp/src/context.cpp | 17 +++++++++++++++++
 lang/cpp/src/context.h   | 10 +++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 814e5a8..d63573f 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -1094,6 +1094,18 @@ static gpgme_encrypt_flags_t encryptflags2encryptflags(Context::EncryptionFlags
     if (flags & Context::NoEncryptTo) {
         result |= GPGME_ENCRYPT_NO_ENCRYPT_TO;
     }
+    if (flags & Context::Prepare) {
+        result |= GPGME_ENCRYPT_PREPARE;
+    }
+    if (flags & Context::ExpectSign) {
+        result |= GPGME_ENCRYPT_EXPECT_SIGN;
+    }
+    if (flags & Context::NoCompress) {
+        result |= GPGME_ENCRYPT_NO_COMPRESS;
+    }
+    if (flags & Context::Symmetric) {
+        result |= GPGME_ENCRYPT_SYMMETRIC;
+    }
     return static_cast<gpgme_encrypt_flags_t>(result);
 }
 
@@ -1395,6 +1407,11 @@ std::ostream &operator<<(std::ostream &os, Context::EncryptionFlags flags)
     os << "GpgME::Context::EncryptionFlags(";
 #define CHECK( x ) if ( !(flags & (Context::x)) ) {} else do { os << #x " "; } while (0)
     CHECK(AlwaysTrust);
+    CHECK(NoEncryptTo);
+    CHECK(Prepare);
+    CHECK(ExpectSign);
+    CHECK(NoCompress);
+    CHECK(Symmetric);
 #undef CHECK
     return os << ')';
 }
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index c9c2af7..c7c0ecb 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -292,7 +292,15 @@ public:
     // Encryption
     //
 
-    enum EncryptionFlags { None = 0, AlwaysTrust = 1, NoEncryptTo = 2 };
+    enum EncryptionFlags {
+        None = 0,
+        AlwaysTrust = 1,
+        NoEncryptTo = 2,
+        Prepare = 4,
+        ExpectSign = 8,
+        NoCompress = 16,
+        Symmetric = 32
+    };
     EncryptionResult encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);
     GpgME::Error encryptSymmetrically(const Data &plainText, Data &cipherText);
     GpgME::Error startEncryption(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list