implementing Message API
authorVolker Birk <vb@pep-project.org>
Fri, 01 May 2015 00:24:12 +0200
changeset 15b1c2c371379c
parent 14 150074d8dc96
child 16 6a58841ee652
implementing Message API
CpEpEngine.cpp
CpEpEngine.h
TextMessage.cpp
TextMessage.h
pEpCOMServerAdapter.idl
     1.1 --- a/CpEpEngine.cpp	Wed Apr 29 09:49:18 2015 +0200
     1.2 +++ b/CpEpEngine.cpp	Fri May 01 00:24:12 2015 +0200
     1.3 @@ -836,3 +836,27 @@
     1.4      }
     1.5      return E_FAIL;
     1.6  }
     1.7 +
     1.8 +STDMETHODIMP CpEpEngine::message_encrypt(ITextMessage * src, ITextMessage ** dst, SAFEARRAY * extra)
     1.9 +{
    1.10 +    assert(src);
    1.11 +    assert(dst);
    1.12 +
    1.13 +    return S_OK;
    1.14 +}
    1.15 +
    1.16 +STDMETHODIMP CpEpEngine::message_decrypt(ITextMessage * src, ITextMessage ** dst)
    1.17 +{
    1.18 +    assert(src);
    1.19 +    assert(dst);
    1.20 +
    1.21 +    return S_OK;
    1.22 +}
    1.23 +
    1.24 +STDMETHODIMP CpEpEngine::message_color(ITextMessage *msg, pEp_color * pVal)
    1.25 +{
    1.26 +    assert(msg);
    1.27 +    assert(pVal);
    1.28 +
    1.29 +    return S_OK;
    1.30 +}
     2.1 --- a/CpEpEngine.h	Wed Apr 29 09:49:18 2015 +0200
     2.2 +++ b/CpEpEngine.h	Fri May 01 00:24:12 2015 +0200
     2.3 @@ -28,8 +28,7 @@
     2.4  	public ISupportErrorInfo,
     2.5  	public IConnectionPointContainerImpl<CpEpEngine>,
     2.6  	public CProxy_IpEpEngineEvents<CpEpEngine>,
     2.7 -	public IpEpEngine,
     2.8 -    public IMessageAPI_Outlook
     2.9 +	public IpEpEngine
    2.10  {
    2.11  public:
    2.12  	CpEpEngine()
    2.13 @@ -57,7 +56,6 @@
    2.14      COM_INTERFACE_ENTRY(IpEpEngine)
    2.15      COM_INTERFACE_ENTRY(ISupportErrorInfo)
    2.16      COM_INTERFACE_ENTRY(IConnectionPointContainer)
    2.17 -    COM_INTERFACE_ENTRY(IMessageAPI_Outlook)
    2.18  END_COM_MAP()
    2.19  
    2.20  BEGIN_CONNECTION_POINT_MAP(CpEpEngine)
    2.21 @@ -148,6 +146,9 @@
    2.22      
    2.23      // Message API
    2.24  
    2.25 +    STDMETHOD(message_encrypt)(ITextMessage * src, ITextMessage ** dst, SAFEARRAY * extra);
    2.26 +    STDMETHOD(message_decrypt)(ITextMessage * src, ITextMessage ** dst);
    2.27 +    STDMETHOD(message_color)(ITextMessage *msg, pEp_color * pVal);
    2.28  };
    2.29  
    2.30  OBJECT_ENTRY_AUTO(__uuidof(pEpEngine), CpEpEngine)
     3.1 --- a/TextMessage.cpp	Wed Apr 29 09:49:18 2015 +0200
     3.2 +++ b/TextMessage.cpp	Fri May 01 00:24:12 2015 +0200
     3.3 @@ -153,3 +153,848 @@
     3.4  
     3.5      return S_OK;
     3.6  }
     3.7 +
     3.8 +STDMETHODIMP CTextMessage::get_recv_by(pEp_identity_s* pVal)
     3.9 +{
    3.10 +    assert(pVal);
    3.11 +
    3.12 +    try {
    3.13 +        copy_identity(pVal, msg->recv_by);
    3.14 +    }
    3.15 +    catch (bad_alloc& e) {
    3.16 +        return E_OUTOFMEMORY;
    3.17 +    }
    3.18 +    catch (exception& e) {
    3.19 +        return E_FAIL;
    3.20 +    }
    3.21 +
    3.22 +    return S_OK;
    3.23 +}
    3.24 +
    3.25 +
    3.26 +STDMETHODIMP CTextMessage::put_recv_by(pEp_identity_s* newVal)
    3.27 +{
    3.28 +    assert(newVal);
    3.29 +
    3.30 +    ::pEp_identity *_recv_by;
    3.31 +
    3.32 +    try {
    3.33 +        _recv_by = new_identity(newVal);
    3.34 +    }
    3.35 +    catch (bad_alloc& e) {
    3.36 +        return E_OUTOFMEMORY;
    3.37 +    }
    3.38 +    catch (exception& e) {
    3.39 +        return E_FAIL;
    3.40 +    }
    3.41 +
    3.42 +    ::free_identity(msg->recv_by);
    3.43 +    msg->recv_by = _recv_by;
    3.44 +    return S_OK;
    3.45 +}
    3.46 +
    3.47 +STDMETHODIMP CTextMessage::get_cc(LPSAFEARRAY * pVal)
    3.48 +{
    3.49 +    assert(pVal);
    3.50 +
    3.51 +    int len = identity_list_length(msg->cc);
    3.52 +
    3.53 +    LPSAFEARRAY sa = newSafeArray<pEp_identity_s>(len);
    3.54 +    if (sa == NULL)
    3.55 +        return E_OUTOFMEMORY;
    3.56 +
    3.57 +    pEp_identity_s *cs = accessData<pEp_identity_s>(sa);
    3.58 +
    3.59 +    identity_list *il = msg->cc;
    3.60 +    ULONG i;
    3.61 +    for (i = 0, il = msg->cc; il && il->ident; il = il->next, i++) {
    3.62 +        try {
    3.63 +            copy_identity(&cs[i], il->ident);
    3.64 +        }
    3.65 +        catch (bad_alloc& e) {
    3.66 +            SafeArrayUnaccessData(sa);
    3.67 +            SafeArrayDestroy(sa);
    3.68 +            return E_OUTOFMEMORY;
    3.69 +        }
    3.70 +        catch (exception& e) {
    3.71 +            SafeArrayUnaccessData(sa);
    3.72 +            SafeArrayDestroy(sa);
    3.73 +            return E_FAIL;
    3.74 +        }
    3.75 +    }
    3.76 +
    3.77 +    SafeArrayUnaccessData(sa);
    3.78 +
    3.79 +    *pVal = sa;
    3.80 +    return S_OK;
    3.81 +}
    3.82 +
    3.83 +STDMETHODIMP CTextMessage::put_cc(SAFEARRAY * newVal)
    3.84 +{
    3.85 +    assert(newVal);
    3.86 +
    3.87 +    if (newVal == NULL)
    3.88 +        return E_INVALIDARG;
    3.89 +
    3.90 +    identity_list *il = new_identity_list(NULL);
    3.91 +    if (il == NULL)
    3.92 +        return E_OUTOFMEMORY;
    3.93 +
    3.94 +    pEp_identity_s *cs;
    3.95 +    HRESULT hr = SafeArrayAccessData(newVal, (void **) &cs);
    3.96 +    assert(SUCCEEDED(hr) && cs);
    3.97 +    if (cs == NULL) {
    3.98 +        free_identity_list(il);
    3.99 +        return E_FAIL;
   3.100 +    }
   3.101 +
   3.102 +    identity_list *_il;
   3.103 +    LONG i, lbound, ubound;
   3.104 +    SafeArrayGetLBound(newVal, 1, &lbound);
   3.105 +    SafeArrayGetUBound(newVal, 1, &ubound);
   3.106 +
   3.107 +    for (i = lbound, _il = il; i <= ubound; i++) {
   3.108 +        pEp_identity * ident;
   3.109 +        try {
   3.110 +            ident = new_identity(&cs[i]);
   3.111 +        }
   3.112 +        catch (bad_alloc& e) {
   3.113 +            SafeArrayUnaccessData(newVal);
   3.114 +            free_identity_list(il);
   3.115 +            return E_OUTOFMEMORY;
   3.116 +        }
   3.117 +        catch (exception& e) {
   3.118 +            SafeArrayUnaccessData(newVal);
   3.119 +            free_identity_list(il);
   3.120 +            return E_FAIL;
   3.121 +        }
   3.122 +        _il = identity_list_add(_il, ident);
   3.123 +        if (_il == NULL) {
   3.124 +            SafeArrayUnaccessData(newVal);
   3.125 +            free_identity_list(il);
   3.126 +            return E_OUTOFMEMORY;
   3.127 +        }
   3.128 +    }
   3.129 +
   3.130 +    SafeArrayUnaccessData(newVal);
   3.131 +
   3.132 +    free_identity_list(msg->cc);
   3.133 +    msg->cc = il;
   3.134 +
   3.135 +    return S_OK;
   3.136 +}
   3.137 +
   3.138 +STDMETHODIMP CTextMessage::get_bcc(LPSAFEARRAY * pVal)
   3.139 +{
   3.140 +    assert(pVal);
   3.141 +
   3.142 +    int len = identity_list_length(msg->bcc);
   3.143 +
   3.144 +    LPSAFEARRAY sa = newSafeArray<pEp_identity_s>(len);
   3.145 +    if (sa == NULL)
   3.146 +        return E_OUTOFMEMORY;
   3.147 +
   3.148 +    pEp_identity_s *cs = accessData<pEp_identity_s>(sa);
   3.149 +
   3.150 +    identity_list *il = msg->bcc;
   3.151 +    ULONG i;
   3.152 +    for (i = 0, il = msg->bcc; il && il->ident; il = il->next, i++) {
   3.153 +        try {
   3.154 +            copy_identity(&cs[i], il->ident);
   3.155 +        }
   3.156 +        catch (bad_alloc& e) {
   3.157 +            SafeArrayUnaccessData(sa);
   3.158 +            SafeArrayDestroy(sa);
   3.159 +            return E_OUTOFMEMORY;
   3.160 +        }
   3.161 +        catch (exception& e) {
   3.162 +            SafeArrayUnaccessData(sa);
   3.163 +            SafeArrayDestroy(sa);
   3.164 +            return E_FAIL;
   3.165 +        }
   3.166 +    }
   3.167 +
   3.168 +    SafeArrayUnaccessData(sa);
   3.169 +
   3.170 +    *pVal = sa;
   3.171 +    return S_OK;
   3.172 +}
   3.173 +
   3.174 +STDMETHODIMP CTextMessage::put_bcc(SAFEARRAY * newVal)
   3.175 +{
   3.176 +    assert(newVal);
   3.177 +
   3.178 +    if (newVal == NULL)
   3.179 +        return E_INVALIDARG;
   3.180 +
   3.181 +    identity_list *il = new_identity_list(NULL);
   3.182 +    if (il == NULL)
   3.183 +        return E_OUTOFMEMORY;
   3.184 +
   3.185 +    pEp_identity_s *cs;
   3.186 +    HRESULT hr = SafeArrayAccessData(newVal, (void **) &cs);
   3.187 +    assert(SUCCEEDED(hr) && cs);
   3.188 +    if (cs == NULL) {
   3.189 +        free_identity_list(il);
   3.190 +        return E_FAIL;
   3.191 +    }
   3.192 +
   3.193 +    identity_list *_il;
   3.194 +    LONG i, lbound, ubound;
   3.195 +    SafeArrayGetLBound(newVal, 1, &lbound);
   3.196 +    SafeArrayGetUBound(newVal, 1, &ubound);
   3.197 +
   3.198 +    for (i = lbound, _il = il; i <= ubound; i++) {
   3.199 +        pEp_identity * ident;
   3.200 +        try {
   3.201 +            ident = new_identity(&cs[i]);
   3.202 +        }
   3.203 +        catch (bad_alloc& e) {
   3.204 +            SafeArrayUnaccessData(newVal);
   3.205 +            free_identity_list(il);
   3.206 +            return E_OUTOFMEMORY;
   3.207 +        }
   3.208 +        catch (exception& e) {
   3.209 +            SafeArrayUnaccessData(newVal);
   3.210 +            free_identity_list(il);
   3.211 +            return E_FAIL;
   3.212 +        }
   3.213 +        _il = identity_list_add(_il, ident);
   3.214 +        if (_il == NULL) {
   3.215 +            SafeArrayUnaccessData(newVal);
   3.216 +            free_identity_list(il);
   3.217 +            return E_OUTOFMEMORY;
   3.218 +        }
   3.219 +    }
   3.220 +
   3.221 +    SafeArrayUnaccessData(newVal);
   3.222 +
   3.223 +    free_identity_list(msg->bcc);
   3.224 +    msg->bcc = il;
   3.225 +
   3.226 +    return S_OK;
   3.227 +}
   3.228 +
   3.229 +STDMETHODIMP CTextMessage::get_reply_to(LPSAFEARRAY * pVal)
   3.230 +{
   3.231 +    assert(pVal);
   3.232 +
   3.233 +    int len = identity_list_length(msg->reply_to);
   3.234 +
   3.235 +    LPSAFEARRAY sa = newSafeArray<pEp_identity_s>(len);
   3.236 +    if (sa == NULL)
   3.237 +        return E_OUTOFMEMORY;
   3.238 +
   3.239 +    pEp_identity_s *cs = accessData<pEp_identity_s>(sa);
   3.240 +
   3.241 +    identity_list *il = msg->reply_to;
   3.242 +    ULONG i;
   3.243 +    for (i = 0, il = msg->reply_to; il && il->ident; il = il->next, i++) {
   3.244 +        try {
   3.245 +            copy_identity(&cs[i], il->ident);
   3.246 +        }
   3.247 +        catch (bad_alloc& e) {
   3.248 +            SafeArrayUnaccessData(sa);
   3.249 +            SafeArrayDestroy(sa);
   3.250 +            return E_OUTOFMEMORY;
   3.251 +        }
   3.252 +        catch (exception& e) {
   3.253 +            SafeArrayUnaccessData(sa);
   3.254 +            SafeArrayDestroy(sa);
   3.255 +            return E_FAIL;
   3.256 +        }
   3.257 +    }
   3.258 +
   3.259 +    SafeArrayUnaccessData(sa);
   3.260 +
   3.261 +    *pVal = sa;
   3.262 +    return S_OK;
   3.263 +}
   3.264 +
   3.265 +STDMETHODIMP CTextMessage::put_reply_to(SAFEARRAY * newVal)
   3.266 +{
   3.267 +    assert(newVal);
   3.268 +
   3.269 +    if (newVal == NULL)
   3.270 +        return E_INVALIDARG;
   3.271 +
   3.272 +    identity_list *il = new_identity_list(NULL);
   3.273 +    if (il == NULL)
   3.274 +        return E_OUTOFMEMORY;
   3.275 +
   3.276 +    pEp_identity_s *cs;
   3.277 +    HRESULT hr = SafeArrayAccessData(newVal, (void **) &cs);
   3.278 +    assert(SUCCEEDED(hr) && cs);
   3.279 +    if (cs == NULL) {
   3.280 +        free_identity_list(il);
   3.281 +        return E_FAIL;
   3.282 +    }
   3.283 +
   3.284 +    identity_list *_il;
   3.285 +    LONG i, lbound, ubound;
   3.286 +    SafeArrayGetLBound(newVal, 1, &lbound);
   3.287 +    SafeArrayGetUBound(newVal, 1, &ubound);
   3.288 +
   3.289 +    for (i = lbound, _il = il; i <= ubound; i++) {
   3.290 +        pEp_identity * ident;
   3.291 +        try {
   3.292 +            ident = new_identity(&cs[i]);
   3.293 +        }
   3.294 +        catch (bad_alloc& e) {
   3.295 +            SafeArrayUnaccessData(newVal);
   3.296 +            free_identity_list(il);
   3.297 +            return E_OUTOFMEMORY;
   3.298 +        }
   3.299 +        catch (exception& e) {
   3.300 +            SafeArrayUnaccessData(newVal);
   3.301 +            free_identity_list(il);
   3.302 +            return E_FAIL;
   3.303 +        }
   3.304 +        _il = identity_list_add(_il, ident);
   3.305 +        if (_il == NULL) {
   3.306 +            SafeArrayUnaccessData(newVal);
   3.307 +            free_identity_list(il);
   3.308 +            return E_OUTOFMEMORY;
   3.309 +        }
   3.310 +    }
   3.311 +
   3.312 +    SafeArrayUnaccessData(newVal);
   3.313 +
   3.314 +    free_identity_list(msg->reply_to);
   3.315 +    msg->reply_to = il;
   3.316 +
   3.317 +    return S_OK;
   3.318 +}
   3.319 +
   3.320 +STDMETHODIMP CTextMessage::get_dir(pEp_msg_direction *pVal)
   3.321 +{
   3.322 +    assert(pVal);
   3.323 +
   3.324 +    *pVal = (pEp_msg_direction) msg->dir;
   3.325 +
   3.326 +    return S_OK;
   3.327 +}
   3.328 +
   3.329 +STDMETHODIMP CTextMessage::put_dir(pEp_msg_direction newVal)
   3.330 +{
   3.331 +    msg->dir = (PEP_msg_direction) newVal;
   3.332 +
   3.333 +    return S_OK;
   3.334 +}
   3.335 +
   3.336 +STDMETHODIMP CTextMessage::get_id(BSTR * pVal)
   3.337 +{
   3.338 +    assert(pVal);
   3.339 +
   3.340 +    _bstr_t val;
   3.341 +
   3.342 +    if (msg->id) {
   3.343 +        try {
   3.344 +            val = utf16_bstr(msg->id);
   3.345 +        }
   3.346 +        catch (bad_alloc& e) {
   3.347 +            return E_OUTOFMEMORY;
   3.348 +        }
   3.349 +        catch (exception& e) {
   3.350 +            return E_FAIL;
   3.351 +        }
   3.352 +    }
   3.353 +
   3.354 +    *pVal = val.Detach();
   3.355 +
   3.356 +    return S_OK;
   3.357 +}
   3.358 +
   3.359 +STDMETHODIMP CTextMessage::put_id(BSTR newVal)
   3.360 +{
   3.361 +    assert(newVal);
   3.362 +
   3.363 +    string val;
   3.364 +
   3.365 +    try {
   3.366 +        val = utf8_string(newVal);
   3.367 +    }
   3.368 +    catch (bad_alloc& e) {
   3.369 +        return E_OUTOFMEMORY;
   3.370 +    }
   3.371 +    catch (exception& e) {
   3.372 +        return E_FAIL;
   3.373 +    }
   3.374 +
   3.375 +    if (msg->id)
   3.376 +        free(msg->id);
   3.377 +
   3.378 +    msg->id = _strdup(val.c_str());
   3.379 +    if (msg->id == NULL)
   3.380 +        return E_OUTOFMEMORY;
   3.381 +
   3.382 +    return S_OK;
   3.383 +}
   3.384 +
   3.385 +STDMETHODIMP CTextMessage::get_shortmsg(BSTR * pVal)
   3.386 +{
   3.387 +    assert(pVal);
   3.388 +
   3.389 +    _bstr_t val;
   3.390 +
   3.391 +    if (msg->shortmsg) {
   3.392 +        try {
   3.393 +            val = utf16_bstr(msg->shortmsg);
   3.394 +        }
   3.395 +        catch (bad_alloc& e) {
   3.396 +            return E_OUTOFMEMORY;
   3.397 +        }
   3.398 +        catch (exception& e) {
   3.399 +            return E_FAIL;
   3.400 +        }
   3.401 +    }
   3.402 +
   3.403 +    *pVal = val.Detach();
   3.404 +
   3.405 +    return S_OK;
   3.406 +}
   3.407 +
   3.408 +STDMETHODIMP CTextMessage::put_shortmsg(BSTR newVal)
   3.409 +{
   3.410 +    assert(newVal);
   3.411 +
   3.412 +    string val;
   3.413 +
   3.414 +    try {
   3.415 +        val = utf8_string(newVal);
   3.416 +    }
   3.417 +    catch (bad_alloc& e) {
   3.418 +        return E_OUTOFMEMORY;
   3.419 +    }
   3.420 +    catch (exception& e) {
   3.421 +        return E_FAIL;
   3.422 +    }
   3.423 +
   3.424 +    if (msg->shortmsg)
   3.425 +        free(msg->shortmsg);
   3.426 +
   3.427 +    msg->shortmsg = _strdup(val.c_str());
   3.428 +    if (msg->shortmsg == NULL)
   3.429 +        return E_OUTOFMEMORY;
   3.430 +
   3.431 +    return S_OK;
   3.432 +}
   3.433 +
   3.434 +STDMETHODIMP CTextMessage::get_longmsg(BSTR * pVal)
   3.435 +{
   3.436 +    assert(pVal);
   3.437 +
   3.438 +    _bstr_t val;
   3.439 +
   3.440 +    if (msg->longmsg) {
   3.441 +        try {
   3.442 +            val = utf16_bstr(msg->longmsg);
   3.443 +        }
   3.444 +        catch (bad_alloc& e) {
   3.445 +            return E_OUTOFMEMORY;
   3.446 +        }
   3.447 +        catch (exception& e) {
   3.448 +            return E_FAIL;
   3.449 +        }
   3.450 +    }
   3.451 +
   3.452 +    *pVal = val.Detach();
   3.453 +
   3.454 +    return S_OK;
   3.455 +}
   3.456 +
   3.457 +STDMETHODIMP CTextMessage::put_longmsg(BSTR newVal)
   3.458 +{
   3.459 +    assert(newVal);
   3.460 +
   3.461 +    string val;
   3.462 +
   3.463 +    try {
   3.464 +        val = utf8_string(newVal);
   3.465 +    }
   3.466 +    catch (bad_alloc& e) {
   3.467 +        return E_OUTOFMEMORY;
   3.468 +    }
   3.469 +    catch (exception& e) {
   3.470 +        return E_FAIL;
   3.471 +    }
   3.472 +
   3.473 +    if (msg->longmsg)
   3.474 +        free(msg->longmsg);
   3.475 +
   3.476 +    msg->longmsg = _strdup(val.c_str());
   3.477 +    if (msg->longmsg == NULL)
   3.478 +        return E_OUTOFMEMORY;
   3.479 +
   3.480 +    return S_OK;
   3.481 +}
   3.482 +
   3.483 +STDMETHODIMP CTextMessage::get_longmsg_formatted(BSTR * pVal)
   3.484 +{
   3.485 +    assert(pVal);
   3.486 +
   3.487 +    _bstr_t val;
   3.488 +
   3.489 +    if (msg->longmsg_formatted) {
   3.490 +        try {
   3.491 +            val = utf16_bstr(msg->longmsg_formatted);
   3.492 +        }
   3.493 +        catch (bad_alloc& e) {
   3.494 +            return E_OUTOFMEMORY;
   3.495 +        }
   3.496 +        catch (exception& e) {
   3.497 +            return E_FAIL;
   3.498 +        }
   3.499 +    }
   3.500 +
   3.501 +    *pVal = val.Detach();
   3.502 +
   3.503 +    return S_OK;
   3.504 +}
   3.505 +
   3.506 +STDMETHODIMP CTextMessage::put_longmsg_formatted(BSTR newVal)
   3.507 +{
   3.508 +    assert(newVal);
   3.509 +
   3.510 +    string val;
   3.511 +
   3.512 +    try {
   3.513 +        val = utf8_string(newVal);
   3.514 +    }
   3.515 +    catch (bad_alloc& e) {
   3.516 +        return E_OUTOFMEMORY;
   3.517 +    }
   3.518 +    catch (exception& e) {
   3.519 +        return E_FAIL;
   3.520 +    }
   3.521 +
   3.522 +    if (msg->longmsg_formatted)
   3.523 +        free(msg->longmsg_formatted);
   3.524 +
   3.525 +    msg->longmsg_formatted = _strdup(val.c_str());
   3.526 +    if (msg->longmsg_formatted == NULL)
   3.527 +        return E_OUTOFMEMORY;
   3.528 +
   3.529 +    return S_OK;
   3.530 +}
   3.531 +
   3.532 +STDMETHODIMP CTextMessage::add_attachment(SAFEARRAY * data, BSTR mime_type, BSTR filename)
   3.533 +{
   3.534 +    assert(data);
   3.535 +    if (data == NULL)
   3.536 +        return E_INVALIDARG;
   3.537 +
   3.538 +    CComSafeArray<BYTE> sa_data(data);
   3.539 +    size_t len = sa_data.GetCount();
   3.540 +
   3.541 +    char *_data = (char *) malloc(sa_data.GetCount());
   3.542 +    assert(_data);
   3.543 +    if (_data == NULL)
   3.544 +        return E_OUTOFMEMORY;
   3.545 +
   3.546 +    memcpy(_data, sa_data.m_psa->pvData, len);
   3.547 +    sa_data.Detach();
   3.548 +
   3.549 +    string _mime_type;
   3.550 +    if (mime_type) {
   3.551 +        try {
   3.552 +            _mime_type = utf8_string(mime_type);
   3.553 +        }
   3.554 +        catch (bad_alloc& e) {
   3.555 +            free(_data);
   3.556 +            return E_OUTOFMEMORY;
   3.557 +        }
   3.558 +        catch (exception& e) {
   3.559 +            free(_data);
   3.560 +            return E_FAIL;
   3.561 +        }
   3.562 +    }
   3.563 +
   3.564 +    string _filename;
   3.565 +    if (filename) {
   3.566 +        try {
   3.567 +            _filename = utf8_string(filename);
   3.568 +        }
   3.569 +        catch (bad_alloc& e) {
   3.570 +            free(_data);
   3.571 +            return E_OUTOFMEMORY;
   3.572 +        }
   3.573 +        catch (exception& e) {
   3.574 +            free(_data);
   3.575 +            return E_FAIL;
   3.576 +        }
   3.577 +    }
   3.578 +
   3.579 +    bloblist_t *blob = bloblist_add(msg->attachments, _data, len, _mime_type.c_str(), _filename.c_str());
   3.580 +    if (blob == NULL) {
   3.581 +        free(_data);
   3.582 +        return E_OUTOFMEMORY;
   3.583 +    }
   3.584 +
   3.585 +    return S_OK;
   3.586 +}
   3.587 +
   3.588 +STDMETHODIMP CTextMessage::has_attachments(boolean *result)
   3.589 +{
   3.590 +    assert(result);
   3.591 +
   3.592 +    if (msg->attachments == NULL || msg->attachments->data == NULL) {
   3.593 +        m_next_attachment = NULL;
   3.594 +        *result = false;
   3.595 +        return S_OK;
   3.596 +    }
   3.597 +
   3.598 +    m_next_attachment = msg->attachments;
   3.599 +    *result = true;
   3.600 +
   3.601 +    return S_OK;
   3.602 +}
   3.603 +
   3.604 +STDMETHODIMP CTextMessage::next_attachment(SAFEARRAY ** data, BSTR * mime_type, BSTR * filename, boolean *result)
   3.605 +{
   3.606 +    assert(data);
   3.607 +    assert(mime_type);
   3.608 +    assert(filename);
   3.609 +    assert(result);
   3.610 +
   3.611 +    if (m_next_attachment == NULL)
   3.612 +        return E_ILLEGAL_METHOD_CALL;
   3.613 +
   3.614 +    CComSafeArray<BYTE> sa;
   3.615 +    try {
   3.616 +        sa.Create(m_next_attachment->size);
   3.617 +    }
   3.618 +    catch (bad_alloc& e) {
   3.619 +        return E_OUTOFMEMORY;
   3.620 +    }
   3.621 +
   3.622 +    memcpy(sa.m_psa->pvData, m_next_attachment->data, m_next_attachment->size);
   3.623 +
   3.624 +    _bstr_t _mime_type;
   3.625 +    if (m_next_attachment->mime_type) {
   3.626 +        try {
   3.627 +            _mime_type = utf16_bstr(m_next_attachment->mime_type);
   3.628 +        }
   3.629 +        catch (bad_alloc& e) {
   3.630 +            return E_OUTOFMEMORY;
   3.631 +        }
   3.632 +        catch (exception& e) {
   3.633 +            return E_FAIL;
   3.634 +        }
   3.635 +    }
   3.636 +
   3.637 +    _bstr_t _filename;
   3.638 +    if (m_next_attachment->filename) {
   3.639 +        try {
   3.640 +            _filename = utf16_bstr(m_next_attachment->filename);
   3.641 +        }
   3.642 +        catch (bad_alloc& e) {
   3.643 +            return E_OUTOFMEMORY;
   3.644 +        }
   3.645 +        catch (exception& e) {
   3.646 +            return E_FAIL;
   3.647 +        }
   3.648 +    }
   3.649 +
   3.650 +    *data = sa.Detach();
   3.651 +    *mime_type = _mime_type.Detach();
   3.652 +    *filename = _filename.Detach();
   3.653 +
   3.654 +    m_next_attachment = m_next_attachment->next;
   3.655 +    *result = m_next_attachment != NULL;
   3.656 +
   3.657 +    return S_OK;
   3.658 +}
   3.659 +
   3.660 +STDMETHODIMP CTextMessage::get_sent(hyper * result)
   3.661 +{
   3.662 +    assert(result);
   3.663 +
   3.664 +    if (msg->sent == NULL)
   3.665 +        return E_NOT_SET;
   3.666 +
   3.667 +    *result = mktime(msg->sent);
   3.668 +    return S_OK;
   3.669 +}
   3.670 +
   3.671 +STDMETHODIMP CTextMessage::put_sent(hyper val)
   3.672 +{
   3.673 +    ::timestamp * ts = new_timestamp(val);
   3.674 +    if (ts == NULL)
   3.675 +        return E_OUTOFMEMORY;
   3.676 +
   3.677 +    if (msg->sent)
   3.678 +        free_timestamp(msg->sent);
   3.679 +    msg->sent = ts;
   3.680 +
   3.681 +    return S_OK;
   3.682 +}
   3.683 +
   3.684 +STDMETHODIMP CTextMessage::get_recv(hyper * result)
   3.685 +{
   3.686 +    assert(result);
   3.687 +
   3.688 +    if (msg->recv == NULL)
   3.689 +        return E_NOT_SET;
   3.690 +
   3.691 +    *result = mktime(msg->recv);
   3.692 +    return S_OK;
   3.693 +}
   3.694 +
   3.695 +STDMETHODIMP CTextMessage::put_recv(hyper val)
   3.696 +{
   3.697 +    ::timestamp * ts = new_timestamp(val);
   3.698 +    if (ts == NULL)
   3.699 +        return E_OUTOFMEMORY;
   3.700 +
   3.701 +    if (msg->recv)
   3.702 +        free_timestamp(msg->recv);
   3.703 +    msg->recv = ts;
   3.704 +
   3.705 +    return S_OK;
   3.706 +}
   3.707 +
   3.708 +STDMETHODIMP CTextMessage::get_references(SAFEARRAY ** pVal)
   3.709 +{
   3.710 +    assert(pVal);
   3.711 +
   3.712 +    CComSafeArray<BSTR> sa;
   3.713 +    try {
   3.714 +        if (msg->references) {
   3.715 +            sa = string_array(msg->references);
   3.716 +        }
   3.717 +        else {
   3.718 +            sa.Create(0UL);
   3.719 +        }
   3.720 +    }
   3.721 +    catch (bad_alloc& e) {
   3.722 +        return E_OUTOFMEMORY;
   3.723 +    }
   3.724 +    catch (exception& e) {
   3.725 +        return E_FAIL;
   3.726 +    }
   3.727 +    
   3.728 +    *pVal = sa.Detach();
   3.729 +    return S_OK;
   3.730 +}
   3.731 +
   3.732 +STDMETHODIMP CTextMessage::put_references(SAFEARRAY * newVal)
   3.733 +{
   3.734 +    assert(newVal);
   3.735 +
   3.736 +    stringlist_t *sl;
   3.737 +    
   3.738 +    try {
   3.739 +        sl = new_stringlist(newVal);
   3.740 +    }
   3.741 +    catch (bad_alloc& e) {
   3.742 +        return E_OUTOFMEMORY;
   3.743 +    }
   3.744 +    catch (exception& e) {
   3.745 +        return E_FAIL;
   3.746 +    }
   3.747 +
   3.748 +    if (msg->references)
   3.749 +        free_stringlist(msg->references);
   3.750 +
   3.751 +    msg->references = sl;
   3.752 +
   3.753 +    return S_OK;
   3.754 +}
   3.755 +
   3.756 +STDMETHODIMP CTextMessage::get_keywords(SAFEARRAY ** pVal)
   3.757 +{
   3.758 +    assert(pVal);
   3.759 +
   3.760 +    CComSafeArray<BSTR> sa;
   3.761 +    try {
   3.762 +        if (msg->keywords) {
   3.763 +            sa = string_array(msg->keywords);
   3.764 +        }
   3.765 +        else {
   3.766 +            sa.Create(0UL);
   3.767 +        }
   3.768 +    }
   3.769 +    catch (bad_alloc& e) {
   3.770 +        return E_OUTOFMEMORY;
   3.771 +    }
   3.772 +    catch (exception& e) {
   3.773 +        return E_FAIL;
   3.774 +    }
   3.775 +
   3.776 +    *pVal = sa.Detach();
   3.777 +    return S_OK;
   3.778 +}
   3.779 +
   3.780 +STDMETHODIMP CTextMessage::put_keywords(SAFEARRAY * newVal)
   3.781 +{
   3.782 +    assert(newVal);
   3.783 +
   3.784 +    stringlist_t *sl;
   3.785 +
   3.786 +    try {
   3.787 +        sl = new_stringlist(newVal);
   3.788 +    }
   3.789 +    catch (bad_alloc& e) {
   3.790 +        return E_OUTOFMEMORY;
   3.791 +    }
   3.792 +    catch (exception& e) {
   3.793 +        return E_FAIL;
   3.794 +    }
   3.795 +
   3.796 +    if (msg->keywords)
   3.797 +        free_stringlist(msg->keywords);
   3.798 +
   3.799 +    msg->keywords = sl;
   3.800 +
   3.801 +    return S_OK;
   3.802 +}
   3.803 +
   3.804 +STDMETHODIMP CTextMessage::get_comments(BSTR * pVal)
   3.805 +{
   3.806 +    assert(pVal);
   3.807 +
   3.808 +    _bstr_t val;
   3.809 +
   3.810 +    if (msg->comments) {
   3.811 +        try {
   3.812 +            val = utf16_bstr(msg->comments);
   3.813 +        }
   3.814 +        catch (bad_alloc& e) {
   3.815 +            return E_OUTOFMEMORY;
   3.816 +        }
   3.817 +        catch (exception& e) {
   3.818 +            return E_FAIL;
   3.819 +        }
   3.820 +    }
   3.821 +
   3.822 +    *pVal = val.Detach();
   3.823 +
   3.824 +    return S_OK;
   3.825 +}
   3.826 +
   3.827 +STDMETHODIMP CTextMessage::put_comments(BSTR newVal)
   3.828 +{
   3.829 +    assert(newVal);
   3.830 +
   3.831 +    string val;
   3.832 +
   3.833 +    try {
   3.834 +        val = utf8_string(newVal);
   3.835 +    }
   3.836 +    catch (bad_alloc& e) {
   3.837 +        return E_OUTOFMEMORY;
   3.838 +    }
   3.839 +    catch (exception& e) {
   3.840 +        return E_FAIL;
   3.841 +    }
   3.842 +
   3.843 +    if (msg->comments)
   3.844 +        free(msg->comments);
   3.845 +
   3.846 +    msg->comments = _strdup(val.c_str());
   3.847 +    if (msg->comments == NULL)
   3.848 +        return E_OUTOFMEMORY;
   3.849 +
   3.850 +    return S_OK;
   3.851 +}
     4.1 --- a/TextMessage.h	Wed Apr 29 09:49:18 2015 +0200
     4.2 +++ b/TextMessage.h	Fri May 01 00:24:12 2015 +0200
     4.3 @@ -28,9 +28,11 @@
     4.4  {
     4.5  private:
     4.6      ::message *msg;
     4.7 +    ::bloblist_t *m_next_attachment;
     4.8  
     4.9  public:
    4.10 -	CTextMessage()
    4.11 +    CTextMessage()
    4.12 +        : m_next_attachment(NULL)
    4.13  	{
    4.14          msg = (::message *) calloc(1, sizeof(::message));
    4.15          assert(msg);
    4.16 @@ -39,6 +41,7 @@
    4.17  	}
    4.18  
    4.19      CTextMessage(const CTextMessage& second)
    4.20 +        : m_next_attachment(NULL)
    4.21      {
    4.22          msg = ::message_dup(second.msg);
    4.23          assert(msg);
    4.24 @@ -47,6 +50,7 @@
    4.25      }
    4.26  
    4.27      CTextMessage(const ::message *second)
    4.28 +        : m_next_attachment(NULL)
    4.29      {
    4.30          assert(second);
    4.31          msg = ::message_dup(second);
    4.32 @@ -89,11 +93,57 @@
    4.33  	}
    4.34  
    4.35  public:
    4.36 +    STDMETHOD(get_dir)(pEp_msg_direction * pVal);
    4.37 +    STDMETHOD(put_dir)(pEp_msg_direction newVal);
    4.38 +
    4.39 +    STDMETHOD(get_id)(BSTR * pVal);
    4.40 +    STDMETHOD(put_id)(BSTR newVal);
    4.41 +
    4.42 +    STDMETHOD(get_shortmsg)(BSTR * pVal);
    4.43 +    STDMETHOD(put_shortmsg)(BSTR newVal);
    4.44 +
    4.45 +    STDMETHOD(get_longmsg)(BSTR * pVal);
    4.46 +    STDMETHOD(put_longmsg)(BSTR newVal);
    4.47 +
    4.48 +    STDMETHOD(get_longmsg_formatted)(BSTR * pVal);
    4.49 +    STDMETHOD(put_longmsg_formatted)(BSTR newVal);
    4.50 +
    4.51 +    STDMETHOD(add_attachment)(SAFEARRAY * data, BSTR mime_type, BSTR filename);
    4.52 +    STDMETHOD(has_attachments)(boolean *result);
    4.53 +    STDMETHOD(next_attachment)(SAFEARRAY ** data, BSTR * mime_type, BSTR * filename, boolean *result);
    4.54 +
    4.55 +    STDMETHOD(get_sent)(hyper * result);
    4.56 +    STDMETHOD(put_sent)(hyper val);
    4.57 +
    4.58 +    STDMETHOD(get_recv)(hyper * result);
    4.59 +    STDMETHOD(put_recv)(hyper val);
    4.60 +
    4.61      STDMETHOD(get_from)(pEp_identity_s * pVal);
    4.62      STDMETHOD(put_from)(pEp_identity_s * newVal);
    4.63  
    4.64      STDMETHOD(get_to)(LPSAFEARRAY * pVal);
    4.65      STDMETHOD(put_to)(SAFEARRAY * newVal);
    4.66 +
    4.67 +    STDMETHOD(get_recv_by)(pEp_identity_s * pVal);
    4.68 +    STDMETHOD(put_recv_by)(pEp_identity_s * newVal);
    4.69 +
    4.70 +    STDMETHOD(get_cc)(LPSAFEARRAY * pVal);
    4.71 +    STDMETHOD(put_cc)(SAFEARRAY * newVal);
    4.72 +
    4.73 +    STDMETHOD(get_bcc)(LPSAFEARRAY * pVal);
    4.74 +    STDMETHOD(put_bcc)(SAFEARRAY * newVal);
    4.75 +
    4.76 +    STDMETHOD(get_reply_to)(LPSAFEARRAY * pVal);
    4.77 +    STDMETHOD(put_reply_to)(SAFEARRAY * newVal);
    4.78 +
    4.79 +    STDMETHOD(get_references)(SAFEARRAY ** pVal);
    4.80 +    STDMETHOD(put_references)(SAFEARRAY * newVal);
    4.81 +
    4.82 +    STDMETHOD(get_keywords)(SAFEARRAY ** pVal);
    4.83 +    STDMETHOD(put_keywords)(SAFEARRAY * newVal);
    4.84 +
    4.85 +    STDMETHOD(get_comments)(BSTR * pVal);
    4.86 +    STDMETHOD(put_comments)(BSTR newVal);
    4.87  };
    4.88  
    4.89  OBJECT_ENTRY_AUTO(__uuidof(TextMessage), CTextMessage)
     5.1 --- a/pEpCOMServerAdapter.idl	Wed Apr 29 09:49:18 2015 +0200
     5.2 +++ b/pEpCOMServerAdapter.idl	Fri May 01 00:24:12 2015 +0200
     5.3 @@ -7,7 +7,92 @@
     5.4  import "oaidl.idl";
     5.5  import "ocidl.idl";
     5.6  
     5.7 -interface IMessageAPI_Outlook;
     5.8 +
     5.9 +[
    5.10 +    object,
    5.11 +    uuid(161538F9-53C8-4D9C-8BA4-0FB43AEC7106),
    5.12 +    oleautomation,
    5.13 +    nonextensible,
    5.14 +    pointer_default(unique)
    5.15 +]
    5.16 +interface ITextMessage : IUnknown {
    5.17 +    typedef enum _pEp_text_format {
    5.18 +        pEp_text_format_plain = 0,
    5.19 +        pEp_text_format_html,
    5.20 +        pEp_text_format_other = 0xff
    5.21 +    } pEp_text_format;
    5.22 +
    5.23 +    typedef enum _pEp_msg_direction {
    5.24 +        pEp_dir_incoming = 0,
    5.25 +        pEp_dir_outgoing
    5.26 +    } pEp_msg_direction;
    5.27 +
    5.28 +    typedef enum _pEp_MIME_format {
    5.29 +        pEp_MIME_none = 0,                      // message is not MIME encoded
    5.30 +        pEp_MIME_fields_omitted,                // message content but no fields
    5.31 +        pEp_MIME                                // message is fully MIME encoded
    5.32 +    } pEp_MIME_format;
    5.33 +
    5.34 +    typedef enum _pEp_enc_format {
    5.35 +        pEp_enc_none = 0,                       // message is not encrypted
    5.36 +        pEp_enc_pieces,                         // inline PGP + PGP extensions
    5.37 +        pEp_enc_S_MIME,                         // RFC5751
    5.38 +        pEp_enc_PGP_MIME,                       // RFC3156
    5.39 +        pEp_enc_pEp                             // pEp encryption format
    5.40 +    } pEp_enc_format;
    5.41 +
    5.42 +    [propget] HRESULT dir([out, retval] pEp_msg_direction *pVal);
    5.43 +    [propput] HRESULT dir([in] pEp_msg_direction newVal);
    5.44 +
    5.45 +    [propget] HRESULT id([out, retval] BSTR *pVal);
    5.46 +    [propput] HRESULT id([in] BSTR newVal);
    5.47 +
    5.48 +    [propget] HRESULT shortmsg([out, retval] BSTR *pVal);
    5.49 +    [propput] HRESULT shortmsg([in] BSTR newVal);
    5.50 +
    5.51 +    [propget] HRESULT longmsg([out, retval] BSTR *pVal);
    5.52 +    [propput] HRESULT longmsg([in] BSTR newVal);
    5.53 +
    5.54 +    [propget] HRESULT longmsg_formatted([out, retval] BSTR *pVal);
    5.55 +    [propput] HRESULT longmsg_formatted([in] BSTR newVal);
    5.56 +
    5.57 +    HRESULT add_attachment([in] SAFEARRAY(BYTE) data, [in, optional] BSTR mime_type, [in, optional] BSTR filename);
    5.58 +    HRESULT has_attachments([out, retval] boolean *result);
    5.59 +    HRESULT next_attachment([out] SAFEARRAY(BYTE) * data, [out] BSTR * mime_type, [out] BSTR * filename, [out, retval] boolean *result);
    5.60 +
    5.61 +    [propget] HRESULT sent([out, retval] hyper * result);
    5.62 +    [propput] HRESULT sent([in] hyper val);
    5.63 +
    5.64 +    [propget] HRESULT recv([out, retval] hyper * result);
    5.65 +    [propput] HRESULT recv([in] hyper val);
    5.66 +
    5.67 +    [propget] HRESULT from([out, retval] struct pEp_identity_s *pVal);
    5.68 +    [propput] HRESULT from([in] struct pEp_identity_s *newVal);
    5.69 +
    5.70 +    [propget] HRESULT to([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    5.71 +    [propput] HRESULT to([in] SAFEARRAY(struct pEp_identity_s) newVal);
    5.72 +
    5.73 +    [propget] HRESULT recv_by([out, retval] struct pEp_identity_s *pVal);
    5.74 +    [propput] HRESULT recv_by([in] struct pEp_identity_s *newVal);
    5.75 +
    5.76 +    [propget] HRESULT cc([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    5.77 +    [propput] HRESULT cc([in] SAFEARRAY(struct pEp_identity_s) newVal);
    5.78 +
    5.79 +    [propget] HRESULT bcc([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    5.80 +    [propput] HRESULT bcc([in] SAFEARRAY(struct pEp_identity_s) newVal);
    5.81 +
    5.82 +    [propget] HRESULT reply_to([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
    5.83 +    [propput] HRESULT reply_to([in] SAFEARRAY(struct pEp_identity_s) newVal);
    5.84 +
    5.85 +    [propget] HRESULT references([out, retval] SAFEARRAY(BSTR) *pVal);
    5.86 +    [propput] HRESULT references([in] SAFEARRAY(BSTR) newVal);
    5.87 +
    5.88 +    [propget] HRESULT keywords([out, retval] SAFEARRAY(BSTR) *pVal);
    5.89 +    [propput] HRESULT keywords([in] SAFEARRAY(BSTR) newVal);
    5.90 +
    5.91 +    [propget] HRESULT comments([out, retval] BSTR *pVal);
    5.92 +    [propput] HRESULT comments([in] BSTR newVal);
    5.93 +};
    5.94  
    5.95  [
    5.96      object,
    5.97 @@ -120,57 +205,28 @@
    5.98      HRESULT myself([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
    5.99      HRESULT update_identity([in] struct pEp_identity_s *ident, [out, retval] struct pEp_identity_s *result);
   5.100      HRESULT key_compromized([in] BSTR fpr);
   5.101 -};
   5.102  
   5.103 +    // Message API
   5.104  
   5.105 -[
   5.106 -    object,
   5.107 -    uuid(161538F9-53C8-4D9C-8BA4-0FB43AEC7106),
   5.108 -    oleautomation,
   5.109 -    nonextensible,
   5.110 -    pointer_default(unique)
   5.111 -]
   5.112 -interface ITextMessage : IUnknown {
   5.113 +    typedef enum _pEp_color {
   5.114 +        pEp_undefined = 0,
   5.115 +        pEp_unencrypted,
   5.116 +        pEp_unreliable,
   5.117 +        pEp_reliable,
   5.118 +        pEp_yellow = pEp_reliable,
   5.119 +        pEp_trusted,
   5.120 +        pEp_green = pEp_trusted,
   5.121 +        pEp_trusted_and_anonymized,
   5.122 +        pEp_fully_anonymous,
   5.123  
   5.124 -    [propget] HRESULT from([out, retval] struct pEp_identity_s *pVal);
   5.125 -    [propput] HRESULT from([in] struct pEp_identity_s *newVal);
   5.126 +        pEp_under_attack = -1,
   5.127 +        pEp_red = pEp_under_attack,
   5.128 +        pEp_b0rken = -2
   5.129 +    } pEp_color;
   5.130  
   5.131 -    [propget] HRESULT to([out, retval] SAFEARRAY(struct pEp_identity_s) *pVal);
   5.132 -    [propput] HRESULT to([in] SAFEARRAY(struct pEp_identity_s) newVal);
   5.133 -};
   5.134 -
   5.135 -[
   5.136 -    object,
   5.137 -    uuid(BC9AB54D-2CDA-47A5-AB40-64857B9E9555),
   5.138 -    oleautomation,
   5.139 -    nonextensible,
   5.140 -    pointer_default(unique)
   5.141 -]
   5.142 -interface IMessageAPI_Outlook : IUnknown {
   5.143 -    typedef enum _pEp_text_format {
   5.144 -        pEp_text_format_plain = 0,
   5.145 -        pEp_text_format_html,
   5.146 -        pEp_text_format_other = 0xff
   5.147 -    } pEp_text_format;
   5.148 -
   5.149 -    typedef enum _pEp_msg_direction {
   5.150 -        pEp_dir_incoming = 0,
   5.151 -        pEp_dir_outgoing
   5.152 -    } pEp_msg_direction;
   5.153 -
   5.154 -    typedef enum _pEp_MIME_format {
   5.155 -        pEp_MIME_none = 0,                      // message is not MIME encoded
   5.156 -        pEp_MIME_fields_omitted,                // message content but no fields
   5.157 -        pEp_MIME                                // message is fully MIME encoded
   5.158 -    } pEp_MIME_format;
   5.159 -
   5.160 -    typedef enum _pEp_enc_format {
   5.161 -        pEp_enc_none = 0,                       // message is not encrypted
   5.162 -        pEp_enc_pieces,                         // inline PGP + PGP extensions
   5.163 -        pEp_enc_S_MIME,                         // RFC5751
   5.164 -        pEp_enc_PGP_MIME,                       // RFC3156
   5.165 -        pEp_enc_pEp                             // pEp encryption format
   5.166 -    } pEp_enc_format;
   5.167 +    HRESULT message_encrypt([in] ITextMessage *src, [out] ITextMessage ** dst, [in, optional] SAFEARRAY(BSTR) extra);
   5.168 +    HRESULT message_decrypt([in] ITextMessage *src, [out] ITextMessage ** dst);
   5.169 +    HRESULT message_color([in] ITextMessage *msg, [out, retval] pEp_color * pVal);
   5.170  };
   5.171  
   5.172  [
   5.173 @@ -194,7 +250,6 @@
   5.174      coclass pEpEngine {
   5.175          [default] interface IpEpEngine;
   5.176          [default, source] dispinterface _IpEpEngineEvents;
   5.177 -        interface IMessageAPI_Outlook;
   5.178      };
   5.179  	[
   5.180  		uuid(844B5363-4EF4-4A39-A030-16452783A6F7)		
   5.181 @@ -213,4 +268,3 @@
   5.182  		[default, source] dispinterface _ITextMessageEvents;
   5.183  	};
   5.184  };
   5.185 -