COM-30 COM-24: Refactorings keysync
authorMarkus Schaber <markus@pep-security.net>
Mon, 03 Oct 2016 22:06:35 +0200
branchkeysync
changeset 172112b0fac353d
parent 171 44bfd5428aa9
child 173 91f9ce07e831
COM-30 COM-24: Refactorings
Adapt naming convention for Methods, Types and Enum members
Remove obsolete methods
Also defined new GUIDs for all types, which is also necessary for COM-29.
CpEpEngine.cpp
CpEpEngine.h
_IpEpEngineEvents_CP.h
pEpCOMServerAdapter.idl
pEpCOMServerAdapter.vcxproj
pEpCOMServerAdapter.vcxproj.filters
pEp_utility.cpp
pEp_utility.h
     1.1 --- a/CpEpEngine.cpp	Mon Oct 03 19:15:35 2016 +0200
     1.2 +++ b/CpEpEngine.cpp	Mon Oct 03 22:06:35 2016 +0200
     1.3 @@ -25,19 +25,19 @@
     1.4  
     1.5  #define FAIL(msg) error(msg)
     1.6  
     1.7 -STDMETHODIMP CpEpEngine::verbose_logging(VARIANT_BOOL enable)
     1.8 +STDMETHODIMP CpEpEngine::VerboseLogging(VARIANT_BOOL enable)
     1.9  {
    1.10  	verbose_mode = enable != VARIANT_FALSE;
    1.11  	return S_OK;
    1.12  }
    1.13  
    1.14 -STDMETHODIMP CpEpEngine::passive_mode(VARIANT_BOOL enable)
    1.15 +STDMETHODIMP CpEpEngine::PassiveMode(VARIANT_BOOL enable)
    1.16  {
    1.17  	::config_passive_mode(get_session(), enable != VARIANT_FALSE);
    1.18  	return S_OK;
    1.19  }
    1.20  
    1.21 -STDMETHODIMP CpEpEngine::unencrypted_subject(VARIANT_BOOL enable)
    1.22 +STDMETHODIMP CpEpEngine::UnencryptedSubject(VARIANT_BOOL enable)
    1.23  {
    1.24  	::config_unencrypted_subject(get_session(), enable != VARIANT_FALSE);
    1.25  	return S_OK;
    1.26 @@ -81,7 +81,7 @@
    1.27  }
    1.28  
    1.29  
    1.30 -STDMETHODIMP CpEpEngine::decrypt(BSTR ctext, BSTR * ptext, LPSAFEARRAY * key_list, pEp_STATUS * status)
    1.31 +STDMETHODIMP CpEpEngine::decrypt(BSTR ctext, BSTR * ptext, LPSAFEARRAY * key_list, pEpStatus * status)
    1.32  {
    1.33  	assert(ctext);
    1.34  	assert(ptext);
    1.35 @@ -110,7 +110,7 @@
    1.36  	if (_status == PEP_OUT_OF_MEMORY)
    1.37  		return E_OUTOFMEMORY;
    1.38  
    1.39 -	*status = (pEp_STATUS)_status;
    1.40 +	*status = (pEpStatus)_status;
    1.41  	if (_ptext == NULL) {
    1.42  		if (_keylist) {
    1.43  			string msg;
    1.44 @@ -145,7 +145,7 @@
    1.45  	return S_OK;
    1.46  }
    1.47  
    1.48 -STDMETHODIMP CpEpEngine::decrypt_b(BSTR ctext, LPSAFEARRAY * ptext, LPSAFEARRAY * key_list, pEp_STATUS * status)
    1.49 +STDMETHODIMP CpEpEngine::decrypt_b(BSTR ctext, LPSAFEARRAY * ptext, LPSAFEARRAY * key_list, pEpStatus * status)
    1.50  {
    1.51  	assert(ctext);
    1.52  	assert(ptext);
    1.53 @@ -185,7 +185,7 @@
    1.54  		::free_stringlist(_keylist);
    1.55  		return E_OUTOFMEMORY;
    1.56  	}
    1.57 -	*status = (pEp_STATUS)_status;
    1.58 +	*status = (pEpStatus)_status;
    1.59  
    1.60  	if (_ptext == NULL) {
    1.61  		::free_stringlist(_keylist);
    1.62 @@ -220,7 +220,7 @@
    1.63  	return S_OK;
    1.64  }
    1.65  
    1.66 -STDMETHODIMP CpEpEngine::verify(BSTR text, BSTR signature, LPSAFEARRAY * key_list, pEp_STATUS * verify_status)
    1.67 +STDMETHODIMP CpEpEngine::verify(BSTR text, BSTR signature, LPSAFEARRAY * key_list, pEpStatus * verify_status)
    1.68  {
    1.69  	assert(text);
    1.70  	assert(signature);
    1.71 @@ -241,7 +241,7 @@
    1.72  	if (_status == PEP_DECRYPT_WRONG_FORMAT || _status == PEP_UNKNOWN_ERROR)
    1.73  		return FAIL(L"verify_text");
    1.74  
    1.75 -	*verify_status = (pEp_STATUS)_status;
    1.76 +	*verify_status = (pEpStatus)_status;
    1.77  
    1.78  	if (_keylist && _keylist->value)
    1.79  		*key_list = string_array(_keylist);
    1.80 @@ -252,7 +252,7 @@
    1.81  	return S_OK;
    1.82  }
    1.83  
    1.84 -STDMETHODIMP CpEpEngine::encrypt(SAFEARRAY * key_list, BSTR ptext, BSTR * ctext, pEp_STATUS * status)
    1.85 +STDMETHODIMP CpEpEngine::encrypt(SAFEARRAY * key_list, BSTR ptext, BSTR * ctext, pEpStatus * status)
    1.86  {
    1.87  	assert(key_list);
    1.88  	assert(ptext);
    1.89 @@ -282,7 +282,7 @@
    1.90  	::free_stringlist(_keylist);
    1.91  	if (_status == PEP_OUT_OF_MEMORY)
    1.92  		return E_OUTOFMEMORY;
    1.93 -	*status = (pEp_STATUS)_status;
    1.94 +	*status = (pEpStatus)_status;
    1.95  
    1.96  	if (_ctext == NULL)
    1.97  		return FAIL(L"encrypt_and_sign");
    1.98 @@ -293,7 +293,7 @@
    1.99  	return S_OK;
   1.100  }
   1.101  
   1.102 -STDMETHODIMP CpEpEngine::encrypt_b(SAFEARRAY * key_list, SAFEARRAY * ptext, BSTR * ctext, pEp_STATUS * status)
   1.103 +STDMETHODIMP CpEpEngine::encrypt_b(SAFEARRAY * key_list, SAFEARRAY * ptext, BSTR * ctext, pEpStatus * status)
   1.104  {
   1.105  	assert(key_list);
   1.106  	assert(ptext);
   1.107 @@ -321,12 +321,12 @@
   1.108  	::free_stringlist(_keylist);
   1.109  	if (_status == PEP_OUT_OF_MEMORY)
   1.110  		return E_OUTOFMEMORY;
   1.111 -	*status = (pEp_STATUS)_status;
   1.112 +	*status = (pEpStatus)_status;
   1.113  
   1.114  	if (_ctext == NULL)
   1.115  		return FAIL(L"encrypt_and_sign");
   1.116  
   1.117 -	*status = (pEp_STATUS)_status;
   1.118 +	*status = (pEpStatus)_status;
   1.119  	wchar_t *w_ctext = NULL;
   1.120  	int w_csize = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, _ctext, _csize, NULL, 0);
   1.121  	if (w_csize) {
   1.122 @@ -389,7 +389,7 @@
   1.123  	}
   1.124  }
   1.125  
   1.126 -STDMETHODIMP CpEpEngine::trustwords(BSTR fpr, BSTR lang, LONG max_words, BSTR * words)
   1.127 +STDMETHODIMP CpEpEngine::TrustWords(BSTR fpr, BSTR lang, LONG max_words, BSTR * words)
   1.128  {
   1.129  	assert(fpr);
   1.130  	assert(max_words >= 0);
   1.131 @@ -435,7 +435,7 @@
   1.132  
   1.133  	if (_words == NULL) {
   1.134  		*words = NULL;
   1.135 -		return FAIL(L"trustwords");
   1.136 +		return FAIL(L"TrustWords");
   1.137  	}
   1.138  	else {
   1.139  		*words = utf16_bstr(_words);
   1.140 @@ -444,7 +444,7 @@
   1.141  	}
   1.142  }
   1.143  
   1.144 -STDMETHODIMP CpEpEngine::get_crashdump_log(LONG maxlines, BSTR * log)
   1.145 +STDMETHODIMP CpEpEngine::GetCrashdumpLog(LONG maxlines, BSTR * log)
   1.146  {
   1.147  	assert(maxlines >= 0);
   1.148  	assert(log);
   1.149 @@ -458,14 +458,14 @@
   1.150  	if (status == PEP_OUT_OF_MEMORY)
   1.151  		return E_OUTOFMEMORY;
   1.152  	if (status != PEP_STATUS_OK || _log == NULL)
   1.153 -		return FAIL(L"get_crashdump_log");
   1.154 +		return FAIL(L"GetCrashdumpLog");
   1.155  
   1.156  	*log = utf16_bstr(_log);
   1.157  	pEp_free(_log);
   1.158  	return S_OK;
   1.159  }
   1.160  
   1.161 -STDMETHODIMP CpEpEngine::get_engine_version(BSTR * engine_version)
   1.162 +STDMETHODIMP CpEpEngine::GetEngineVersion(BSTR * engine_version)
   1.163  {
   1.164  	assert(engine_version);
   1.165  
   1.166 @@ -475,14 +475,14 @@
   1.167  	const char *_enginge_version = ::get_engine_version();
   1.168  
   1.169  	if (_enginge_version == NULL)
   1.170 -		return FAIL(L"get_engine_version");
   1.171 +		return FAIL(L"GetEngineVersion");
   1.172  
   1.173  	*engine_version = utf16_bstr(_enginge_version);
   1.174  
   1.175  	return S_OK;
   1.176  }
   1.177  
   1.178 -STDMETHODIMP CpEpEngine::get_languagelist(BSTR * languages)
   1.179 +STDMETHODIMP CpEpEngine::GetLanguagelist(BSTR * languages)
   1.180  {
   1.181  	assert(languages);
   1.182  
   1.183 @@ -495,7 +495,7 @@
   1.184  	if (status == PEP_OUT_OF_MEMORY)
   1.185  		return E_OUTOFMEMORY;
   1.186  	if (status != PEP_STATUS_OK || _languages == NULL)
   1.187 -		return FAIL(L"get_languagelist");
   1.188 +		return FAIL(L"GetLanguagelist");
   1.189  
   1.190  	*languages = utf16_bstr(_languages);
   1.191  	pEp_free(_languages);
   1.192 @@ -527,7 +527,7 @@
   1.193  	return S_OK;
   1.194  }
   1.195  
   1.196 -STDMETHODIMP CpEpEngine::get_identity(BSTR address, BSTR user_id, pEp_identity_s * ident)
   1.197 +STDMETHODIMP CpEpEngine::get_identity(BSTR address, BSTR user_id, pEpIdentity * ident)
   1.198  {
   1.199  	assert(address);
   1.200  	assert(user_id);
   1.201 @@ -559,7 +559,7 @@
   1.202  	return S_OK;
   1.203  }
   1.204  
   1.205 -STDMETHODIMP CpEpEngine::set_identity(pEp_identity_s * ident)
   1.206 +STDMETHODIMP CpEpEngine::set_identity(pEpIdentity * ident)
   1.207  {
   1.208  	assert(ident);
   1.209  	assert(ident->address);
   1.210 @@ -581,7 +581,7 @@
   1.211  		return S_OK;
   1.212  }
   1.213  
   1.214 -STDMETHODIMP CpEpEngine::generate_keypair(pEp_identity_s * ident, BSTR * fpr)
   1.215 +STDMETHODIMP CpEpEngine::generate_keypair(pEpIdentity * ident, BSTR * fpr)
   1.216  {
   1.217  	assert(ident);
   1.218  	assert(ident->address);
   1.219 @@ -647,7 +647,7 @@
   1.220  	if (status == PEP_OUT_OF_MEMORY)
   1.221  		return E_OUTOFMEMORY;
   1.222  
   1.223 -	if (status != pEp_STATUS_OK)
   1.224 +	if (status != pEpStatusOK)
   1.225  		return FAIL(L"import_key");
   1.226  	else
   1.227  		return S_OK;
   1.228 @@ -766,7 +766,7 @@
   1.229  		return S_OK;
   1.230  }
   1.231  
   1.232 -STDMETHODIMP CpEpEngine::start_keyserver_lookup()
   1.233 +STDMETHODIMP CpEpEngine::StartKeyserverLookup()
   1.234  {
   1.235  	if (identity_queue.load())
   1.236  		return S_OK;
   1.237 @@ -777,7 +777,7 @@
   1.238  	return S_OK;
   1.239  }
   1.240  
   1.241 -STDMETHODIMP CpEpEngine::stop_keyserver_lookup()
   1.242 +STDMETHODIMP CpEpEngine::StopKeyserverLookup()
   1.243  {
   1.244  	if (identity_queue.load() == NULL)
   1.245  		return S_OK;
   1.246 @@ -797,7 +797,7 @@
   1.247  	return S_OK;
   1.248  }
   1.249  
   1.250 -STDMETHODIMP CpEpEngine::examine_identity(pEp_identity_s * ident)
   1.251 +STDMETHODIMP CpEpEngine::examine_identity(pEpIdentity * ident)
   1.252  {
   1.253  	assert(ident);
   1.254  	if (ident == NULL)
   1.255 @@ -815,7 +815,7 @@
   1.256  	return S_OK;
   1.257  }
   1.258  
   1.259 -STDMETHODIMP CpEpEngine::myself(struct pEp_identity_s *ident, struct pEp_identity_s *result)
   1.260 +STDMETHODIMP CpEpEngine::Myself(struct pEpIdentity *ident, struct pEpIdentity *result)
   1.261  {
   1.262  	assert(ident);
   1.263  	assert(result);
   1.264 @@ -829,7 +829,7 @@
   1.265  		return E_OUTOFMEMORY;
   1.266  
   1.267  	// DEBUG CODE - REMOVE BEFORE RELEASE!
   1.268 -	// sync_handshake_result_s handshakeResult;
   1.269 +	// SyncHandshakeResult handshakeResult;
   1.270  	//
   1.271  	// HRESULT res = Fire_ShowHandshake(ident, result, &handshakeResult);
   1.272  	// 
   1.273 @@ -852,7 +852,7 @@
   1.274  	}
   1.275  }
   1.276  
   1.277 -STDMETHODIMP CpEpEngine::update_identity(struct pEp_identity_s *ident, struct pEp_identity_s *result)
   1.278 +STDMETHODIMP CpEpEngine::UpdateIdentity(struct pEpIdentity *ident, struct pEpIdentity *result)
   1.279  {
   1.280  	assert(ident);
   1.281  	assert(result);
   1.282 @@ -878,11 +878,11 @@
   1.283  		if (status == PEP_OUT_OF_MEMORY)
   1.284  			return E_OUTOFMEMORY;
   1.285  		else
   1.286 -			return FAIL(L"update_identity");
   1.287 +			return FAIL(L"UpdateIdentity");
   1.288  	}
   1.289  }
   1.290  
   1.291 -STDMETHODIMP CpEpEngine::key_mistrusted(struct pEp_identity_s *ident)
   1.292 +STDMETHODIMP CpEpEngine::KeyMistrusted(struct pEpIdentity *ident)
   1.293  {
   1.294  	::pEp_identity *_ident;
   1.295  
   1.296 @@ -913,7 +913,7 @@
   1.297  	return S_OK;
   1.298  }
   1.299  
   1.300 -STDMETHODIMP CpEpEngine::key_reset_trust(struct pEp_identity_s *ident)
   1.301 +STDMETHODIMP CpEpEngine::KeyResetTrust(struct pEpIdentity *ident)
   1.302  {
   1.303  	::pEp_identity *_ident;
   1.304  
   1.305 @@ -995,8 +995,8 @@
   1.306  	if (msg == NULL)
   1.307  		return PEP_ILLEGAL_VALUE;
   1.308  
   1.309 -	text_message _msg;
   1.310 -	memset(&_msg, 0, sizeof(text_message));
   1.311 +	TextMessage _msg;
   1.312 +	memset(&_msg, 0, sizeof(TextMessage));
   1.313  
   1.314  	text_message_from_C(&_msg, msg);
   1.315  	CpEpEngine *me = (CpEpEngine *)obj;
   1.316 @@ -1017,12 +1017,12 @@
   1.317  	if (!(self && partner))
   1.318  		return PEP_ILLEGAL_VALUE;
   1.319  
   1.320 -	pEp_identity_s _self;
   1.321 +	pEpIdentity _self;
   1.322  	copy_identity(&_self, self);
   1.323 -	pEp_identity_s _partner;
   1.324 +	pEpIdentity _partner;
   1.325  	copy_identity(&_partner, partner);
   1.326  	CpEpEngine *me = (CpEpEngine *)obj;
   1.327 -	sync_handshake_result_s _result;
   1.328 +	SyncHandshakeResult _result;
   1.329  	HRESULT r = me->Fire_ShowHandshake(&_self, &_partner, &_result);
   1.330  	assert(r == S_OK);
   1.331  	clear_identity_s(_self);
   1.332 @@ -1036,7 +1036,7 @@
   1.333  	return status;
   1.334  }
   1.335  
   1.336 -STDMETHODIMP CpEpEngine::blacklist_add(BSTR fpr)
   1.337 +STDMETHODIMP CpEpEngine::BlacklistAdd(BSTR fpr)
   1.338  {
   1.339  	assert(fpr);
   1.340  
   1.341 @@ -1049,7 +1049,7 @@
   1.342  	return S_OK;
   1.343  }
   1.344  
   1.345 -STDMETHODIMP CpEpEngine::blacklist_delete(BSTR fpr)
   1.346 +STDMETHODIMP CpEpEngine::BlacklistDelete(BSTR fpr)
   1.347  {
   1.348  	assert(fpr);
   1.349  
   1.350 @@ -1062,7 +1062,7 @@
   1.351  	return S_OK;
   1.352  }
   1.353  
   1.354 -STDMETHODIMP CpEpEngine::blacklist_is_listed(BSTR fpr, VARIANT_BOOL *listed)
   1.355 +STDMETHODIMP CpEpEngine::BlacklistIsListed(BSTR fpr, VARIANT_BOOL *listed)
   1.356  {
   1.357  	assert(fpr);
   1.358  	assert(listed);
   1.359 @@ -1078,7 +1078,7 @@
   1.360  	return S_OK;
   1.361  }
   1.362  
   1.363 -STDMETHODIMP CpEpEngine::blacklist_retrieve(SAFEARRAY **blacklist)
   1.364 +STDMETHODIMP CpEpEngine::BlacklistRetreive(SAFEARRAY **blacklist)
   1.365  {
   1.366  	assert(blacklist);
   1.367  
   1.368 @@ -1116,7 +1116,7 @@
   1.369  	return E_FAIL;
   1.370  }
   1.371  
   1.372 -STDMETHODIMP CpEpEngine::encrypt_message(text_message * src, text_message * dst, SAFEARRAY * extra, pEpEncryptFlags flags)
   1.373 +STDMETHODIMP CpEpEngine::EncryptMessage(TextMessage * src, TextMessage * dst, SAFEARRAY * extra, pEpEncryptFlags flags)
   1.374  {
   1.375  	assert(src);
   1.376  	assert(dst);
   1.377 @@ -1145,7 +1145,7 @@
   1.378  	return S_OK;
   1.379  }
   1.380  
   1.381 -STDMETHODIMP CpEpEngine::decrypt_message(text_message * src, text_message * dst, SAFEARRAY ** keylist, pEpDecryptFlags *flags, pEp_rating *rating)
   1.382 +STDMETHODIMP CpEpEngine::DecryptMessage(TextMessage * src, TextMessage * dst, SAFEARRAY ** keylist, pEpDecryptFlags *flags, pEpRating *rating)
   1.383  {
   1.384  	assert(src);
   1.385  	assert(dst);
   1.386 @@ -1153,7 +1153,7 @@
   1.387  	assert(rating);
   1.388  
   1.389  	*keylist = NULL;
   1.390 -	*rating = pEp_rating_undefined;
   1.391 +	*rating = pEpRatingUndefined;
   1.392  
   1.393  	::message *_src = text_message_to_C(src);
   1.394  	::message *msg_dst = NULL;
   1.395 @@ -1176,12 +1176,12 @@
   1.396  		free_stringlist(_keylist);
   1.397  	}
   1.398  
   1.399 -	*rating = (pEp_rating)_rating;
   1.400 +	*rating = (pEpRating)_rating;
   1.401  
   1.402  	return S_OK;
   1.403  }
   1.404  
   1.405 -STDMETHODIMP CpEpEngine::outgoing_message_rating(text_message *msg, pEp_rating * pVal)
   1.406 +STDMETHODIMP CpEpEngine::OutgoingMessageRating(TextMessage *msg, pEpRating * pVal)
   1.407  {
   1.408  	assert(msg);
   1.409  	assert(pVal);
   1.410 @@ -1193,11 +1193,11 @@
   1.411  	if (status != PEP_STATUS_OK)
   1.412  		return FAIL(L"cannot get message rating");
   1.413  
   1.414 -	*pVal = (pEp_rating)_rating;
   1.415 +	*pVal = (pEpRating)_rating;
   1.416  	return S_OK;
   1.417  }
   1.418  
   1.419 -STDMETHODIMP CpEpEngine::identity_rating(struct pEp_identity_s *ident, pEp_rating * pVal)
   1.420 +STDMETHODIMP CpEpEngine::IdentityRating(struct pEpIdentity *ident, pEpRating * pVal)
   1.421  {
   1.422  	::pEp_identity *_ident;
   1.423  
   1.424 @@ -1220,23 +1220,23 @@
   1.425  	if (status != PEP_STATUS_OK)
   1.426  		return FAIL(L"cannot get message color");
   1.427  
   1.428 -	*pVal = (pEp_rating)_rating;
   1.429 +	*pVal = (pEpRating)_rating;
   1.430  	return S_OK;
   1.431  }
   1.432  
   1.433 -STDMETHODIMP CpEpEngine::color_from_rating(pEp_rating rating, pEp_color * pVal)
   1.434 +STDMETHODIMP CpEpEngine::ColorFromRating(pEpRating rating, pEpColor * pVal)
   1.435  {
   1.436  	assert(pVal);
   1.437  
   1.438  	PEP_rating engineRating = (PEP_rating)rating;
   1.439  	PEP_color _color = ::color_from_rating(engineRating);
   1.440  
   1.441 -	*pVal = (pEp_color)_color;
   1.442 +	*pVal = (pEpColor)_color;
   1.443  
   1.444  	return S_OK;
   1.445  }
   1.446  
   1.447 -STDMETHODIMP CpEpEngine::trust_personal_key(struct pEp_identity_s *ident, struct pEp_identity_s *result)
   1.448 +STDMETHODIMP CpEpEngine::TrustPersonalKey(struct pEpIdentity *ident, struct pEpIdentity *result)
   1.449  {
   1.450  	::pEp_identity *_ident;
   1.451  
   1.452 @@ -1255,7 +1255,7 @@
   1.453  
   1.454  	if (verbose_mode) {
   1.455  		stringstream ss;
   1.456 -		ss << "trust_personal_key called with ";
   1.457 +		ss << "TrustPersonalKey called with ";
   1.458  		ss << utf8_string(ident->address);
   1.459  		ss << L": ";
   1.460  		ss << ident->comm_type;
   1.461 @@ -1282,7 +1282,7 @@
   1.462  	if (status == PEP_OUT_OF_MEMORY)
   1.463  		return E_OUTOFMEMORY;
   1.464  	else if (status != PEP_STATUS_OK)
   1.465 -		return FAIL(L"failure while executing trust_personal_key()");
   1.466 +		return FAIL(L"failure while executing TrustPersonalKey()");
   1.467  
   1.468  	return S_OK;
   1.469  }
   1.470 @@ -1426,7 +1426,7 @@
   1.471  
   1.472  // Event callbacks
   1.473  
   1.474 -STDMETHODIMP CpEpEngine::register_callbacks(IpEpEngineCallbacks* new_callbacks)
   1.475 +STDMETHODIMP CpEpEngine::RegisterCallbacks(IpEpEngineCallbacks* new_callbacks)
   1.476  {
   1.477  	callbacks cbs = get_callbacks();
   1.478  	vector<IpEpEngineCallbacks*>& vec = cbs;
   1.479 @@ -1438,7 +1438,7 @@
   1.480  	return S_OK;
   1.481  }
   1.482  
   1.483 -STDMETHODIMP CpEpEngine::unregister_callbacks(IpEpEngineCallbacks* obsolete_callbacks)
   1.484 +STDMETHODIMP CpEpEngine::UnregisterCallbacks(IpEpEngineCallbacks* obsolete_callbacks)
   1.485  {
   1.486  	callbacks cbs = get_callbacks();
   1.487  	vector<IpEpEngineCallbacks*>& vec = cbs;
   1.488 @@ -1488,7 +1488,7 @@
   1.489  
   1.490  }
   1.491  
   1.492 -HRESULT CpEpEngine::Fire_MessageToSend(text_message * msg)
   1.493 +HRESULT CpEpEngine::Fire_MessageToSend(TextMessage * msg)
   1.494  {
   1.495  	callbacks cbs = get_callbacks();
   1.496  	vector<IpEpEngineCallbacks*>& vec = cbs;
   1.497 @@ -1504,7 +1504,7 @@
   1.498  	return S_OK;
   1.499  }
   1.500  
   1.501 -HRESULT CpEpEngine::Fire_ShowHandshake(pEp_identity_s * self, pEp_identity_s * partner, sync_handshake_result_s * result)
   1.502 +HRESULT CpEpEngine::Fire_ShowHandshake(pEpIdentity * self, pEpIdentity * partner, SyncHandshakeResult * result)
   1.503  {
   1.504  	callbacks cbs = get_callbacks();
   1.505  	vector<IpEpEngineCallbacks*>& vec = cbs;
     2.1 --- a/CpEpEngine.h	Mon Oct 03 19:15:35 2016 +0200
     2.2 +++ b/CpEpEngine.h	Mon Oct 03 22:06:35 2016 +0200
     2.3 @@ -4,13 +4,11 @@
     2.4  #include "resource.h"       // main symbols
     2.5  
     2.6  #include "pEpComServerAdapter_i.h"
     2.7 -#include "_IpEpEngineEvents_CP.h"
     2.8  #include "locked_queue.hh"
     2.9  #include "utf8_helper.h"
    2.10  #include "pEp_utility.h"
    2.11  #include <queue>
    2.12  
    2.13 -
    2.14  #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
    2.15  #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
    2.16  #endif
    2.17 @@ -19,14 +17,64 @@
    2.18  using namespace utility;
    2.19  using namespace pEp::utility;
    2.20  
    2.21 +
    2.22 +// TODO: Remove this enum, it is not needed in the interface, but it currently is still used in the code which is
    2.23 +// not removed / reworked yet...
    2.24 +typedef enum pEpStatus {
    2.25 +     pEpStatusOK = 0,
    2.26 +
    2.27 +     pEp_INIT_CANNOT_LOAD_GPGME = 0x0110,
    2.28 +     pEp_INIT_GPGME_INIT_FAILED = 0x0111,
    2.29 +     pEp_INIT_NO_GPG_HOME = 0x0112,
    2.30 +     pEp_INIT_NETPGP_INIT_FAILED = 0x0113,
    2.31 +
    2.32 +     pEp_INIT_SQLITE3_WITHOUT_MUTEX = 0x0120,
    2.33 +     pEp_INIT_CANNOT_OPEN_DB = 0x0121,
    2.34 +     pEp_INIT_CANNOT_OPEN_SYSTEM_DB = 0x0122,
    2.35 +
    2.36 +     pEp_KEY_NOT_FOUND = 0x0201,
    2.37 +     pEp_KEY_HAS_AMBIG_NAME = 0x0202,
    2.38 +     pEp_GET_KEY_FAILED = 0x0203,
    2.39 +
    2.40 +     pEp_CANNOT_FIND_IDENTITY = 0x0301,
    2.41 +     pEp_CANNOT_SET_PERSON = 0x0381,
    2.42 +     pEp_CANNOT_SET_PGP_KEYPAIR = 0x0382,
    2.43 +     pEp_CANNOT_SET_IDENTITY = 0x0383,
    2.44 +     pEp_CANNOT_SET_TRUST = 0x0384,
    2.45 +
    2.46 +     pEp_UNENCRYPTED = 0x0400,
    2.47 +     pEp_VERIFIED = 0x0401,
    2.48 +     pEp_DECRYPTED = 0x0402,
    2.49 +     pEp_DECRYPTED_AND_VERIFIED = 0x0403,
    2.50 +     pEp_DECRYPT_WRONG_FORMAT = 0x0404,
    2.51 +     pEp_DECRYPT_NO_KEY = 0x0405,
    2.52 +     pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
    2.53 +     pEp_VERIFY_NO_KEY = 0x0407,
    2.54 +     pEp_VERIFIED_AND_TRUSTED = 0x0408,
    2.55 +     pEp_CANNOT_DECRYPT_UNKNOWN = 0x04ff,
    2.56 +
    2.57 +     pEp_TRUSTWORD_NOT_FOUND = 0x0501,
    2.58 +
    2.59 +     pEp_CANNOT_CREATE_KEY = 0x0601,
    2.60 +     pEp_CANNOT_SEND_KEY = 0x0602,
    2.61 +
    2.62 +     pEp_PHRASE_NOT_FOUND = 0x0701,
    2.63 +
    2.64 +     pEp_COMMIT_FAILED = 0xff01,
    2.65 +
    2.66 +     pEp_CANNOT_CREATE_TEMP_FILE = -5,
    2.67 +     pEp_ILLEGAL_VALUE = -4,
    2.68 +     pEp_BUFFER_TOO_SMALL = -3,
    2.69 +     pEp_OUT_OF_MEMORY = -2,
    2.70 +     pEp_UNKNOWN_ERROR = -1
    2.71 + } pEpStatus;
    2.72 +
    2.73  // CpEpEngine
    2.74  
    2.75  class ATL_NO_VTABLE CpEpEngine :
    2.76      public CComObjectRootEx<CComObjectThreadModel>,
    2.77  	public CComCoClass<CpEpEngine, &CLSID_pEpEngine>,
    2.78  	public ISupportErrorInfo,
    2.79 -	public IConnectionPointContainerImpl<CpEpEngine>,
    2.80 -	public CProxy_IpEpEngineEvents<CpEpEngine>,
    2.81  	public IpEpEngine
    2.82  {
    2.83  protected:
    2.84 @@ -45,7 +93,7 @@
    2.85      ~CpEpEngine()
    2.86      {
    2.87          stop_keysync();
    2.88 -        stop_keyserver_lookup();
    2.89 +        StopKeyserverLookup();
    2.90          ::unregister_sync_callbacks(m_session);
    2.91          ::log_event(m_session, "Shutdown", "pEp COM Adapter", NULL, NULL);
    2.92          ::release(m_session);
    2.93 @@ -58,12 +106,8 @@
    2.94  BEGIN_COM_MAP(CpEpEngine)
    2.95      COM_INTERFACE_ENTRY(IpEpEngine)
    2.96      COM_INTERFACE_ENTRY(ISupportErrorInfo)
    2.97 -    COM_INTERFACE_ENTRY(IConnectionPointContainer)
    2.98  END_COM_MAP()
    2.99  
   2.100 -BEGIN_CONNECTION_POINT_MAP(CpEpEngine)
   2.101 -	CONNECTION_POINT_ENTRY(__uuidof(_IpEpEngineEvents))
   2.102 -END_CONNECTION_POINT_MAP()
   2.103  // ISupportsErrorInfo
   2.104  	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
   2.105  
   2.106 @@ -181,25 +225,25 @@
   2.107  public:
   2.108      // runtime config of the adapter
   2.109  
   2.110 -    STDMETHOD(verbose_logging)(VARIANT_BOOL enable);
   2.111 +    STDMETHOD(VerboseLogging)(VARIANT_BOOL enable);
   2.112  
   2.113      // runtime config of the engine
   2.114  
   2.115 -    STDMETHOD(passive_mode)(VARIANT_BOOL enable);
   2.116 -    STDMETHOD(unencrypted_subject)(VARIANT_BOOL enable);
   2.117 +    STDMETHOD(PassiveMode)(VARIANT_BOOL enable);
   2.118 +    STDMETHOD(UnencryptedSubject)(VARIANT_BOOL enable);
   2.119  
   2.120      // basic API
   2.121  
   2.122      STDMETHOD(log)(BSTR title, BSTR entity, BSTR description, BSTR comment);
   2.123 -    STDMETHOD(decrypt)(BSTR ctext, BSTR * ptext, LPSAFEARRAY * key_list, pEp_STATUS * decrypt_status);
   2.124 -    STDMETHOD(decrypt_b)(BSTR ctext, LPSAFEARRAY * ptext, LPSAFEARRAY * key_list, pEp_STATUS * decrypt_status);
   2.125 -    STDMETHOD(encrypt)(SAFEARRAY * key_list, BSTR ptext, BSTR * ctext, pEp_STATUS * status);
   2.126 -    STDMETHOD(encrypt_b)(SAFEARRAY * key_list, SAFEARRAY * ptext, BSTR * ctext, pEp_STATUS * status);
   2.127 +    STDMETHOD(decrypt)(BSTR ctext, BSTR * ptext, LPSAFEARRAY * key_list, pEpStatus * decrypt_status);
   2.128 +    STDMETHOD(decrypt_b)(BSTR ctext, LPSAFEARRAY * ptext, LPSAFEARRAY * key_list, pEpStatus * decrypt_status);
   2.129 +    STDMETHOD(encrypt)(SAFEARRAY * key_list, BSTR ptext, BSTR * ctext, pEpStatus * status);
   2.130 +    STDMETHOD(encrypt_b)(SAFEARRAY * key_list, SAFEARRAY * ptext, BSTR * ctext, pEpStatus * status);
   2.131      STDMETHOD(trustword)(LONG value, BSTR lang, BSTR * word);
   2.132 -    STDMETHOD(trustwords)(BSTR fpr, BSTR lang, LONG max_words, BSTR * words);
   2.133 -    STDMETHOD(get_identity)(BSTR address, BSTR user_id, pEp_identity_s * ident);
   2.134 -    STDMETHOD(set_identity)(pEp_identity_s * ident);
   2.135 -    STDMETHOD(generate_keypair)(pEp_identity_s * ident, BSTR * fpr);
   2.136 +    STDMETHOD(TrustWords)(BSTR fpr, BSTR lang, LONG max_words, BSTR * words);
   2.137 +    STDMETHOD(get_identity)(BSTR address, BSTR user_id, pEpIdentity * ident);
   2.138 +    STDMETHOD(set_identity)(pEpIdentity * ident);
   2.139 +    STDMETHOD(generate_keypair)(pEpIdentity * ident, BSTR * fpr);
   2.140      STDMETHOD(delete_keypair)(BSTR fpr);
   2.141      STDMETHOD(import_key)(BSTR key_data);
   2.142      STDMETHOD(import_key_b)(SAFEARRAY * key_data);
   2.143 @@ -207,56 +251,56 @@
   2.144      STDMETHOD(recv_key)(BSTR pattern);
   2.145      STDMETHOD(find_keys)(BSTR pattern, LPSAFEARRAY * key_list);
   2.146      STDMETHOD(send_key)(BSTR pattern);
   2.147 -    STDMETHOD(get_crashdump_log)(LONG maxlines, BSTR * log);
   2.148 -    STDMETHOD(get_engine_version)(BSTR * engine_version);
   2.149 -    STDMETHOD(get_languagelist)(BSTR * languages);
   2.150 +    STDMETHOD(GetCrashdumpLog)(LONG maxlines, BSTR * log);
   2.151 +    STDMETHOD(GetEngineVersion)(BSTR * engine_version);
   2.152 +    STDMETHOD(GetLanguagelist)(BSTR * languages);
   2.153      STDMETHOD(get_phrase)(BSTR lang, LONG phrase_id, BSTR * phrase);
   2.154  
   2.155      // keymanagement API
   2.156  
   2.157 -    STDMETHOD(start_keyserver_lookup)();
   2.158 -    STDMETHOD(stop_keyserver_lookup)();
   2.159 +    STDMETHOD(StartKeyserverLookup)();
   2.160 +    STDMETHOD(StopKeyserverLookup)();
   2.161  
   2.162 -    STDMETHOD(examine_identity)(pEp_identity_s * ident);
   2.163 -    STDMETHOD(verify)(BSTR text, BSTR signature, LPSAFEARRAY * key_list, pEp_STATUS * verify_status);
   2.164 -    STDMETHOD(myself)(struct pEp_identity_s *ident, struct pEp_identity_s *result);
   2.165 -    STDMETHOD(update_identity)(struct pEp_identity_s *ident, struct pEp_identity_s *result);
   2.166 -    STDMETHOD(key_mistrusted)(struct pEp_identity_s *ident);
   2.167 -    STDMETHOD(key_reset_trust)(struct pEp_identity_s *ident);
   2.168 -    STDMETHOD(trust_personal_key)(struct pEp_identity_s *ident, struct pEp_identity_s *result);
   2.169 +    STDMETHOD(examine_identity)(pEpIdentity * ident);
   2.170 +    STDMETHOD(verify)(BSTR text, BSTR signature, LPSAFEARRAY * key_list, pEpStatus * verify_status);
   2.171 +    STDMETHOD(Myself)(struct pEpIdentity *ident, struct pEpIdentity *result);
   2.172 +    STDMETHOD(UpdateIdentity)(struct pEpIdentity *ident, struct pEpIdentity *result);
   2.173 +    STDMETHOD(KeyMistrusted)(struct pEpIdentity *ident);
   2.174 +    STDMETHOD(KeyResetTrust)(struct pEpIdentity *ident);
   2.175 +    STDMETHOD(TrustPersonalKey)(struct pEpIdentity *ident, struct pEpIdentity *result);
   2.176  
   2.177  
   2.178      // Blacklist API
   2.179  
   2.180 -    STDMETHOD(blacklist_add)(BSTR fpr);
   2.181 -    STDMETHOD(blacklist_delete)(BSTR fpr);
   2.182 -    STDMETHOD(blacklist_is_listed)(BSTR fpr, VARIANT_BOOL *listed);
   2.183 -    STDMETHOD(blacklist_retrieve)(SAFEARRAY **blacklist);
   2.184 +    STDMETHOD(BlacklistAdd)(BSTR fpr);
   2.185 +    STDMETHOD(BlacklistDelete)(BSTR fpr);
   2.186 +    STDMETHOD(BlacklistIsListed)(BSTR fpr, VARIANT_BOOL *listed);
   2.187 +    STDMETHOD(BlacklistRetreive)(SAFEARRAY **blacklist);
   2.188  
   2.189      // Message API
   2.190  
   2.191 -    STDMETHOD(encrypt_message)(text_message * src, text_message * dst, SAFEARRAY * extra, pEpEncryptFlags flags);
   2.192 -    STDMETHOD(decrypt_message)(text_message * src, text_message * dst, SAFEARRAY ** keylist, pEpDecryptFlags* flags, pEp_rating *rating);
   2.193 -    STDMETHOD(outgoing_message_rating)(text_message *msg, pEp_rating * pVal);
   2.194 -    STDMETHOD(identity_rating)(pEp_identity_s * ident, pEp_rating * pVal);
   2.195 -	STDMETHOD(color_from_rating)(pEp_rating rating, pEp_color * pVal);
   2.196 +    STDMETHOD(EncryptMessage)(TextMessage * src, TextMessage * dst, SAFEARRAY * extra, pEpEncryptFlags flags);
   2.197 +    STDMETHOD(DecryptMessage)(TextMessage * src, TextMessage * dst, SAFEARRAY ** keylist, pEpDecryptFlags* flags, pEpRating *rating);
   2.198 +    STDMETHOD(OutgoingMessageRating)(TextMessage *msg, pEpRating * pVal);
   2.199 +    STDMETHOD(IdentityRating)(pEpIdentity * ident, pEpRating * pVal);
   2.200 +	STDMETHOD(ColorFromRating)(pEpRating rating, pEpColor * pVal);
   2.201  
   2.202  	// Event callbacks
   2.203  
   2.204 -	STDMETHOD(register_callbacks)(IpEpEngineCallbacks *new_callback);
   2.205 -	STDMETHOD(unregister_callbacks)(IpEpEngineCallbacks *obsolete_callback);
   2.206 +	STDMETHOD(RegisterCallbacks)(IpEpEngineCallbacks *new_callback);
   2.207 +	STDMETHOD(UnregisterCallbacks)(IpEpEngineCallbacks *obsolete_callback);
   2.208  
   2.209      // PGP compatibility functions
   2.210      STDMETHOD(OpenPGP_list_keyinfo)(BSTR search_pattern, LPSAFEARRAY* keyinfo_list);
   2.211  
   2.212  protected:
   2.213  	HRESULT Fire_MessageToSend(
   2.214 -		/* [in] */ struct text_message *msg);
   2.215 +		/* [in] */ struct TextMessage *msg);
   2.216  
   2.217  	HRESULT Fire_ShowHandshake(
   2.218 -		/* [in] */ struct pEp_identity_s *self,
   2.219 -		/* [in] */ struct pEp_identity_s *partner,
   2.220 -		/* [retval][out] */ sync_handshake_result_s *result);
   2.221 +		/* [in] */ struct pEpIdentity *self,
   2.222 +		/* [in] */ struct pEpIdentity *partner,
   2.223 +		/* [retval][out] */ SyncHandshakeResult *result);
   2.224  };
   2.225  
   2.226  OBJECT_ENTRY_AUTO(__uuidof(pEpEngine), CpEpEngine)
     3.1 --- a/_IpEpEngineEvents_CP.h	Mon Oct 03 19:15:35 2016 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,40 +0,0 @@
     3.4 -#pragma once
     3.5 -
     3.6 -template<class T>
     3.7 -class CProxy_IpEpEngineEvents :
     3.8 -	public ATL::IConnectionPointImpl<T, &__uuidof(_IpEpEngineEvents)>
     3.9 -{
    3.10 -public:
    3.11 -
    3.12 -	/* Test code - remove before shipping 
    3.13 -	HRESULT Fire_TestEvent(LONG test, BSTR testtest)
    3.14 -	{
    3.15 -		HRESULT hr = S_OK;
    3.16 -		T * pThis = static_cast<T *>(this);
    3.17 -		int cConnections = m_vec.GetSize();
    3.18 -
    3.19 -		for (int iConnection = 0; iConnection < cConnections; iConnection++)
    3.20 -		{
    3.21 -			pThis->Lock();
    3.22 -			CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
    3.23 -			pThis->Unlock();
    3.24 -
    3.25 -			IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p);
    3.26 -
    3.27 -			if (pConnection)
    3.28 -			{
    3.29 -				CComVariant avarParams[2];
    3.30 -				avarParams[1] = test;
    3.31 -				avarParams[1].vt = VT_I4;
    3.32 -				avarParams[0] = testtest;
    3.33 -				avarParams[0].vt = VT_BSTR;
    3.34 -				CComVariant varResult;
    3.35 -
    3.36 -				DISPPARAMS params = { avarParams, NULL, 2, 0 };
    3.37 -				hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &params, &varResult, NULL, NULL);
    3.38 -			}
    3.39 -		}
    3.40 -		return hr;
    3.41 -	}*/
    3.42 -};
    3.43 -
     4.1 --- a/pEpCOMServerAdapter.idl	Mon Oct 03 19:15:35 2016 +0200
     4.2 +++ b/pEpCOMServerAdapter.idl	Mon Oct 03 22:06:35 2016 +0200
     4.3 @@ -7,29 +7,29 @@
     4.4  import "oaidl.idl";
     4.5  import "ocidl.idl";
     4.6  
     4.7 -
     4.8 -typedef enum _sync_handshake_result_s {
     4.9 -	SYNC_HANDSHAKE_CANCEL_S = -1,
    4.10 -	SYNC_HANDSHAKE_ACCEPTED_S = 0,
    4.11 -	SYNC_HANDSHAKE_REJECTED_S = 1
    4.12 -} sync_handshake_result_s;
    4.13 -
    4.14  [
    4.15  	object,
    4.16 -	uuid(3BA1B15B-27EF-433C-B780-0D08F46B0FF3),
    4.17 +	uuid(4DA92647-A858-448E-B01F-BE4DCB8C86A1),
    4.18  	oleautomation,
    4.19  	nonextensible,
    4.20  	pointer_default(unique)
    4.21  ]
    4.22  interface IpEpEngineCallbacks : IUnknown {
    4.23 -	[id(1)] HRESULT MessageToSend([in] struct text_message * msg);
    4.24 -	[id(2)] HRESULT ShowHandshake([in] struct pEp_identity_s * self, [in] struct pEp_identity_s * partner, [out, retval] sync_handshake_result_s * result);
    4.25 +
    4.26 +    typedef [v1_enum] enum SyncHandshakeResult {
    4.27 +	    SyncHandshakeCancel = -1,
    4.28 +	    SyncHandshakeAccepted = 0,
    4.29 +	    SyncHandshakeRejected = 1
    4.30 +    } SyncHandshakeResult;
    4.31 +
    4.32 +	[id(1)] HRESULT MessageToSend([in] struct TextMessage * msg);
    4.33 +	[id(2)] HRESULT ShowHandshake([in] struct pEpIdentity * self, [in] struct pEpIdentity * partner, [out, retval] SyncHandshakeResult * result);
    4.34  };
    4.35  
    4.36  
    4.37  [
    4.38      object,
    4.39 -    uuid(9A9F4422-CF0A-45D7-90CD-1D1B7B2A4540),
    4.40 +    uuid(045E49AF-0975-4876-A53B-8CA5AB28C0F8),
    4.41      oleautomation,
    4.42      nonextensible,
    4.43      pointer_default(unique)
    4.44 @@ -37,202 +37,203 @@
    4.45  interface IpEpEngine : IUnknown {
    4.46      // runtime config of the adapter
    4.47  
    4.48 -    HRESULT verbose_logging([in] VARIANT_BOOL enable);
    4.49 +    HRESULT VerboseLogging([in] VARIANT_BOOL enable);
    4.50  
    4.51      // runtime config of the engine
    4.52  
    4.53 -    HRESULT passive_mode([in] VARIANT_BOOL enable);
    4.54 -    HRESULT unencrypted_subject([in] VARIANT_BOOL enable);
    4.55 +    HRESULT PassiveMode([in] VARIANT_BOOL enable);
    4.56 +    HRESULT UnencryptedSubject([in] VARIANT_BOOL enable);
    4.57  
    4.58      // basic API
    4.59  
    4.60 -    typedef enum _pEp_STATUS {
    4.61 -        pEp_STATUS_OK = 0,
    4.62 +   // // TODO: Remove this enum, it is not needed in the interface, but it currently is still used in the code...
    4.63 +   //typedef [v1_enum] enum pEpStatus {
    4.64 +   //     pEpStatusOK = 0,
    4.65  
    4.66 -        pEp_INIT_CANNOT_LOAD_GPGME = 0x0110,
    4.67 -        pEp_INIT_GPGME_INIT_FAILED = 0x0111,
    4.68 -        pEp_INIT_NO_GPG_HOME = 0x0112,
    4.69 -        pEp_INIT_NETPGP_INIT_FAILED = 0x0113,
    4.70 +   //     pEp_INIT_CANNOT_LOAD_GPGME = 0x0110,
    4.71 +   //     pEp_INIT_GPGME_INIT_FAILED = 0x0111,
    4.72 +   //     pEp_INIT_NO_GPG_HOME = 0x0112,
    4.73 +   //     pEp_INIT_NETPGP_INIT_FAILED = 0x0113,
    4.74  
    4.75 -        pEp_INIT_SQLITE3_WITHOUT_MUTEX = 0x0120,
    4.76 -        pEp_INIT_CANNOT_OPEN_DB = 0x0121,
    4.77 -        pEp_INIT_CANNOT_OPEN_SYSTEM_DB = 0x0122,
    4.78 +   //     pEp_INIT_SQLITE3_WITHOUT_MUTEX = 0x0120,
    4.79 +   //     pEp_INIT_CANNOT_OPEN_DB = 0x0121,
    4.80 +   //     pEp_INIT_CANNOT_OPEN_SYSTEM_DB = 0x0122,
    4.81  
    4.82 -        pEp_KEY_NOT_FOUND = 0x0201,
    4.83 -        pEp_KEY_HAS_AMBIG_NAME = 0x0202,
    4.84 -        pEp_GET_KEY_FAILED = 0x0203,
    4.85 +   //     pEp_KEY_NOT_FOUND = 0x0201,
    4.86 +   //     pEp_KEY_HAS_AMBIG_NAME = 0x0202,
    4.87 +   //     pEp_GET_KEY_FAILED = 0x0203,
    4.88  
    4.89 -        pEp_CANNOT_FIND_IDENTITY = 0x0301,
    4.90 -        pEp_CANNOT_SET_PERSON = 0x0381,
    4.91 -        pEp_CANNOT_SET_PGP_KEYPAIR = 0x0382,
    4.92 -        pEp_CANNOT_SET_IDENTITY = 0x0383,
    4.93 -        pEp_CANNOT_SET_TRUST = 0x0384,
    4.94 +   //     pEp_CANNOT_FIND_IDENTITY = 0x0301,
    4.95 +   //     pEp_CANNOT_SET_PERSON = 0x0381,
    4.96 +   //     pEp_CANNOT_SET_PGP_KEYPAIR = 0x0382,
    4.97 +   //     pEp_CANNOT_SET_IDENTITY = 0x0383,
    4.98 +   //     pEp_CANNOT_SET_TRUST = 0x0384,
    4.99  
   4.100 -        pEp_UNENCRYPTED = 0x0400,
   4.101 -        pEp_VERIFIED = 0x0401,
   4.102 -        pEp_DECRYPTED = 0x0402,
   4.103 -        pEp_DECRYPTED_AND_VERIFIED = 0x0403,
   4.104 -        pEp_DECRYPT_WRONG_FORMAT = 0x0404,
   4.105 -        pEp_DECRYPT_NO_KEY = 0x0405,
   4.106 -        pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
   4.107 -        pEp_VERIFY_NO_KEY = 0x0407,
   4.108 -        pEp_VERIFIED_AND_TRUSTED = 0x0408,
   4.109 -        pEp_CANNOT_DECRYPT_UNKNOWN = 0x04ff,
   4.110 +   //     pEp_UNENCRYPTED = 0x0400,
   4.111 +   //     pEp_VERIFIED = 0x0401,
   4.112 +   //     pEp_DECRYPTED = 0x0402,
   4.113 +   //     pEp_DECRYPTED_AND_VERIFIED = 0x0403,
   4.114 +   //     pEp_DECRYPT_WRONG_FORMAT = 0x0404,
   4.115 +   //     pEp_DECRYPT_NO_KEY = 0x0405,
   4.116 +   //     pEp_DECRYPT_SIGNATURE_DOES_NOT_MATCH = 0x0406,
   4.117 +   //     pEp_VERIFY_NO_KEY = 0x0407,
   4.118 +   //     pEp_VERIFIED_AND_TRUSTED = 0x0408,
   4.119 +   //     pEp_CANNOT_DECRYPT_UNKNOWN = 0x04ff,
   4.120  
   4.121 -        pEp_TRUSTWORD_NOT_FOUND = 0x0501,
   4.122 +   //     pEp_TRUSTWORD_NOT_FOUND = 0x0501,
   4.123  
   4.124 -        pEp_CANNOT_CREATE_KEY = 0x0601,
   4.125 -        pEp_CANNOT_SEND_KEY = 0x0602,
   4.126 +   //     pEp_CANNOT_CREATE_KEY = 0x0601,
   4.127 +   //     pEp_CANNOT_SEND_KEY = 0x0602,
   4.128  
   4.129 -        pEp_PHRASE_NOT_FOUND = 0x0701,
   4.130 +   //     pEp_PHRASE_NOT_FOUND = 0x0701,
   4.131  
   4.132 -        pEp_COMMIT_FAILED = 0xff01,
   4.133 +   //     pEp_COMMIT_FAILED = 0xff01,
   4.134  
   4.135 -        pEp_CANNOT_CREATE_TEMP_FILE = -5,
   4.136 -        pEp_ILLEGAL_VALUE = -4,
   4.137 -        pEp_BUFFER_TOO_SMALL = -3,
   4.138 -        pEp_OUT_OF_MEMORY = -2,
   4.139 -        pEp_UNKNOWN_ERROR = -1
   4.140 -    } pEp_STATUS;
   4.141 +   //     pEp_CANNOT_CREATE_TEMP_FILE = -5,
   4.142 +   //     pEp_ILLEGAL_VALUE = -4,
   4.143 +   //     pEp_BUFFER_TOO_SMALL = -3,
   4.144 +   //     pEp_OUT_OF_MEMORY = -2,
   4.145 +   //     pEp_UNKNOWN_ERROR = -1
   4.146 +   // } pEpStatus;
   4.147  
   4.148 -    HRESULT log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
   4.149 -    HRESULT decrypt([in] BSTR ctext, [out] BSTR * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
   4.150 -    HRESULT decrypt_b([in] BSTR ctext, [out] SAFEARRAY(BYTE) * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * decrypt_status);
   4.151 -    HRESULT encrypt([in] SAFEARRAY(BSTR) key_list, [in] BSTR ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
   4.152 -    HRESULT encrypt_b([in] SAFEARRAY(BSTR) key_list, [in] SAFEARRAY(BYTE) ptext, [out] BSTR * ctext, [out, retval] pEp_STATUS * status);
   4.153 -    HRESULT verify([in] BSTR text, [in] BSTR signature, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEp_STATUS * verify_status);
   4.154 -    HRESULT trustword([in] LONG value, [in, defaultvalue("en")] BSTR lang, [out, retval] BSTR * word);
   4.155 -    HRESULT trustwords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG max_words, [out, retval] BSTR * words);
   4.156 -    HRESULT get_crashdump_log([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
   4.157 -    HRESULT get_engine_version([out, retval] BSTR * engine_version);
   4.158 -    HRESULT get_languagelist([out, retval] BSTR * languages);
   4.159 -    HRESULT get_phrase([in] BSTR lang, [in] LONG phrase_id, [out, retval] BSTR * phrase);
   4.160 +    // HRESULT log([in] BSTR title, [in] BSTR entity, [in, defaultvalue("")] BSTR description, [in, defaultvalue("")] BSTR comment);
   4.161 +    // HRESULT decrypt([in] BSTR ctext, [out] BSTR * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEpStatus * decrypt_status);
   4.162 +    // HRESULT decrypt_b([in] BSTR ctext, [out] SAFEARRAY(BYTE) * ptext, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEpStatus * decrypt_status);
   4.163 +    // HRESULT encrypt([in] SAFEARRAY(BSTR) key_list, [in] BSTR ptext, [out] BSTR * ctext, [out, retval] pEpStatus * status);
   4.164 +    // HRESULT encrypt_b([in] SAFEARRAY(BSTR) key_list, [in] SAFEARRAY(BYTE) ptext, [out] BSTR * ctext, [out, retval] pEpStatus * status);
   4.165 +    // HRESULT verify([in] BSTR text, [in] BSTR signature, [out] SAFEARRAY(BSTR) * key_list, [out, retval] pEpStatus * verify_status);
   4.166 +    // HRESULT trustword([in] LONG value, [in, defaultvalue("en")] BSTR lang, [out, retval] BSTR * word);
   4.167 +    HRESULT TrustWords([in] BSTR fpr, [in, defaultvalue("en")] BSTR lang, [in, defaultvalue(0)] LONG max_words, [out, retval] BSTR * words);
   4.168 +    HRESULT GetCrashdumpLog([in, defaultvalue(0)] LONG maxlines, [out, retval] BSTR * log);
   4.169 +    HRESULT GetEngineVersion([out, retval] BSTR * engine_version);
   4.170 +    HRESULT GetLanguagelist([out, retval] BSTR * languages);
   4.171 +    // HRESULT get_phrase([in] BSTR lang, [in] LONG phrase_id, [out, retval] BSTR * phrase);
   4.172  
   4.173 -    typedef enum _pEp_comm_type {
   4.174 -        pEp_ct_unknown = 0,
   4.175 +    typedef [v1_enum] enum pEpComType {
   4.176 +        pEpCtUnknown = 0,
   4.177  
   4.178          // range 0x01 to 0x09: no encryption, 0x0a to 0x0e: nothing reasonable
   4.179  
   4.180 -        pEp_ct_no_encryption = 0x01,                // generic
   4.181 -        pEp_ct_no_encrypted_channel = 0x02,
   4.182 -        pEp_ct_key_not_found = 0x03,
   4.183 -        pEp_ct_key_expired = 0x04,
   4.184 -        pEp_ct_key_revoked = 0x05,
   4.185 -        pEp_ct_key_b0rken = 0x06,
   4.186 -        pEp_ct_my_key_not_included = 0x09,
   4.187 +        pEpCtNoEncryption = 0x01,                // generic
   4.188 +        pEpCtNoEncryptedChannel = 0x02,
   4.189 +        pEpCtKeyNotFound = 0x03,
   4.190 +        pEpCtKeyExpired = 0x04,
   4.191 +        pEpCtKeyRevoked = 0x05,
   4.192 +        pEpCtKeyB0rken = 0x06,
   4.193 +        pEpCtMyKeyNotIncluded = 0x09,
   4.194  
   4.195 -        pEp_ct_security_by_obscurity = 0x0a,
   4.196 -        pEp_ct_b0rken_crypto = 0x0b,
   4.197 -        pEp_ct_key_too_short = 0x0c,
   4.198 +        pEpCtSecurityByObscurity = 0x0a,
   4.199 +        pEpCtB0rkenCrypto = 0x0b,
   4.200 +        pEpCtKeyTooShort = 0x0c,
   4.201  
   4.202 -        pEp_ct_compromized = 0x0e,                  // known compromized connection
   4.203 -        pEp_ct_mistrusted = 0x0f,                   // known mistrusted key
   4.204 +        pEpCtCompromised = 0x0e,                  // known compromized connection
   4.205 +        pEpCtMistrusted = 0x0f,                   // known mistrusted key
   4.206  
   4.207          // range 0x10 to 0x3f: unconfirmed encryption
   4.208  
   4.209 -        pEp_ct_unconfirmed_encryption = 0x10,       // generic
   4.210 -        pEp_ct_OpenPGP_weak_unconfirmed = 0x11,     // RSA 1024 is weak
   4.211 +        pEpCtUnconfirmedEncryption = 0x10,       // generic
   4.212 +        pEpCtOpenPGPWeakUnconfirmed = 0x11,     // RSA 1024 is weak
   4.213  
   4.214 -        pEp_ct_to_be_checked = 0x20,                // generic
   4.215 -        pEp_ct_SMIME_unconfirmed = 0x21,
   4.216 -        pEp_ct_CMS_unconfirmed = 0x22,
   4.217 +        pEpCtToBeChecked = 0x20,                // generic
   4.218 +        pEpCtSMIMEUnconfirmed = 0x21,
   4.219 +        pEpCtCMSUnconfirmed = 0x22,
   4.220  
   4.221 -        pEp_ct_strong_but_unconfirmed = 0x30,       // generic
   4.222 -        pEp_ct_OpenPGP_unconfirmed = 0x38,          // key at least 2048 bit RSA or EC
   4.223 -        pEp_ct_OTR_unconfirmed = 0x3a,
   4.224 +        pEpCtStrongButUnconfirmed = 0x30,       // generic
   4.225 +        pEpCtOpenPGPUnconfirmed = 0x38,          // key at least 2048 bit RSA or EC
   4.226 +        pEpCtOTRUnconfirmed = 0x3a,
   4.227  
   4.228          // range 0x40 to 0x7f: unconfirmed encryption and anonymization
   4.229  
   4.230 -        pEp_ct_unconfirmed_enc_anon = 0x40,         // generic
   4.231 -        pEp_ct_pEp_unconfirmed = 0x7f,
   4.232 +        pEpCtUnconfirmedEncAnon = 0x40,         // generic
   4.233 +        pEpCtpEpUnconfirmed = 0x7f,
   4.234  
   4.235 -        pEp_ct_confirmed = 0x80,                    // this bit decides if trust is confirmed
   4.236 +        pEpCtConfirmed = 0x80,                    // this bit decides if trust is confirmed
   4.237  
   4.238          // range 0x81 to 0x8f: reserved
   4.239          // range 0x90 to 0xbf: confirmed encryption
   4.240  
   4.241 -        pEp_ct_confirmed_encryption = 0x90,         // generic
   4.242 -        pEp_ct_OpenPGP_weak = 0x91,                 // RSA 1024 is weak
   4.243 +        pEpCtConfirmedEncryption = 0x90,         // generic
   4.244 +        pEpCtOpenPGPWeak = 0x91,                 // RSA 1024 is weak
   4.245  
   4.246 -        pEp_ct_to_be_checked_confirmed = 0xa0,      //generic
   4.247 -        pEp_ct_SMIME = 0xa1,
   4.248 -        pEp_ct_CMS = 0xa2,
   4.249 +        pEpCtToBeCheckedConfirmed = 0xa0,      //generic
   4.250 +        pEpCtSMIME = 0xa1,
   4.251 +        pEpCtCMS = 0xa2,
   4.252  
   4.253 -        pEp_ct_strong_encryption = 0xb0,            // generic
   4.254 -        pEp_ct_OpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
   4.255 -        pEp_ct_OTR = 0xba,
   4.256 +        pEpCtStrongEncryption = 0xb0,            // generic
   4.257 +        pEpCtOpenPGP = 0xb8,                      // key at least 2048 bit RSA or EC
   4.258 +        pEpCtOTR = 0xba,
   4.259  
   4.260          // range 0xc0 to 0xff: confirmed encryption and anonymization
   4.261  
   4.262 -        pEp_ct_confirmed_enc_anon = 0xc0,           // generic
   4.263 -        pEp_ct_pEp = 0xff
   4.264 -    } pEp_comm_type;
   4.265 +        pEpCtConfirmedEncAnon = 0xc0,           // generic
   4.266 +        pEpCtpEp = 0xff
   4.267 +    } pEpComType;
   4.268  
   4.269 -    [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEp_identity_s {
   4.270 +    [uuid(0CB90E62-8A6A-4CA0-99D7-481704051FF0)] struct pEpIdentity {
   4.271          BSTR address;
   4.272          BSTR fpr;
   4.273          BSTR user_id;
   4.274          BSTR username;
   4.275 -        pEp_comm_type comm_type;
   4.276 +        pEpComType comm_type;
   4.277          BSTR lang;
   4.278      };
   4.279  
   4.280 -    HRESULT get_identity([in] BSTR address, [in] BSTR user_id, [out, retval] struct pEp_identity_s * ident);
   4.281 -    HRESULT set_identity([in] struct pEp_identity_s * ident);
   4.282 -    HRESULT generate_keypair([in] struct pEp_identity_s * ident, [out, retval] BSTR * fpr);
   4.283 -    HRESULT delete_keypair([in] BSTR fpr);
   4.284 -    HRESULT import_key([in] BSTR key_data);
   4.285 -    HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
   4.286 -    HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
   4.287 -    HRESULT recv_key([in] BSTR pattern);
   4.288 -    HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
   4.289 -    HRESULT send_key([in] BSTR pattern);
   4.290 +    //HRESULT get_identity([in] BSTR address, [in] BSTR user_id, [out, retval] struct pEpIdentity * ident);
   4.291 +    //HRESULT set_identity([in] struct pEpIdentity * ident);
   4.292 +    //HRESULT generate_keypair([in] struct pEpIdentity * ident, [out, retval] BSTR * fpr);
   4.293 +    //HRESULT delete_keypair([in] BSTR fpr);
   4.294 +    //HRESULT import_key([in] BSTR key_data);
   4.295 +    //HRESULT import_key_b([in] SAFEARRAY(BYTE) key_data);
   4.296 +    //HRESULT export_key([in] BSTR fpr, [out, retval] BSTR * key_data);
   4.297 +    //HRESULT recv_key([in] BSTR pattern);
   4.298 +    //HRESULT find_keys([in] BSTR pattern, [out, retval] SAFEARRAY(BSTR) * key_list);
   4.299 +    //HRESULT send_key([in] BSTR pattern);
   4.300  
   4.301 -    HRESULT start_keyserver_lookup();
   4.302 -    HRESULT stop_keyserver_lookup();
   4.303 +    HRESULT StartKeyserverLookup();
   4.304 +    HRESULT StopKeyserverLookup();
   4.305  
   4.306 -    HRESULT examine_identity([in] struct pEp_identity_s * ident);
   4.307 -    HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   4.308 -    HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   4.309 -    HRESULT key_mistrusted([in] struct pEp_identity_s *ident);
   4.310 -    HRESULT key_reset_trust([in] struct pEp_identity_s *ident);
   4.311 -    HRESULT trust_personal_key([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   4.312 +    //HRESULT examine_identity([in] struct pEpIdentity * ident);
   4.313 +    HRESULT Myself([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   4.314 +    HRESULT UpdateIdentity([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   4.315 +    HRESULT KeyMistrusted([in] struct pEpIdentity *ident);
   4.316 +    HRESULT KeyResetTrust([in] struct pEpIdentity *ident);
   4.317 +    HRESULT TrustPersonalKey([in] struct pEpIdentity *ident, [out, retval] struct pEpIdentity *result);
   4.318  
   4.319      // Blacklist API
   4.320  
   4.321 -    HRESULT blacklist_add([in] BSTR fpr);
   4.322 -    HRESULT blacklist_delete([in] BSTR fpr);
   4.323 -    HRESULT blacklist_is_listed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
   4.324 -    HRESULT blacklist_retrieve([out, retval] SAFEARRAY(BSTR) *blacklist);
   4.325 +    HRESULT BlacklistAdd([in] BSTR fpr);
   4.326 +    HRESULT BlacklistDelete([in] BSTR fpr);
   4.327 +    HRESULT BlacklistIsListed([in] BSTR fpr, [out, retval] VARIANT_BOOL *listed);
   4.328 +    HRESULT BlacklistRetreive([out, retval] SAFEARRAY(BSTR) *blacklist);
   4.329  
   4.330  	// PGP compatibility functions
   4.331  	HRESULT OpenPGP_list_keyinfo([in] BSTR search_pattern, [out, retval] SAFEARRAY(struct StringPair)* keyinfo_list);
   4.332  
   4.333      // Message API
   4.334  
   4.335 -	typedef enum _pEp_rating {
   4.336 -		pEp_rating_undefined = 0,
   4.337 -		pEp_rating_cannot_decrypt,
   4.338 -		pEp_rating_have_no_key,
   4.339 -		pEp_rating_unencrypted,
   4.340 -		pEp_rating_unencrypted_for_some,
   4.341 -		pEp_rating_unreliable,
   4.342 -		pEp_rating_reliable,
   4.343 -		pEp_rating_trusted,
   4.344 -		pEp_rating_trusted_and_anonymized,
   4.345 -		pEp_rating_fully_anonymous,
   4.346 +	typedef [v1_enum] enum pEpRating {
   4.347 +		pEpRatingUndefined = 0,
   4.348 +		pEpRatingCannotDecrypt,
   4.349 +		pEpRatingHaveNoKey,
   4.350 +		pEpRatingUnencrypted,
   4.351 +		pEpRatingUnencryptedForSome,
   4.352 +		pEpRatingUnreliable,
   4.353 +		pEpRatingReliable,
   4.354 +		pEpRatingTrusted,
   4.355 +		pEpRatingTrustedAndAnonymized,
   4.356 +		pEpRatingFullyAnonymous,
   4.357  
   4.358 -		pEp_rating_mistrust = -1,
   4.359 -		pEp_rating_b0rken = -2,
   4.360 -		pEp_rating_under_attack = -3
   4.361 -	} pEp_rating;
   4.362 +		pEpRatingMistrust = -1,
   4.363 +		pEpRatingB0rken = -2,
   4.364 +		pEpRatingUnderAttack = -3
   4.365 +	} pEpRating;
   4.366  
   4.367 -	typedef enum _pEp_color {
   4.368 -		pEp_color_no_color = 0,
   4.369 -		pEp_color_yellow,
   4.370 -		pEp_color_green,
   4.371 -		pEp_color_red = -1,
   4.372 -	} pEp_color;
   4.373 +	typedef [v1_enum] enum pEpColor {
   4.374 +		pEpColorNoColor = 0,
   4.375 +		pEpColorYellow,
   4.376 +		pEpColorGreen,
   4.377 +		pEpColorRed = -1,
   4.378 +	} pEpColor;
   4.379  
   4.380  	typedef [v1_enum] enum pEpEncryptFlags {
   4.381  		pEpEncryptFlagsNone = 0,
   4.382 @@ -244,84 +245,74 @@
   4.383  		pEpDecryptFlagOwnPrivateKey = 0x1
   4.384  	} pEpDecryptFlags;
   4.385  
   4.386 -    typedef  enum _pEp_msg_direction {
   4.387 -        pEp_dir_incoming = 0,
   4.388 -        pEp_dir_outgoing
   4.389 -    } pEp_msg_direction;
   4.390 +    typedef [v1_enum] enum pEpMsgDirection {
   4.391 +        pEpDirIncoming = 0,
   4.392 +        pEpDirOutgoing
   4.393 +    } pEpMsgDirection;
   4.394  
   4.395 -    typedef  enum _pEp_enc_format {
   4.396 -        pEp_enc_none = 0,                       // message is not encrypted
   4.397 -        pEp_enc_pieces,                         // inline PGP + PGP extensions
   4.398 -        pEp_enc_S_MIME,                         // RFC5751
   4.399 -        pEp_enc_PGP_MIME,                       // RFC3156
   4.400 -        pEp_enc_pEp                             // pEp encryption format
   4.401 -    } pEp_enc_format;
   4.402 +    //typedef  enum _pEp_enc_format {
   4.403 +    //    pEp_enc_none = 0,                       // message is not encrypted
   4.404 +    //    pEp_enc_pieces,                         // inline PGP + PGP extensions
   4.405 +    //    pEp_enc_S_MIME,                         // RFC5751
   4.406 +    //    pEp_enc_PGP_MIME,                       // RFC3156
   4.407 +    //    pEp_enc_pEp                             // pEp encryption format
   4.408 +    //} pEp_enc_format;
   4.409  
   4.410      [uuid(3A8A4F13-3402-4C4C-94AB-598D87869380)] struct StringPair {
   4.411          BSTR name;
   4.412          BSTR value;
   4.413      };
   4.414  
   4.415 -    [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct blob {
   4.416 +    [uuid(61DA7AD4-192E-4616-8678-B19AEFB45B45)] struct Blob {
   4.417          SAFEARRAY(BYTE) value;
   4.418          BSTR mime_type;
   4.419          BSTR filename;
   4.420      };
   4.421  
   4.422 -    [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct text_message {
   4.423 -        pEp_msg_direction dir;
   4.424 +    [uuid(D763A8F3-BA23-4229-A037-1BB7BDC3E0C8)] struct TextMessage {
   4.425 +        pEpMsgDirection dir;
   4.426          BSTR id;
   4.427          BSTR shortmsg;
   4.428          BSTR longmsg;
   4.429          BSTR longmsg_formatted;
   4.430 -        SAFEARRAY(struct blob) attachments;
   4.431 -        hyper sent;
   4.432 -        hyper recv;
   4.433 -        struct pEp_identity_s from;
   4.434 -        SAFEARRAY(struct pEp_identity_s) to;
   4.435 -        struct pEp_identity_s recv_by;
   4.436 -        SAFEARRAY(struct pEp_identity_s) cc;
   4.437 -        SAFEARRAY(struct pEp_identity_s) bcc;
   4.438 -        SAFEARRAY(struct pEp_identity_s) reply_to;
   4.439 +        SAFEARRAY(struct Blob) attachments;
   4.440 +        hyper sent; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   4.441 +        hyper recv; // Timestamp: 64 Bit time_t from mktime(), seconds since January 1, 1970, 0:00 UTC.
   4.442 +        struct pEpIdentity from;
   4.443 +        SAFEARRAY(struct pEpIdentity) to;
   4.444 +        struct pEpIdentity recv_by;
   4.445 +        SAFEARRAY(struct pEpIdentity) cc;
   4.446 +        SAFEARRAY(struct pEpIdentity) bcc;
   4.447 +        SAFEARRAY(struct pEpIdentity) reply_to;
   4.448          SAFEARRAY(BSTR) references;
   4.449          SAFEARRAY(BSTR) keywords;
   4.450          BSTR comments;
   4.451          SAFEARRAY(struct StringPair) opt_fields;
   4.452      };
   4.453  
   4.454 -    HRESULT encrypt_message([in] struct text_message *src, [out] struct text_message * dst, [in] SAFEARRAY(BSTR) extra, [in, defaultvalue(pEpEncryptFlagsNone)] pEpEncryptFlags flags);
   4.455 -    HRESULT decrypt_message([in] struct text_message *src, [out] struct text_message * dst, [out] SAFEARRAY(BSTR) *keylist, [out] pEpDecryptFlags* flags, [out, retval] pEp_rating *rating);
   4.456 -    HRESULT outgoing_message_rating([in] struct text_message *msg, [out, retval] pEp_rating * pVal);
   4.457 -    HRESULT identity_rating([in] struct pEp_identity_s * ident, [out, retval] pEp_rating * pVal);
   4.458 -	HRESULT color_from_rating([in] pEp_rating rating, [out, retval] pEp_color* pVal);
   4.459 +    HRESULT EncryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [in] SAFEARRAY(BSTR) extra, [in, defaultvalue(pEpEncryptFlagsNone)] pEpEncryptFlags flags);
   4.460 +    HRESULT DecryptMessage([in] struct TextMessage *src, [out] struct TextMessage * dst, [out] SAFEARRAY(BSTR) *keylist, [out] pEpDecryptFlags* flags, [out, retval] pEpRating *rating);
   4.461 +    HRESULT OutgoingMessageRating([in] struct TextMessage *msg, [out, retval] pEpRating * pVal);
   4.462 +    HRESULT IdentityRating([in] struct pEpIdentity * ident, [out, retval] pEpRating * pVal);
   4.463 +	HRESULT ColorFromRating([in] pEpRating rating, [out, retval] pEpColor* pVal);
   4.464  
   4.465 -	HRESULT register_callbacks([in] IpEpEngineCallbacks* new_callback);
   4.466 +	HRESULT RegisterCallbacks([in] IpEpEngineCallbacks* new_callback);
   4.467  
   4.468 -	HRESULT unregister_callbacks([in] IpEpEngineCallbacks* obsolete_callback);
   4.469 +	HRESULT UnregisterCallbacks([in] IpEpEngineCallbacks* obsolete_callback);
   4.470  };
   4.471  
   4.472  [
   4.473 -    uuid(3EC2E1A4-40E8-48E4-A7B0-1876D34F9462),
   4.474 +    uuid(564A4350-419E-47F1-B0DF-6FCCF0CD0BBC),
   4.475      version(1.0),
   4.476  ]
   4.477  library pEpCOMServerAdapterLib
   4.478  {
   4.479      importlib("stdole2.tlb");
   4.480 +    
   4.481      [
   4.482 -        uuid(B6BC9B8E-D9E2-4419-A3A4-7B4B58175549)
   4.483 -    ]
   4.484 -    dispinterface _IpEpEngineEvents
   4.485 -    {
   4.486 -    properties:
   4.487 -    methods:
   4.488 -		// test code - remove before shipping
   4.489 -		// [id(1)] HRESULT TestEvent([in] LONG test,[in] BSTR testtest);
   4.490 -	};
   4.491 -    [
   4.492 -        uuid(EF1B073D-5058-4E0E-829E-B4D22CA21EA2)
   4.493 +        uuid(5FF6682B-727B-4DFE-A68D-28982874C0C7)
   4.494      ]
   4.495      coclass pEpEngine {
   4.496          [default] interface IpEpEngine;
   4.497 -        [default, source] dispinterface _IpEpEngineEvents;
   4.498      };
   4.499  };
     5.1 --- a/pEpCOMServerAdapter.vcxproj	Mon Oct 03 19:15:35 2016 +0200
     5.2 +++ b/pEpCOMServerAdapter.vcxproj	Mon Oct 03 22:06:35 2016 +0200
     5.3 @@ -169,6 +169,7 @@
     5.4      <ResourceCompile Include="pEpCOMServerAdapter.rc" />
     5.5    </ItemGroup>
     5.6    <ItemGroup>
     5.7 +    <Text Include="LICENSE.txt" />
     5.8      <Text Include="ReadMe.txt" />
     5.9    </ItemGroup>
    5.10    <ItemGroup>
     6.1 --- a/pEpCOMServerAdapter.vcxproj.filters	Mon Oct 03 19:15:35 2016 +0200
     6.2 +++ b/pEpCOMServerAdapter.vcxproj.filters	Mon Oct 03 22:06:35 2016 +0200
     6.3 @@ -86,6 +86,7 @@
     6.4    </ItemGroup>
     6.5    <ItemGroup>
     6.6      <Text Include="ReadMe.txt" />
     6.7 +    <Text Include="LICENSE.txt" />
     6.8    </ItemGroup>
     6.9    <ItemGroup>
    6.10      <None Include="pEpCOMServerAdapter.rgs">
     7.1 --- a/pEp_utility.cpp	Mon Oct 03 19:15:35 2016 +0200
     7.2 +++ b/pEp_utility.cpp	Mon Oct 03 22:06:35 2016 +0200
     7.3 @@ -16,11 +16,11 @@
     7.4                  user_id = _ident->user_id;
     7.5              if (_ident->username)
     7.6                  username = _ident->username;
     7.7 -            comm_type = (pEp_comm_type) _ident->comm_type;
     7.8 +            comm_type = (pEpComType) _ident->comm_type;
     7.9              lang = _ident->lang;
    7.10          }
    7.11  
    7.12 -        pEp_identity_cpp::pEp_identity_cpp(const pEp_identity_s *_ident)
    7.13 +        pEp_identity_cpp::pEp_identity_cpp(const pEpIdentity *_ident)
    7.14              : me(false)
    7.15          {
    7.16              if (_ident->address)
    7.17 @@ -56,9 +56,9 @@
    7.18              return _ident;
    7.19          }
    7.20  
    7.21 -        pEp_identity_s * pEp_identity_cpp::to_pEp_identity_s()
    7.22 +        pEpIdentity * pEp_identity_cpp::to_pEp_identity_s()
    7.23          {
    7.24 -            pEp_identity_s *_ident = (pEp_identity_s *) calloc(1, sizeof(pEp_identity_s));
    7.25 +            pEpIdentity *_ident = (pEpIdentity *) calloc(1, sizeof(pEpIdentity));
    7.26              assert(_ident);
    7.27              if (_ident == NULL)
    7.28                  throw bad_alloc();
    7.29 @@ -73,11 +73,11 @@
    7.30              return _ident;
    7.31          }
    7.32  
    7.33 -        void copy_identity(pEp_identity_s * ident_s, const pEp_identity * ident)
    7.34 +        void copy_identity(pEpIdentity * ident_s, const pEp_identity * ident)
    7.35          {
    7.36              assert(ident_s);
    7.37  
    7.38 -            ::memset(ident_s, 0, sizeof(pEp_identity_s));
    7.39 +            ::memset(ident_s, 0, sizeof(pEpIdentity));
    7.40              if (ident) {
    7.41                  if (ident->address)
    7.42                      ident_s->address = utf16_bstr(ident->address);
    7.43 @@ -87,13 +87,13 @@
    7.44                      ident_s->user_id = utf16_bstr(ident->user_id);
    7.45                  if (ident->username)
    7.46                      ident_s->username = utf16_bstr(ident->username);
    7.47 -                ident_s->comm_type = (pEp_comm_type) ident->comm_type;
    7.48 +                ident_s->comm_type = (pEpComType) ident->comm_type;
    7.49                  if (ident->lang)
    7.50                      ident_s->lang = utf16_bstr(ident->lang);
    7.51              }
    7.52          }
    7.53  
    7.54 -        ::pEp_identity *new_identity(const pEp_identity_s * ident)
    7.55 +        ::pEp_identity *new_identity(const pEpIdentity * ident)
    7.56          {
    7.57              if (ident == NULL)
    7.58                  return NULL;
    7.59 @@ -162,7 +162,7 @@
    7.60              return utf16_bstr(s);
    7.61          }
    7.62  
    7.63 -        template<> blob *from_C< blob *, bloblist_t >(bloblist_t *tl)
    7.64 +        template<> Blob *from_C< Blob *, bloblist_t >(bloblist_t *tl)
    7.65          {
    7.66              CComSafeArray<BYTE> sa;
    7.67              sa.Create(tl->size);
    7.68 @@ -174,7 +174,7 @@
    7.69                  SafeArrayUnaccessData(sa);
    7.70              }
    7.71  
    7.72 -            blob *_blob = new blob();
    7.73 +            Blob *_blob = new Blob();
    7.74  
    7.75              _blob->value = sa.Detach();
    7.76              _blob->mime_type = bstr(tl->mime_type);
    7.77 @@ -204,7 +204,7 @@
    7.78              return sa;
    7.79          }
    7.80  
    7.81 -        void clear_identity_s(pEp_identity_s& ident)
    7.82 +        void clear_identity_s(pEpIdentity& ident)
    7.83          {
    7.84              SysFreeString(ident.address);
    7.85              SysFreeString(ident.fpr);
    7.86 @@ -212,12 +212,12 @@
    7.87              SysFreeString(ident.username);
    7.88              SysFreeString(ident.user_id);
    7.89  
    7.90 -            memset(&ident, 0, sizeof(pEp_identity_s));
    7.91 +            memset(&ident, 0, sizeof(pEpIdentity));
    7.92          }
    7.93  
    7.94 -        template<> pEp_identity_s from_C< pEp_identity_s, pEp_identity >(pEp_identity *tl)
    7.95 +        template<> pEpIdentity from_C< pEpIdentity, pEp_identity >(pEp_identity *tl)
    7.96          {
    7.97 -            pEp_identity_s _ident;
    7.98 +            pEpIdentity _ident;
    7.99              memset(&_ident, 0, sizeof(_ident));
   7.100  
   7.101              if (tl)
   7.102 @@ -225,15 +225,15 @@
   7.103              return _ident;
   7.104          }
   7.105  
   7.106 -        pEp_identity_s identity_s(pEp_identity *ident)
   7.107 +        pEpIdentity identity_s(pEp_identity *ident)
   7.108          {
   7.109 -            return from_C< pEp_identity_s, pEp_identity >(ident);
   7.110 +            return from_C< pEpIdentity, pEp_identity >(ident);
   7.111          }
   7.112  
   7.113 -        template<> pEp_identity_s *from_C< pEp_identity_s *, identity_list >(identity_list *il)
   7.114 +        template<> pEpIdentity *from_C< pEpIdentity *, identity_list >(identity_list *il)
   7.115          {
   7.116 -            pEp_identity_s *ident = new pEp_identity_s();
   7.117 -            memset(ident, 0, sizeof(pEp_identity_s));
   7.118 +            pEpIdentity *ident = new pEpIdentity();
   7.119 +            memset(ident, 0, sizeof(pEpIdentity));
   7.120  
   7.121              if (il)
   7.122                  copy_identity(ident, il->ident);
   7.123 @@ -265,7 +265,7 @@
   7.124              return stringpair_list_length(tl);
   7.125          }
   7.126  
   7.127 -        void clear_text_message(text_message *msg)
   7.128 +        void clear_text_message(TextMessage *msg)
   7.129          {
   7.130              SysFreeString(msg->id);
   7.131              SysFreeString(msg->shortmsg);
   7.132 @@ -283,32 +283,32 @@
   7.133              SysFreeString(msg->comments);
   7.134              SafeArrayDestroy(msg->opt_fields);
   7.135  
   7.136 -            memset(msg, 0, sizeof(text_message));
   7.137 +            memset(msg, 0, sizeof(TextMessage));
   7.138          }
   7.139  
   7.140 -        void text_message_from_C(text_message *msg2, const ::message *msg)
   7.141 +        void text_message_from_C(TextMessage *msg2, const ::message *msg)
   7.142          {
   7.143              assert(msg2);
   7.144              assert(msg);
   7.145  
   7.146              clear_text_message(msg2);
   7.147  
   7.148 -            msg2->dir = (pEp_msg_direction) msg->dir;
   7.149 +            msg2->dir = (pEpMsgDirection) msg->dir;
   7.150              msg2->id = bstr(msg->id);
   7.151              msg2->shortmsg = bstr(msg->shortmsg);
   7.152              msg2->longmsg = bstr(msg->longmsg);
   7.153              msg2->longmsg_formatted = bstr(msg->longmsg_formatted);
   7.154 -            msg2->attachments = array_from_C<blob, bloblist_t>(msg->attachments);
   7.155 +            msg2->attachments = array_from_C<Blob, bloblist_t>(msg->attachments);
   7.156              if (msg->sent)
   7.157                  msg2->sent = mktime(msg->sent);
   7.158              if (msg->recv)
   7.159                  msg2->recv = mktime(msg->recv);
   7.160              msg2->from = identity_s(msg->from);
   7.161 -            msg2->to = array_from_C<pEp_identity_s, identity_list>(msg->to);
   7.162 +            msg2->to = array_from_C<pEpIdentity, identity_list>(msg->to);
   7.163              msg2->recv_by = identity_s(msg->recv_by);
   7.164 -            msg2->cc = array_from_C<pEp_identity_s, identity_list>(msg->cc);
   7.165 -            msg2->bcc = array_from_C<pEp_identity_s, identity_list>(msg->bcc);
   7.166 -            msg2->reply_to = array_from_C<pEp_identity_s, identity_list>(msg->reply_to);
   7.167 +            msg2->cc = array_from_C<pEpIdentity, identity_list>(msg->cc);
   7.168 +            msg2->bcc = array_from_C<pEpIdentity, identity_list>(msg->bcc);
   7.169 +            msg2->reply_to = array_from_C<pEpIdentity, identity_list>(msg->reply_to);
   7.170              msg2->references = string_array(msg->references);
   7.171              msg2->keywords = string_array(msg->keywords);
   7.172              msg2->comments = bstr(msg->comments);
   7.173 @@ -325,12 +325,12 @@
   7.174              return _s;
   7.175          }
   7.176  
   7.177 -        void clear_blob(blob& b)
   7.178 +        void clear_blob(Blob& b)
   7.179          {
   7.180              SysFreeString(b.filename);
   7.181              SysFreeString(b.mime_type);
   7.182              SafeArrayDestroy(b.value);
   7.183 -            memset(&b, 0, sizeof(blob));
   7.184 +            memset(&b, 0, sizeof(Blob));
   7.185          }
   7.186  
   7.187          bloblist_t *bloblist(SAFEARRAY *sa)
   7.188 @@ -352,8 +352,8 @@
   7.189  
   7.190              bloblist_t *_bl = bl;
   7.191              for (LONG i = lbound; i <= ubound; i++) {
   7.192 -                blob b;
   7.193 -                memset(&b, 0, sizeof(blob));
   7.194 +                Blob b;
   7.195 +                memset(&b, 0, sizeof(Blob));
   7.196                  SafeArrayGetElement(sa, &i, &b);
   7.197  
   7.198                  LONG _lbound, _ubound;
   7.199 @@ -410,8 +410,8 @@
   7.200  
   7.201              identity_list *_il = il;
   7.202              for (LONG i = lbound; i <= ubound; i++) {
   7.203 -                pEp_identity_s s;
   7.204 -                memset(&s, 0, sizeof(pEp_identity_s));
   7.205 +                pEpIdentity s;
   7.206 +                memset(&s, 0, sizeof(pEpIdentity));
   7.207                  SafeArrayGetElement(sa, &i, &s);
   7.208  
   7.209                  pEp_identity *ident;
   7.210 @@ -493,7 +493,7 @@
   7.211              return il;
   7.212          }
   7.213          
   7.214 -        ::message * text_message_to_C(text_message *msg)
   7.215 +        ::message * text_message_to_C(TextMessage *msg)
   7.216          {
   7.217              assert(msg);
   7.218  
     8.1 --- a/pEp_utility.h	Mon Oct 03 19:15:35 2016 +0200
     8.2 +++ b/pEp_utility.h	Mon Oct 03 22:06:35 2016 +0200
     8.3 @@ -14,7 +14,7 @@
     8.4              string fpr;
     8.5              string user_id;
     8.6              string username;
     8.7 -            pEp_comm_type comm_type;
     8.8 +            pEpComType comm_type;
     8.9              string lang;
    8.10              bool me;
    8.11  
    8.12 @@ -23,23 +23,23 @@
    8.13                  string _fpr = string(),
    8.14                  string _user_id = string(),
    8.15                  string _username = string(),
    8.16 -                pEp_comm_type _comm_type = pEp_ct_unknown,
    8.17 +                pEpComType _comm_type = pEpCtUnknown,
    8.18                  string _lang = string()
    8.19                  ) : address(_address), fpr(_fpr), user_id(_user_id), username(_username), comm_type(_comm_type), lang(_lang), me(false)
    8.20              { }
    8.21  
    8.22              pEp_identity_cpp(const ::pEp_identity *_ident);
    8.23 -            pEp_identity_cpp(const pEp_identity_s *_ident);
    8.24 +            pEp_identity_cpp(const pEpIdentity *_ident);
    8.25  
    8.26              pEp_identity * to_pEp_identity();
    8.27 -            pEp_identity_s * to_pEp_identity_s();
    8.28 +            pEpIdentity * to_pEp_identity_s();
    8.29          };
    8.30  
    8.31 -        void copy_identity(pEp_identity_s * ident_s, const pEp_identity * ident);
    8.32 -        void free_identity_strings(pEp_identity_s * ident_s);
    8.33 -        void clear_identity_s(pEp_identity_s& ident);
    8.34 -        void clear_text_message(text_message *msg);
    8.35 -        ::pEp_identity *new_identity(const pEp_identity_s * ident);
    8.36 +        void copy_identity(pEpIdentity * ident_s, const pEp_identity * ident);
    8.37 +        void free_identity_strings(pEpIdentity * ident_s);
    8.38 +        void clear_identity_s(pEpIdentity& ident);
    8.39 +        void clear_text_message(TextMessage *msg);
    8.40 +        ::pEp_identity *new_identity(const pEpIdentity * ident);
    8.41  
    8.42  		void opt_field_array_from_C(stringpair_list_t* spair_list, LPSAFEARRAY* pair_list_out);
    8.43  		void clear_opt_field_array(LPSAFEARRAY* pair_list);
    8.44 @@ -79,7 +79,7 @@
    8.45              return psaUDType;
    8.46          }
    8.47  
    8.48 -        ::message * text_message_to_C(text_message *msg);
    8.49 -        void text_message_from_C(text_message *msg2, const ::message *msg);
    8.50 +        ::message * text_message_to_C(TextMessage *msg);
    8.51 +        void text_message_from_C(TextMessage *msg2, const ::message *msg);
    8.52      }
    8.53  }