inetcomm: Implement IMimeBody:SetData.
This commit is contained in:
parent
dd66f04c21
commit
ef59756ace
|
@ -104,6 +104,8 @@ typedef struct MimeBody
|
||||||
char *content_pri_type;
|
char *content_pri_type;
|
||||||
char *content_sub_type;
|
char *content_sub_type;
|
||||||
ENCODINGTYPE encoding;
|
ENCODINGTYPE encoding;
|
||||||
|
void *data;
|
||||||
|
IID data_iid;
|
||||||
} MimeBody;
|
} MimeBody;
|
||||||
|
|
||||||
static inline MimeBody *impl_from_IMimeBody( IMimeBody *iface )
|
static inline MimeBody *impl_from_IMimeBody( IMimeBody *iface )
|
||||||
|
@ -431,6 +433,16 @@ static void empty_new_prop_list(struct list *list)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void release_data(REFIID riid, void *data)
|
||||||
|
{
|
||||||
|
if(!data) return;
|
||||||
|
|
||||||
|
if(IsEqualIID(riid, &IID_IStream))
|
||||||
|
IStream_Release((IStream *)data);
|
||||||
|
else
|
||||||
|
FIXME("Unhandled data format %s\n", debugstr_guid(riid));
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MimeBody_QueryInterface(IMimeBody* iface,
|
static HRESULT WINAPI MimeBody_QueryInterface(IMimeBody* iface,
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
void** ppvObject)
|
void** ppvObject)
|
||||||
|
@ -480,6 +492,9 @@ static ULONG WINAPI MimeBody_Release(IMimeBody* iface)
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->content_pri_type);
|
HeapFree(GetProcessHeap(), 0, This->content_pri_type);
|
||||||
HeapFree(GetProcessHeap(), 0, This->content_sub_type);
|
HeapFree(GetProcessHeap(), 0, This->content_sub_type);
|
||||||
|
|
||||||
|
release_data(&This->data_iid, This->data);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,8 +833,31 @@ static HRESULT WINAPI MimeBody_SetData(
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPVOID pvObject)
|
LPVOID pvObject)
|
||||||
{
|
{
|
||||||
FIXME("stub\n");
|
MimeBody *This = impl_from_IMimeBody(iface);
|
||||||
return E_NOTIMPL;
|
TRACE("(%p)->(%d, %s, %s, %s %p)\n", This, ietEncoding, debugstr_a(pszPriType), debugstr_a(pszSubType),
|
||||||
|
debugstr_guid(riid), pvObject);
|
||||||
|
|
||||||
|
if(IsEqualIID(riid, &IID_IStream))
|
||||||
|
IStream_AddRef((IStream *)pvObject);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FIXME("Unhandled object type %s\n", debugstr_guid(riid));
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(This->data)
|
||||||
|
FIXME("release old data\n");
|
||||||
|
|
||||||
|
This->data_iid = *riid;
|
||||||
|
This->data = pvObject;
|
||||||
|
|
||||||
|
IMimeBody_SetCurrentEncoding(iface, ietEncoding);
|
||||||
|
|
||||||
|
/* FIXME: Update the content type.
|
||||||
|
If pszPriType == NULL use 'application'
|
||||||
|
If pszSubType == NULL use 'octet-stream' */
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MimeBody_EmptyData(
|
static HRESULT WINAPI MimeBody_EmptyData(
|
||||||
|
@ -934,6 +972,8 @@ HRESULT MimeBody_create(IUnknown *outer, void **obj)
|
||||||
This->content_pri_type = NULL;
|
This->content_pri_type = NULL;
|
||||||
This->content_sub_type = NULL;
|
This->content_sub_type = NULL;
|
||||||
This->encoding = IET_7BIT;
|
This->encoding = IET_7BIT;
|
||||||
|
This->data = NULL;
|
||||||
|
This->data_iid = IID_NULL;
|
||||||
|
|
||||||
*obj = (IMimeBody *)&This->lpVtbl;
|
*obj = (IMimeBody *)&This->lpVtbl;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define INITGUID
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -28,7 +27,10 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
#include "winerror.h"
|
#include "winerror.h"
|
||||||
|
#include "objbase.h"
|
||||||
|
#include "ocidl.h"
|
||||||
|
|
||||||
|
#include "initguid.h"
|
||||||
#include "inetcomm_private.h"
|
#include "inetcomm_private.h"
|
||||||
#include "mimeole.h"
|
#include "mimeole.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ SRCDIR = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
TESTDLL = inetcomm.dll
|
TESTDLL = inetcomm.dll
|
||||||
IMPORTS = inetcomm ole32 kernel32
|
IMPORTS = inetcomm ole32 kernel32
|
||||||
EXTRALIBS =
|
EXTRALIBS = -luuid
|
||||||
|
|
||||||
CTESTS = \
|
CTESTS = \
|
||||||
mimeole.c
|
mimeole.c
|
||||||
|
|
|
@ -125,6 +125,15 @@ static void test_CreateBody(void)
|
||||||
hr = IMimeBody_IsContentType(body, NULL, "mixed");
|
hr = IMimeBody_IsContentType(body, NULL, "mixed");
|
||||||
ok(hr == S_OK, "ret %08x\n", hr);
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IMimeBody_SetData(body, IET_8BIT, "text", "plain", &IID_IStream, in);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
hr = IMimeBody_IsContentType(body, "text", "plain");
|
||||||
|
todo_wine
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
hr = IMimeBody_GetCurrentEncoding(body, &enc);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
ok(enc == IET_8BIT, "encoding %d\n", enc);
|
||||||
|
|
||||||
IMimeBody_Release(body);
|
IMimeBody_Release(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue