inetcomm: Implement IMimeBody DeleteProp.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Alistair Leslie-Hughes 2016-07-01 07:57:07 +00:00 committed by Alexandre Julliard
parent 173515e733
commit 2854c92d63
2 changed files with 74 additions and 2 deletions

View File

@ -898,8 +898,27 @@ static HRESULT WINAPI MimeBody_DeleteProp(
LPCSTR pszName)
{
MimeBody *This = impl_from_IMimeBody(iface);
FIXME("(%p)->(%s) stub\n", This, debugstr_a(pszName));
return E_NOTIMPL;
header_t *cursor;
BOOL found;
TRACE("(%p)->(%s) stub\n", This, debugstr_a(pszName));
LIST_FOR_EACH_ENTRY(cursor, &This->headers, header_t, entry)
{
if(ISPIDSTR(pszName))
found = STRTOPID(pszName) == cursor->prop->id;
else
found = !lstrcmpiA(pszName, cursor->prop->name);
if(found)
{
list_remove(&cursor->entry);
HeapFree(GetProcessHeap(), 0, cursor);
return S_OK;
}
}
return MIME_E_NOT_FOUND;
}
static HRESULT WINAPI MimeBody_CopyProps(

View File

@ -604,6 +604,58 @@ static void test_BindToObject(void)
IMimeMessage_Release(msg);
}
static void test_BodyDeleteProp(void)
{
static const char topic[] = "wine topic";
HRESULT hr;
IMimeMessage *msg;
IMimeBody *body;
PROPVARIANT prop;
hr = MimeOleCreateMessage(NULL, &msg);
ok(hr == S_OK, "ret %08x\n", hr);
PropVariantInit(&prop);
hr = IMimeMessage_BindToObject(msg, HBODY_ROOT, &IID_IMimeBody, (void**)&body);
ok(hr == S_OK, "ret %08x\n", hr);
hr = IMimeBody_DeleteProp(body, "Subject");
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT));
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
prop.vt = VT_LPSTR;
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
strcpy(prop.u.pszVal, topic);
hr = IMimeBody_SetProp(body, "Subject", 0, &prop);
ok(hr == S_OK, "ret %08x\n", hr);
PropVariantClear(&prop);
hr = IMimeBody_DeleteProp(body, "Subject");
ok(hr == S_OK, "ret %08x\n", hr);
hr = IMimeBody_GetProp(body, "Subject", 0, &prop);
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
prop.vt = VT_LPSTR;
prop.u.pszVal = CoTaskMemAlloc(strlen(topic)+1);
strcpy(prop.u.pszVal, topic);
hr = IMimeBody_SetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
ok(hr == S_OK, "ret %08x\n", hr);
PropVariantClear(&prop);
hr = IMimeBody_DeleteProp(body, PIDTOSTR(PID_HDR_SUBJECT));
ok(hr == S_OK, "ret %08x\n", hr);
hr = IMimeBody_GetProp(body, PIDTOSTR(PID_HDR_SUBJECT), 0, &prop);
ok(hr == MIME_E_NOT_FOUND, "ret %08x\n", hr);
IMimeBody_Release(body);
IMimeMessage_Release(msg);
}
static void test_MimeOleGetPropertySchema(void)
{
HRESULT hr;
@ -627,6 +679,7 @@ START_TEST(mimeole)
test_MessageGetPropInfo();
test_MessageOptions();
test_BindToObject();
test_BodyDeleteProp();
test_MimeOleGetPropertySchema();
OleUninitialize();
}