diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2012-04-04 09:43:52 (GMT) |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2012-04-04 09:43:52 (GMT) |
commit | 5be9ac77cc026fe2435d4d82025c93764454f555 (patch) | |
tree | 05f967c0e2081cc5eb841493478fdd9bde41d45e /src/kolabcontact.h | |
parent | df09a3cd73cf73bcaac45a4dc3f23776d066a04e (diff) | |
download | libkolabxml-5be9ac77cc026fe2435d4d82025c93764454f555.tar.gz |
Use the more general and standards compliant key property also in the API.
Diffstat (limited to 'src/kolabcontact.h')
-rw-r--r-- | src/kolabcontact.h | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/kolabcontact.h b/src/kolabcontact.h index e4164dd..30d3814 100644 --- a/src/kolabcontact.h +++ b/src/kolabcontact.h @@ -212,26 +212,18 @@ struct Crypto { }; Crypto(): mCryptoTypes(0), mSignPref(Ask), mEncryptPref(Ask){}; bool operator==(const Crypto &other) const { return mCryptoTypes == other.mCryptoTypes && - mPGPKey == other.mPGPKey && - mSMIMEKey == other.mSMIMEKey && mSignPref == other.mSignPref && mEncryptPref == other.mEncryptPref; }; - bool isValid() const { return !(!mCryptoTypes && mPGPKey.empty() && mSMIMEKey.empty()); }; + bool isValid() const { return mCryptoTypes; }; void setAllowed(int cryptoTypes) { mCryptoTypes = cryptoTypes; }; int allowed() const { return mCryptoTypes; }; - void setPGPKey(const std::string &k) { mPGPKey = k; }; - std::string pgpKey() const { return mPGPKey; }; - void setSMIMEKey(const std::string &k) { mSMIMEKey = k; }; - std::string smimeKey() const { return mSMIMEKey; }; void setSignPref(CryptoPref p) { mSignPref = p; }; CryptoPref signPref() const { return mSignPref; }; void setEncryptPref(CryptoPref p) { mEncryptPref = p; }; CryptoPref encryptPref() const { return mEncryptPref; }; private: int mCryptoTypes; - std::string mPGPKey; - std::string mSMIMEKey; CryptoPref mSignPref; CryptoPref mEncryptPref; }; @@ -246,6 +238,26 @@ struct Geo { double longitude; }; +struct Key { + enum KeyType { + Invalid, + PGP, + PKCS7_MIME + }; + Key(): keytype(Invalid) {}; + Key(const std::string &k, KeyType type) + : mKey(k), keytype(type) {}; + + bool operator==(const Key &other) const{ return (mKey == other.mKey && keytype == other.keytype);}; + + KeyType type() const { return keytype; }; + std::string key() const { return mKey; }; + +private: + std::string mKey; + KeyType keytype; +}; + class DistList { public: @@ -364,6 +376,9 @@ public: void setGPSpos(const std::vector<Geo> &); std::vector<Geo> gpsPos() const; + void setKeys(const std::vector<Key> &); + std::vector<Key> keys() const; + void setCrypto(const Crypto &); Crypto crypto() const; |