inetcomm: Implement IMimeMessage_Find{First,Next}.
This commit is contained in:
parent
8be6df3434
commit
d56033eedf
|
@ -1921,13 +1921,49 @@ static HRESULT WINAPI MimeMessage_CountBodies(
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HRESULT find_next(IMimeMessage *msg, LPFINDBODY find_body, HBODY *out)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
IMimeBody *mime_body;
|
||||||
|
HBODY next;
|
||||||
|
|
||||||
|
if(find_body->dwReserved == 0)
|
||||||
|
find_body->dwReserved = (DWORD)HBODY_ROOT;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hr = IMimeMessage_GetBody(msg, IBL_FIRST, (HBODY)find_body->dwReserved, &next);
|
||||||
|
if(hr == S_OK)
|
||||||
|
find_body->dwReserved = (DWORD)next;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hr = IMimeMessage_GetBody(msg, IBL_NEXT, (HBODY)find_body->dwReserved, &next);
|
||||||
|
if(hr == S_OK)
|
||||||
|
find_body->dwReserved = (DWORD)next;
|
||||||
|
else
|
||||||
|
return MIME_E_NOT_FOUND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = IMimeMessage_BindToObject(msg, (HBODY)find_body->dwReserved, &IID_IMimeBody, (void**)&mime_body);
|
||||||
|
if(IMimeBody_IsContentType(mime_body, find_body->pszPriType, find_body->pszSubType) == S_OK)
|
||||||
|
{
|
||||||
|
IMimeBody_Release(mime_body);
|
||||||
|
*out = (HBODY)find_body->dwReserved;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
IMimeBody_Release(mime_body);
|
||||||
|
return find_next(msg, find_body, out);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MimeMessage_FindFirst(
|
static HRESULT WINAPI MimeMessage_FindFirst(
|
||||||
IMimeMessage *iface,
|
IMimeMessage *iface,
|
||||||
LPFINDBODY pFindBody,
|
LPFINDBODY pFindBody,
|
||||||
LPHBODY phBody)
|
LPHBODY phBody)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
|
TRACE("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
pFindBody->dwReserved = 0;
|
||||||
|
return find_next(iface, pFindBody, phBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MimeMessage_FindNext(
|
static HRESULT WINAPI MimeMessage_FindNext(
|
||||||
|
@ -1935,8 +1971,9 @@ static HRESULT WINAPI MimeMessage_FindNext(
|
||||||
LPFINDBODY pFindBody,
|
LPFINDBODY pFindBody,
|
||||||
LPHBODY phBody)
|
LPHBODY phBody)
|
||||||
{
|
{
|
||||||
FIXME("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
|
TRACE("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
return find_next(iface, pFindBody, phBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MimeMessage_ResolveURL(
|
static HRESULT WINAPI MimeMessage_ResolveURL(
|
||||||
|
|
|
@ -213,6 +213,8 @@ static void test_CreateMessage(void)
|
||||||
IMimeBody *body;
|
IMimeBody *body;
|
||||||
BODYOFFSETS offsets;
|
BODYOFFSETS offsets;
|
||||||
ULONG count;
|
ULONG count;
|
||||||
|
FINDBODY find_struct;
|
||||||
|
char text[] = "text";
|
||||||
|
|
||||||
hr = MimeOleCreateMessage(NULL, &msg);
|
hr = MimeOleCreateMessage(NULL, &msg);
|
||||||
ok(hr == S_OK, "ret %08x\n", hr);
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
@ -268,6 +270,17 @@ static void test_CreateMessage(void)
|
||||||
ok(offsets.cbBodyEnd == 639, "got %d\n", offsets.cbBodyEnd);
|
ok(offsets.cbBodyEnd == 639, "got %d\n", offsets.cbBodyEnd);
|
||||||
IMimeBody_Release(body);
|
IMimeBody_Release(body);
|
||||||
|
|
||||||
|
find_struct.pszPriType = text;
|
||||||
|
find_struct.pszSubType = NULL;
|
||||||
|
|
||||||
|
hr = IMimeMessage_FindFirst(msg, &find_struct, &hbody);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IMimeMessage_FindNext(msg, &find_struct, &hbody);
|
||||||
|
ok(hr == S_OK, "ret %08x\n", hr);
|
||||||
|
|
||||||
|
hr = IMimeMessage_FindNext(msg, &find_struct, &hbody);
|
||||||
|
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
|
||||||
|
|
||||||
IMimeMessage_Release(msg);
|
IMimeMessage_Release(msg);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue