inetcomm: Implement IMimeMessage_GetAttachments.
This commit is contained in:
parent
869b10b430
commit
02ceeef288
|
@ -2279,8 +2279,38 @@ static HRESULT WINAPI MimeMessage_GetAttachments(
|
||||||
ULONG *pcAttach,
|
ULONG *pcAttach,
|
||||||
LPHBODY *pprghAttach)
|
LPHBODY *pprghAttach)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p, %p)\n", iface, pcAttach, pprghAttach);
|
HRESULT hr;
|
||||||
return E_NOTIMPL;
|
FINDBODY find_struct;
|
||||||
|
HBODY hbody;
|
||||||
|
LPHBODY array;
|
||||||
|
ULONG size = 10;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p, %p)\n", iface, pcAttach, pprghAttach);
|
||||||
|
|
||||||
|
*pcAttach = 0;
|
||||||
|
array = CoTaskMemAlloc(size * sizeof(HBODY));
|
||||||
|
|
||||||
|
find_struct.pszPriType = find_struct.pszSubType = NULL;
|
||||||
|
hr = IMimeMessage_FindFirst(iface, &find_struct, &hbody);
|
||||||
|
while(hr == S_OK)
|
||||||
|
{
|
||||||
|
hr = IMimeMessage_IsContentType(iface, hbody, "multipart", NULL);
|
||||||
|
TRACE("IsCT rets %08x %d\n", hr, *pcAttach);
|
||||||
|
if(hr != S_OK)
|
||||||
|
{
|
||||||
|
if(*pcAttach + 1 > size)
|
||||||
|
{
|
||||||
|
size *= 2;
|
||||||
|
array = CoTaskMemRealloc(array, size * sizeof(HBODY));
|
||||||
|
}
|
||||||
|
array[*pcAttach] = hbody;
|
||||||
|
(*pcAttach)++;
|
||||||
|
}
|
||||||
|
hr = IMimeMessage_FindNext(iface, &find_struct, &hbody);
|
||||||
|
}
|
||||||
|
|
||||||
|
*pprghAttach = array;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MimeMessage_GetAddressTable(
|
static HRESULT WINAPI MimeMessage_GetAddressTable(
|
||||||
|
|
|
@ -215,6 +215,7 @@ static void test_CreateMessage(void)
|
||||||
ULONG count;
|
ULONG count;
|
||||||
FINDBODY find_struct;
|
FINDBODY find_struct;
|
||||||
char text[] = "text";
|
char text[] = "text";
|
||||||
|
HBODY *body_list;
|
||||||
|
|
||||||
hr = MimeOleCreateMessage(NULL, &msg);
|
hr = MimeOleCreateMessage(NULL, &msg);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr);
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
@ -282,6 +283,11 @@ static void test_CreateMessage(void)
|
||||||
hr = IMimeMessage_FindNext(msg, &find_struct, &hbody);
|
hr = IMimeMessage_FindNext(msg, &find_struct, &hbody);
|
||||||
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IMimeMessage_GetAttachments(msg, &count, &body_list);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
ok(count == 2, "got %d\n", count);
|
||||||
|
CoTaskMemFree(body_list);
|
||||||
|
|
||||||
IMimeMessage_Release(msg);
|
IMimeMessage_Release(msg);
|
||||||
|
|
||||||
ref = IStream_AddRef(stream);
|
ref = IStream_AddRef(stream);
|
||||||
|
|
Loading…
Reference in New Issue