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