32#ifndef __TDEPIM_KMAIL_KLEO_UTIL_H__
33#define __TDEPIM_KMAIL_KLEO_UTIL_H__
37static const Kleo::CryptoMessageFormat cryptoMessageFormats[] = {
39 Kleo::InlineOpenPGPFormat,
40 Kleo::OpenPGPMIMEFormat,
42 Kleo::SMIMEOpaqueFormat
44static const int numCryptoMessageFormats = sizeof cryptoMessageFormats / sizeof *cryptoMessageFormats ;
46static const Kleo::CryptoMessageFormat concreteCryptoMessageFormats[] = {
47 Kleo::OpenPGPMIMEFormat,
49 Kleo::SMIMEOpaqueFormat,
50 Kleo::InlineOpenPGPFormat
52static const unsigned int numConcreteCryptoMessageFormats
53 = sizeof concreteCryptoMessageFormats / sizeof *concreteCryptoMessageFormats ;
55static inline Kleo::CryptoMessageFormat cb2format( int idx ) {
56 return cryptoMessageFormats[ idx >= 0 && idx < numCryptoMessageFormats ? idx : 0 ];
59static inline int format2cb( Kleo::CryptoMessageFormat f ) {
60 for ( int i = 0 ; i < numCryptoMessageFormats ; ++i )
61 if ( f == cryptoMessageFormats[i] )
72static inline bool isSMIME( Kleo::CryptoMessageFormat f ) {
73 return f == Kleo::SMIMEFormat || f == Kleo::SMIMEOpaqueFormat ;
76static inline bool isOpenPGP( Kleo::CryptoMessageFormat f ) {
77 return f == Kleo::InlineOpenPGPFormat || f == Kleo::OpenPGPMIMEFormat ;
80static inline bool containsSMIME( unsigned int f ) {
81 return f & (Kleo::SMIMEFormat|Kleo::SMIMEOpaqueFormat) ;
84static inline bool containsOpenPGP( unsigned int f ) {
85 return f & (Kleo::OpenPGPMIMEFormat|Kleo::InlineOpenPGPFormat) ;
|