Alistair Leslie-Hughes : inetcomm: Implement IMimeBody DeleteProp.

Alexandre Julliard julliard at winehq.org
Wed Jul 6 09:57:31 CDT 2016


Module: wine
Branch: master
Commit: 2854c92d6315ae9a550092fa2273be96f34393f6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2854c92d6315ae9a550092fa2273be96f34393f6

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Fri Jul  1 07:57:07 2016 +0000

inetcomm: Implement IMimeBody DeleteProp.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/inetcomm/mimeole.c       | 23 +++++++++++++++++--
 dlls/inetcomm/tests/mimeole.c | 53 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c
index 766503d..2ccc162 100644
--- a/dlls/inetcomm/mimeole.c
+++ b/dlls/inetcomm/mimeole.c
@@ -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(
diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c
index 8063b86..46fd1d5 100644
--- a/dlls/inetcomm/tests/mimeole.c
+++ b/dlls/inetcomm/tests/mimeole.c
@@ -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();
 }




More information about the wine-cvs mailing list