Huw Davies : inetcomm: Implement IMimeMessage_Find{First,Next}.
Alexandre Julliard
julliard at winehq.org
Wed Feb 13 10:40:06 CST 2008
Module: wine
Branch: master
Commit: d56033eedfdc2a04ca3d22f331297bd418d498ac
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d56033eedfdc2a04ca3d22f331297bd418d498ac
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Feb 12 12:18:26 2008 +0000
inetcomm: Implement IMimeMessage_Find{First,Next}.
---
dlls/inetcomm/mimeole.c | 45 +++++++++++++++++++++++++++++++++++++---
dlls/inetcomm/tests/mimeole.c | 13 +++++++++++
2 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c
index d6b4274..6398f29 100644
--- a/dlls/inetcomm/mimeole.c
+++ b/dlls/inetcomm/mimeole.c
@@ -1921,13 +1921,49 @@ static HRESULT WINAPI MimeMessage_CountBodies(
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(
IMimeMessage *iface,
LPFINDBODY pFindBody,
LPHBODY phBody)
{
- FIXME("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
- return E_NOTIMPL;
+ TRACE("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
+
+ pFindBody->dwReserved = 0;
+ return find_next(iface, pFindBody, phBody);
}
static HRESULT WINAPI MimeMessage_FindNext(
@@ -1935,8 +1971,9 @@ static HRESULT WINAPI MimeMessage_FindNext(
LPFINDBODY pFindBody,
LPHBODY phBody)
{
- FIXME("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
- return E_NOTIMPL;
+ TRACE("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
+
+ return find_next(iface, pFindBody, phBody);
}
static HRESULT WINAPI MimeMessage_ResolveURL(
diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c
index c40952f..ee53d15 100644
--- a/dlls/inetcomm/tests/mimeole.c
+++ b/dlls/inetcomm/tests/mimeole.c
@@ -213,6 +213,8 @@ static void test_CreateMessage(void)
IMimeBody *body;
BODYOFFSETS offsets;
ULONG count;
+ FINDBODY find_struct;
+ char text[] = "text";
hr = MimeOleCreateMessage(NULL, &msg);
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);
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);
More information about the wine-cvs
mailing list