TextMessage.cpp
author Volker Birk <vb@pep-project.org>
Fri, 24 Apr 2015 17:19:41 +0200
changeset 8 6fe51215f252
child 10 15fd256d4adb
permissions -rw-r--r--
starting TextMessage implementation
     1 // TextMessage.cpp : Implementation of CTextMessage
     2 
     3 #include "stdafx.h"
     4 #include "TextMessage.h"
     5 
     6 
     7 // CTextMessage
     8 
     9 STDMETHODIMP CTextMessage::InterfaceSupportsErrorInfo(REFIID riid)
    10 {
    11 	static const IID* const arr[] = 
    12 	{
    13 		&IID_ITextMessage
    14 	};
    15 
    16 	for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
    17 	{
    18 		if (InlineIsEqualGUID(*arr[i],riid))
    19 			return S_OK;
    20 	}
    21 	return S_FALSE;
    22 }
    23 
    24 
    25 STDMETHODIMP CTextMessage::get_from(pEp_identity_s* pVal)
    26 {
    27     try {
    28         copy_identity(pVal, msg->from);
    29     }
    30     catch (bad_alloc& e) {
    31         return E_OUTOFMEMORY;
    32     }
    33     catch (exception& e) {
    34         return E_FAIL;
    35     }
    36 
    37     return S_OK;
    38 }
    39 
    40 
    41 STDMETHODIMP CTextMessage::put_from(pEp_identity_s* newVal)
    42 {
    43     ::pEp_identity *_from;
    44     
    45     try {
    46         _from = new_identity(newVal);
    47     }
    48     catch (bad_alloc& e) {
    49         return E_OUTOFMEMORY;
    50     }
    51     catch (exception& e)
    52     {
    53         return E_FAIL;
    54     }
    55 
    56     ::free_identity(msg->from);
    57     msg->from = _from;
    58     return S_OK;
    59 }