4 * Copyright 2006 Robert Shearman for CodeWeavers
5 * Copyright 2007 Huw Davies for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
34 #include "wine/list.h"
35 #include "wine/debug.h"
37 #include "inetcomm_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(inetcomm
);
45 DWORD flags
; /* MIMEPROPFLAGS */
53 } property_list_entry_t
;
55 static const property_t default_props
[] =
57 {"References", PID_HDR_REFS
, 0, VT_LPSTR
},
58 {"Subject", PID_HDR_SUBJECT
, 0, VT_LPSTR
},
59 {"From", PID_HDR_FROM
, MPF_ADDRESS
, VT_LPSTR
},
60 {"Message-ID", PID_HDR_MESSAGEID
, 0, VT_LPSTR
},
61 {"Return-Path", PID_HDR_RETURNPATH
, MPF_ADDRESS
, VT_LPSTR
},
62 {"Date", PID_HDR_DATE
, 0, VT_LPSTR
},
63 {"Received", PID_HDR_RECEIVED
, 0, VT_LPSTR
},
64 {"Reply-To", PID_HDR_REPLYTO
, MPF_ADDRESS
, VT_LPSTR
},
65 {"X-Mailer", PID_HDR_XMAILER
, 0, VT_LPSTR
},
66 {"Bcc", PID_HDR_BCC
, MPF_ADDRESS
, VT_LPSTR
},
67 {"MIME-Version", PID_HDR_MIMEVER
, MPF_MIME
, VT_LPSTR
},
68 {"Content-Type", PID_HDR_CNTTYPE
, MPF_MIME
| MPF_HASPARAMS
, VT_LPSTR
},
69 {"Content-Transfer-Encoding", PID_HDR_CNTXFER
, MPF_MIME
, VT_LPSTR
},
70 {"Content-ID", PID_HDR_CNTID
, MPF_MIME
, VT_LPSTR
},
71 {"Content-Disposition", PID_HDR_CNTDISP
, MPF_MIME
, VT_LPSTR
},
72 {"To", PID_HDR_TO
, MPF_ADDRESS
, VT_LPSTR
},
73 {"Cc", PID_HDR_CC
, MPF_ADDRESS
, VT_LPSTR
},
74 {"Sender", PID_HDR_SENDER
, MPF_ADDRESS
, VT_LPSTR
},
75 {"In-Reply-To", PID_HDR_INREPLYTO
, 0, VT_LPSTR
},
89 const property_t
*prop
;
94 typedef struct MimeBody
96 const IMimeBodyVtbl
*lpVtbl
;
102 struct list new_props
; /* FIXME: This should be in a PropertySchema */
104 char *content_pri_type
;
105 char *content_sub_type
;
106 ENCODINGTYPE encoding
;
111 static inline MimeBody
*impl_from_IMimeBody( IMimeBody
*iface
)
113 return (MimeBody
*)((char*)iface
- FIELD_OFFSET(MimeBody
, lpVtbl
));
116 static LPSTR
strdupA(LPCSTR str
)
119 int len
= strlen(str
);
120 ret
= HeapAlloc(GetProcessHeap(), 0, len
+ 1);
121 memcpy(ret
, str
, len
+ 1);
125 #define PARSER_BUF_SIZE 1024
127 /*****************************************************
128 * copy_headers_to_buf [internal]
130 * Copies the headers into a '\0' terminated memory block and leave
131 * the stream's current position set to after the blank line.
133 static HRESULT
copy_headers_to_buf(IStream
*stm
, char **ptr
)
136 DWORD size
= PARSER_BUF_SIZE
, offset
= 0, last_end
= 0;
148 buf
= HeapAlloc(GetProcessHeap(), 0, size
+ 1);
152 buf
= HeapReAlloc(GetProcessHeap(), 0, buf
, size
+ 1);
160 hr
= IStream_Read(stm
, buf
+ offset
, size
- offset
, &read
);
161 if(FAILED(hr
)) goto fail
;
166 if(read
== 0) done
= 1;
168 while(!done
&& (end
= strstr(buf
+ last_end
, "\r\n")))
170 DWORD new_end
= end
- buf
+ 2;
171 if(new_end
- last_end
== 2)
174 off
.QuadPart
= new_end
;
175 IStream_Seek(stm
, off
, STREAM_SEEK_SET
, NULL
);
188 HeapFree(GetProcessHeap(), 0, buf
);
192 static header_t
*read_prop(MimeBody
*body
, char **ptr
)
194 char *colon
= strchr(*ptr
, ':');
195 const property_t
*prop
;
198 if(!colon
) return NULL
;
202 for(prop
= default_props
; prop
->name
; prop
++)
204 if(!strcasecmp(*ptr
, prop
->name
))
206 TRACE("%s: found match with default property id %d\n", *ptr
, prop
->id
);
213 property_list_entry_t
*prop_entry
;
214 LIST_FOR_EACH_ENTRY(prop_entry
, &body
->new_props
, property_list_entry_t
, entry
)
216 if(!strcasecmp(*ptr
, prop_entry
->prop
.name
))
218 TRACE("%s: found match with already added new property id %d\n", *ptr
, prop_entry
->prop
.id
);
219 prop
= &prop_entry
->prop
;
225 prop_entry
= HeapAlloc(GetProcessHeap(), 0, sizeof(*prop_entry
));
226 prop_entry
->prop
.name
= strdupA(*ptr
);
227 prop_entry
->prop
.id
= body
->next_prop_id
++;
228 prop_entry
->prop
.flags
= 0;
229 prop_entry
->prop
.default_vt
= VT_LPSTR
;
230 list_add_tail(&body
->new_props
, &prop_entry
->entry
);
231 prop
= &prop_entry
->prop
;
232 TRACE("%s: allocating new prop id %d\n", *ptr
, prop_entry
->prop
.id
);
236 ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(*ret
));
238 PropVariantInit(&ret
->value
);
239 list_init(&ret
->params
);
245 static void unfold_header(char *header
, int len
)
247 char *start
= header
, *cp
= header
;
250 while(*cp
== ' ' || *cp
== '\t')
256 memmove(start
, cp
, len
+ 1);
258 cp
= strstr(start
, "\r\n");
265 } while(*cp
== ' ' || *cp
== '\t');
270 static void add_param(header_t
*header
, const char *p
)
272 const char *key
= p
, *value
, *cp
= p
;
276 TRACE("got param %s\n", p
);
278 while (*key
== ' ' || *key
== '\t' ) key
++;
280 cp
= strchr(key
, '=');
283 WARN("malformed parameter - skipping\n");
287 name
= HeapAlloc(GetProcessHeap(), 0, cp
- key
+ 1);
288 memcpy(name
, key
, cp
- key
);
289 name
[cp
- key
] = '\0';
293 param
= HeapAlloc(GetProcessHeap(), 0, sizeof(*param
));
295 param
->value
= strdupA(value
);
296 list_add_tail(&header
->params
, ¶m
->entry
);
299 static void split_params(header_t
*header
, char *value
)
301 char *cp
= value
, *start
= value
;
307 if(!in_quote
&& *cp
== ';')
310 if(done_value
) add_param(header
, start
);
315 in_quote
= !in_quote
;
318 if(done_value
) add_param(header
, start
);
321 static void read_value(header_t
*header
, char **cur
)
323 char *end
= *cur
, *value
;
327 end
= strstr(end
, "\r\n");
329 } while(*end
== ' ' || *end
== '\t');
332 value
= HeapAlloc(GetProcessHeap(), 0, len
+ 1);
333 memcpy(value
, *cur
, len
);
336 unfold_header(value
, len
);
337 TRACE("value %s\n", debugstr_a(value
));
339 if(header
->prop
->flags
& MPF_HASPARAMS
)
341 split_params(header
, value
);
342 TRACE("value w/o params %s\n", debugstr_a(value
));
345 header
->value
.vt
= VT_LPSTR
;
346 header
->value
.pszVal
= value
;
351 static void init_content_type(MimeBody
*body
, header_t
*header
)
356 if(header
->prop
->id
!= PID_HDR_CNTTYPE
)
358 ERR("called with header %s\n", header
->prop
->name
);
362 slash
= strchr(header
->value
.pszVal
, '/');
365 WARN("malformed context type value\n");
368 len
= slash
- header
->value
.pszVal
;
369 body
->content_pri_type
= HeapAlloc(GetProcessHeap(), 0, len
+ 1);
370 memcpy(body
->content_pri_type
, header
->value
.pszVal
, len
);
371 body
->content_pri_type
[len
] = '\0';
372 body
->content_sub_type
= strdupA(slash
+ 1);
375 static HRESULT
parse_headers(MimeBody
*body
, IStream
*stm
)
377 char *header_buf
, *cur_header_ptr
;
381 hr
= copy_headers_to_buf(stm
, &header_buf
);
382 if(FAILED(hr
)) return hr
;
384 cur_header_ptr
= header_buf
;
385 while((header
= read_prop(body
, &cur_header_ptr
)))
387 read_value(header
, &cur_header_ptr
);
388 list_add_tail(&body
->headers
, &header
->entry
);
390 if(header
->prop
->id
== PID_HDR_CNTTYPE
)
391 init_content_type(body
, header
);
394 HeapFree(GetProcessHeap(), 0, header_buf
);
398 static void emptry_param_list(struct list
*list
)
400 param_t
*param
, *cursor2
;
402 LIST_FOR_EACH_ENTRY_SAFE(param
, cursor2
, list
, param_t
, entry
)
404 list_remove(¶m
->entry
);
405 HeapFree(GetProcessHeap(), 0, param
->name
);
406 HeapFree(GetProcessHeap(), 0, param
->value
);
407 HeapFree(GetProcessHeap(), 0, param
);
411 static void empty_header_list(struct list
*list
)
413 header_t
*header
, *cursor2
;
415 LIST_FOR_EACH_ENTRY_SAFE(header
, cursor2
, list
, header_t
, entry
)
417 list_remove(&header
->entry
);
418 PropVariantClear(&header
->value
);
419 emptry_param_list(&header
->params
);
420 HeapFree(GetProcessHeap(), 0, header
);
424 static void empty_new_prop_list(struct list
*list
)
426 property_list_entry_t
*prop
, *cursor2
;
428 LIST_FOR_EACH_ENTRY_SAFE(prop
, cursor2
, list
, property_list_entry_t
, entry
)
430 list_remove(&prop
->entry
);
431 HeapFree(GetProcessHeap(), 0, (char *)prop
->prop
.name
);
432 HeapFree(GetProcessHeap(), 0, prop
);
436 static void release_data(REFIID riid
, void *data
)
440 if(IsEqualIID(riid
, &IID_IStream
))
441 IStream_Release((IStream
*)data
);
443 FIXME("Unhandled data format %s\n", debugstr_guid(riid
));
446 static HRESULT WINAPI
MimeBody_QueryInterface(IMimeBody
* iface
,
450 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(riid
), ppvObject
);
454 if (IsEqualIID(riid
, &IID_IUnknown
) ||
455 IsEqualIID(riid
, &IID_IPersist
) ||
456 IsEqualIID(riid
, &IID_IPersistStreamInit
) ||
457 IsEqualIID(riid
, &IID_IMimePropertySet
) ||
458 IsEqualIID(riid
, &IID_IMimeBody
))
465 IUnknown_AddRef((IUnknown
*)*ppvObject
);
469 FIXME("no interface for %s\n", debugstr_guid(riid
));
470 return E_NOINTERFACE
;
473 static ULONG WINAPI
MimeBody_AddRef(IMimeBody
* iface
)
475 MimeBody
*This
= impl_from_IMimeBody(iface
);
476 TRACE("(%p)->()\n", iface
);
477 return InterlockedIncrement(&This
->refs
);
480 static ULONG WINAPI
MimeBody_Release(IMimeBody
* iface
)
482 MimeBody
*This
= impl_from_IMimeBody(iface
);
485 TRACE("(%p)->()\n", iface
);
487 refs
= InterlockedDecrement(&This
->refs
);
490 empty_header_list(&This
->headers
);
491 empty_new_prop_list(&This
->new_props
);
493 HeapFree(GetProcessHeap(), 0, This
->content_pri_type
);
494 HeapFree(GetProcessHeap(), 0, This
->content_sub_type
);
496 release_data(&This
->data_iid
, This
->data
);
498 HeapFree(GetProcessHeap(), 0, This
);
504 static HRESULT WINAPI
MimeBody_GetClassID(
513 static HRESULT WINAPI
MimeBody_IsDirty(
520 static HRESULT WINAPI
MimeBody_Load(
524 MimeBody
*This
= impl_from_IMimeBody(iface
);
525 TRACE("(%p)->(%p)\n", iface
, pStm
);
526 return parse_headers(This
, pStm
);
529 static HRESULT WINAPI
MimeBody_Save(
538 static HRESULT WINAPI
MimeBody_GetSizeMax(
540 ULARGE_INTEGER
* pcbSize
)
546 static HRESULT WINAPI
MimeBody_InitNew(
549 TRACE("%p->()\n", iface
);
553 static HRESULT WINAPI
MimeBody_GetPropInfo(
556 LPMIMEPROPINFO pInfo
)
562 static HRESULT WINAPI
MimeBody_SetPropInfo(
565 LPCMIMEPROPINFO pInfo
)
571 static HRESULT WINAPI
MimeBody_GetProp(
575 LPPROPVARIANT pValue
)
581 static HRESULT WINAPI
MimeBody_SetProp(
585 LPCPROPVARIANT pValue
)
591 static HRESULT WINAPI
MimeBody_AppendProp(
595 LPPROPVARIANT pValue
)
601 static HRESULT WINAPI
MimeBody_DeleteProp(
609 static HRESULT WINAPI
MimeBody_CopyProps(
613 IMimePropertySet
* pPropertySet
)
619 static HRESULT WINAPI
MimeBody_MoveProps(
623 IMimePropertySet
* pPropertySet
)
629 static HRESULT WINAPI
MimeBody_DeleteExcept(
638 static HRESULT WINAPI
MimeBody_QueryProp(
643 boolean fCaseSensitive
)
649 static HRESULT WINAPI
MimeBody_GetCharset(
651 LPHCHARSET phCharset
)
657 static HRESULT WINAPI
MimeBody_SetCharset(
660 CSETAPPLYTYPE applytype
)
666 static HRESULT WINAPI
MimeBody_GetParameters(
670 LPMIMEPARAMINFO
* pprgParam
)
676 static HRESULT WINAPI
MimeBody_IsContentType(
681 MimeBody
*This
= impl_from_IMimeBody(iface
);
683 TRACE("(%p)->(%s, %s)\n", This
, debugstr_a(pszPriType
), debugstr_a(pszSubType
));
686 const char *pri
= This
->content_pri_type
;
687 if(!pri
) pri
= "text";
688 if(strcasecmp(pri
, pszPriType
)) return S_FALSE
;
693 const char *sub
= This
->content_sub_type
;
694 if(!sub
) sub
= "plain";
695 if(strcasecmp(sub
, pszSubType
)) return S_FALSE
;
701 static HRESULT WINAPI
MimeBody_BindToObject(
710 static HRESULT WINAPI
MimeBody_Clone(
712 IMimePropertySet
** ppPropertySet
)
718 static HRESULT WINAPI
MimeBody_SetOption(
721 LPCPROPVARIANT pValue
)
727 static HRESULT WINAPI
MimeBody_GetOption(
730 LPPROPVARIANT pValue
)
736 static HRESULT WINAPI
MimeBody_EnumProps(
739 IMimeEnumProperties
** ppEnum
)
745 static HRESULT WINAPI
MimeBody_IsType(
747 IMSGBODYTYPE bodytype
)
753 static HRESULT WINAPI
MimeBody_SetDisplayName(
761 static HRESULT WINAPI
MimeBody_GetDisplayName(
769 static HRESULT WINAPI
MimeBody_GetOffsets(
771 LPBODYOFFSETS pOffsets
)
777 static HRESULT WINAPI
MimeBody_GetCurrentEncoding(
779 ENCODINGTYPE
* pietEncoding
)
781 MimeBody
*This
= impl_from_IMimeBody(iface
);
783 TRACE("(%p)->(%p)\n", This
, pietEncoding
);
785 *pietEncoding
= This
->encoding
;
789 static HRESULT WINAPI
MimeBody_SetCurrentEncoding(
791 ENCODINGTYPE ietEncoding
)
793 MimeBody
*This
= impl_from_IMimeBody(iface
);
795 TRACE("(%p)->(%d)\n", This
, ietEncoding
);
797 This
->encoding
= ietEncoding
;
801 static HRESULT WINAPI
MimeBody_GetEstimatedSize(
803 ENCODINGTYPE ietEncoding
,
810 static HRESULT WINAPI
MimeBody_GetDataHere(
812 ENCODINGTYPE ietEncoding
,
819 static HRESULT WINAPI
MimeBody_GetData(
821 ENCODINGTYPE ietEncoding
,
828 static HRESULT WINAPI
MimeBody_SetData(
830 ENCODINGTYPE ietEncoding
,
836 MimeBody
*This
= impl_from_IMimeBody(iface
);
837 TRACE("(%p)->(%d, %s, %s, %s %p)\n", This
, ietEncoding
, debugstr_a(pszPriType
), debugstr_a(pszSubType
),
838 debugstr_guid(riid
), pvObject
);
840 if(IsEqualIID(riid
, &IID_IStream
))
841 IStream_AddRef((IStream
*)pvObject
);
844 FIXME("Unhandled object type %s\n", debugstr_guid(riid
));
849 FIXME("release old data\n");
851 This
->data_iid
= *riid
;
852 This
->data
= pvObject
;
854 IMimeBody_SetCurrentEncoding(iface
, ietEncoding
);
856 /* FIXME: Update the content type.
857 If pszPriType == NULL use 'application'
858 If pszSubType == NULL use 'octet-stream' */
863 static HRESULT WINAPI
MimeBody_EmptyData(
870 static HRESULT WINAPI
MimeBody_CopyTo(
878 static HRESULT WINAPI
MimeBody_GetTransmitInfo(
880 LPTRANSMITINFO pTransmitInfo
)
886 static HRESULT WINAPI
MimeBody_SaveToFile(
888 ENCODINGTYPE ietEncoding
,
895 static HRESULT WINAPI
MimeBody_GetHandle(
899 MimeBody
*This
= impl_from_IMimeBody(iface
);
900 TRACE("(%p)->(%p)\n", iface
, phBody
);
902 *phBody
= This
->handle
;
903 return This
->handle
? S_OK
: MIME_E_NO_DATA
;
906 static IMimeBodyVtbl body_vtbl
=
908 MimeBody_QueryInterface
,
917 MimeBody_GetPropInfo
,
918 MimeBody_SetPropInfo
,
925 MimeBody_DeleteExcept
,
929 MimeBody_GetParameters
,
930 MimeBody_IsContentType
,
931 MimeBody_BindToObject
,
937 MimeBody_SetDisplayName
,
938 MimeBody_GetDisplayName
,
940 MimeBody_GetCurrentEncoding
,
941 MimeBody_SetCurrentEncoding
,
942 MimeBody_GetEstimatedSize
,
943 MimeBody_GetDataHere
,
948 MimeBody_GetTransmitInfo
,
953 #define FIRST_CUSTOM_PROP_ID 0x100
955 HRESULT
MimeBody_create(IUnknown
*outer
, void **obj
)
961 if(outer
) return CLASS_E_NOAGGREGATION
;
963 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
964 if (!This
) return E_OUTOFMEMORY
;
966 This
->lpVtbl
= &body_vtbl
;
969 list_init(&This
->headers
);
970 list_init(&This
->new_props
);
971 This
->next_prop_id
= FIRST_CUSTOM_PROP_ID
;
972 This
->content_pri_type
= NULL
;
973 This
->content_sub_type
= NULL
;
974 This
->encoding
= IET_7BIT
;
976 This
->data_iid
= IID_NULL
;
978 *obj
= (IMimeBody
*)&This
->lpVtbl
;
982 typedef struct MimeMessage
984 const IMimeMessageVtbl
*lpVtbl
;
989 static HRESULT WINAPI
MimeMessage_QueryInterface(IMimeMessage
*iface
, REFIID riid
, void **ppv
)
991 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(riid
), ppv
);
993 if (IsEqualIID(riid
, &IID_IUnknown
) ||
994 IsEqualIID(riid
, &IID_IPersist
) ||
995 IsEqualIID(riid
, &IID_IPersistStreamInit
) ||
996 IsEqualIID(riid
, &IID_IMimeMessageTree
) ||
997 IsEqualIID(riid
, &IID_IMimeMessage
))
1000 IUnknown_AddRef(iface
);
1004 FIXME("no interface for %s\n", debugstr_guid(riid
));
1006 return E_NOINTERFACE
;
1009 static ULONG WINAPI
MimeMessage_AddRef(IMimeMessage
*iface
)
1011 MimeMessage
*This
= (MimeMessage
*)iface
;
1012 TRACE("(%p)->()\n", iface
);
1013 return InterlockedIncrement(&This
->refs
);
1016 static ULONG WINAPI
MimeMessage_Release(IMimeMessage
*iface
)
1018 MimeMessage
*This
= (MimeMessage
*)iface
;
1021 TRACE("(%p)->()\n", iface
);
1023 refs
= InterlockedDecrement(&This
->refs
);
1026 HeapFree(GetProcessHeap(), 0, This
);
1032 /*** IPersist methods ***/
1033 static HRESULT WINAPI
MimeMessage_GetClassID(
1034 IMimeMessage
*iface
,
1037 FIXME("(%p)->(%p)\n", iface
, pClassID
);
1041 /*** IPersistStreamInit methods ***/
1042 static HRESULT WINAPI
MimeMessage_IsDirty(
1043 IMimeMessage
*iface
)
1045 FIXME("(%p)->()\n", iface
);
1049 static HRESULT WINAPI
MimeMessage_Load(
1050 IMimeMessage
*iface
,
1052 FIXME("(%p)->(%p)\n", iface
, pStm
);
1056 static HRESULT WINAPI
MimeMessage_Save(
1057 IMimeMessage
*iface
,
1061 FIXME("(%p)->(%p, %s)\n", iface
, pStm
, fClearDirty
? "TRUE" : "FALSE");
1065 static HRESULT WINAPI
MimeMessage_GetSizeMax(
1066 IMimeMessage
*iface
,
1067 ULARGE_INTEGER
*pcbSize
)
1069 FIXME("(%p)->(%p)\n", iface
, pcbSize
);
1073 static HRESULT WINAPI
MimeMessage_InitNew(
1074 IMimeMessage
*iface
)
1076 FIXME("(%p)->()\n", iface
);
1080 /*** IMimeMessageTree methods ***/
1081 static HRESULT WINAPI
MimeMessage_GetMessageSource(
1082 IMimeMessage
*iface
,
1086 FIXME("(%p)->(%p, 0x%x)\n", iface
, ppStream
, dwFlags
);
1090 static HRESULT WINAPI
MimeMessage_GetMessageSize(
1091 IMimeMessage
*iface
,
1095 FIXME("(%p)->(%p, 0x%x)\n", iface
, pcbSize
, dwFlags
);
1099 static HRESULT WINAPI
MimeMessage_LoadOffsetTable(
1100 IMimeMessage
*iface
,
1103 FIXME("(%p)->(%p)\n", iface
, pStream
);
1107 static HRESULT WINAPI
MimeMessage_SaveOffsetTable(
1108 IMimeMessage
*iface
,
1112 FIXME("(%p)->(%p, 0x%x)\n", iface
, pStream
, dwFlags
);
1117 static HRESULT WINAPI
MimeMessage_GetFlags(
1118 IMimeMessage
*iface
,
1121 FIXME("(%p)->(%p)\n", iface
, pdwFlags
);
1125 static HRESULT WINAPI
MimeMessage_Commit(
1126 IMimeMessage
*iface
,
1129 FIXME("(%p)->(0x%x)\n", iface
, dwFlags
);
1134 static HRESULT WINAPI
MimeMessage_HandsOffStorage(
1135 IMimeMessage
*iface
)
1137 FIXME("(%p)->()\n", iface
);
1141 static HRESULT WINAPI
MimeMessage_BindToObject(
1142 IMimeMessage
*iface
,
1147 FIXME("(%p)->(%p, %s, %p)\n", iface
, hBody
, debugstr_guid(riid
), ppvObject
);
1151 static HRESULT WINAPI
MimeMessage_SaveBody(
1152 IMimeMessage
*iface
,
1157 FIXME("(%p)->(%p, 0x%x, %p)\n", iface
, hBody
, dwFlags
, pStream
);
1161 static HRESULT WINAPI
MimeMessage_InsertBody(
1162 IMimeMessage
*iface
,
1163 BODYLOCATION location
,
1167 FIXME("(%p)->(%d, %p, %p)\n", iface
, location
, hPivot
, phBody
);
1171 static HRESULT WINAPI
MimeMessage_GetBody(
1172 IMimeMessage
*iface
,
1173 BODYLOCATION location
,
1177 FIXME("(%p)->(%d, %p, %p)\n", iface
, location
, hPivot
, phBody
);
1181 static HRESULT WINAPI
MimeMessage_DeleteBody(
1182 IMimeMessage
*iface
,
1186 FIXME("(%p)->(%p, %08x)\n", iface
, hBody
, dwFlags
);
1190 static HRESULT WINAPI
MimeMessage_MoveBody(
1191 IMimeMessage
*iface
,
1193 BODYLOCATION location
)
1195 FIXME("(%p)->(%d)\n", iface
, location
);
1199 static HRESULT WINAPI
MimeMessage_CountBodies(
1200 IMimeMessage
*iface
,
1205 FIXME("(%p)->(%p, %s, %p)\n", iface
, hParent
, fRecurse
? "TRUE" : "FALSE", pcBodies
);
1209 static HRESULT WINAPI
MimeMessage_FindFirst(
1210 IMimeMessage
*iface
,
1211 LPFINDBODY pFindBody
,
1214 FIXME("(%p)->(%p, %p)\n", iface
, pFindBody
, phBody
);
1218 static HRESULT WINAPI
MimeMessage_FindNext(
1219 IMimeMessage
*iface
,
1220 LPFINDBODY pFindBody
,
1223 FIXME("(%p)->(%p, %p)\n", iface
, pFindBody
, phBody
);
1227 static HRESULT WINAPI
MimeMessage_ResolveURL(
1228 IMimeMessage
*iface
,
1235 FIXME("(%p)->(%p, %s, %s, 0x%x, %p)\n", iface
, hRelated
, pszBase
, pszURL
, dwFlags
, phBody
);
1239 static HRESULT WINAPI
MimeMessage_ToMultipart(
1240 IMimeMessage
*iface
,
1243 LPHBODY phMultipart
)
1245 FIXME("(%p)->(%p, %s, %p)\n", iface
, hBody
, pszSubType
, phMultipart
);
1249 static HRESULT WINAPI
MimeMessage_GetBodyOffsets(
1250 IMimeMessage
*iface
,
1252 LPBODYOFFSETS pOffsets
)
1254 FIXME("(%p)->(%p, %p)\n", iface
, hBody
, pOffsets
);
1258 static HRESULT WINAPI
MimeMessage_GetCharset(
1259 IMimeMessage
*iface
,
1260 LPHCHARSET phCharset
)
1262 FIXME("(%p)->(%p)\n", iface
, phCharset
);
1266 static HRESULT WINAPI
MimeMessage_SetCharset(
1267 IMimeMessage
*iface
,
1269 CSETAPPLYTYPE applytype
)
1271 FIXME("(%p)->(%p, %d)\n", iface
, hCharset
, applytype
);
1275 static HRESULT WINAPI
MimeMessage_IsBodyType(
1276 IMimeMessage
*iface
,
1278 IMSGBODYTYPE bodytype
)
1280 FIXME("(%p)->(%p, %d)\n", iface
, hBody
, bodytype
);
1284 static HRESULT WINAPI
MimeMessage_IsContentType(
1285 IMimeMessage
*iface
,
1290 FIXME("(%p)->(%p, %s, %s)\n", iface
, hBody
, pszPriType
, pszSubType
);
1294 static HRESULT WINAPI
MimeMessage_QueryBodyProp(
1295 IMimeMessage
*iface
,
1300 boolean fCaseSensitive
)
1302 FIXME("(%p)->(%p, %s, %s, %s, %s)\n", iface
, hBody
, pszName
, pszCriteria
, fSubString
? "TRUE" : "FALSE", fCaseSensitive
? "TRUE" : "FALSE");
1306 static HRESULT WINAPI
MimeMessage_GetBodyProp(
1307 IMimeMessage
*iface
,
1311 LPPROPVARIANT pValue
)
1313 FIXME("(%p)->(%p, %s, 0x%x, %p)\n", iface
, hBody
, pszName
, dwFlags
, pValue
);
1317 static HRESULT WINAPI
MimeMessage_SetBodyProp(
1318 IMimeMessage
*iface
,
1322 LPCPROPVARIANT pValue
)
1324 FIXME("(%p)->(%p, %s, 0x%x, %p)\n", iface
, hBody
, pszName
, dwFlags
, pValue
);
1328 static HRESULT WINAPI
MimeMessage_DeleteBodyProp(
1329 IMimeMessage
*iface
,
1333 FIXME("(%p)->(%p, %s)\n", iface
, hBody
, pszName
);
1337 static HRESULT WINAPI
MimeMessage_SetOption(
1338 IMimeMessage
*iface
,
1340 LPCPROPVARIANT pValue
)
1342 FIXME("(%p)->(%d, %p)\n", iface
, oid
, pValue
);
1346 static HRESULT WINAPI
MimeMessage_GetOption(
1347 IMimeMessage
*iface
,
1349 LPPROPVARIANT pValue
)
1351 FIXME("(%p)->(%d, %p)\n", iface
, oid
, pValue
);
1355 /*** IMimeMessage methods ***/
1356 static HRESULT WINAPI
MimeMessage_CreateWebPage(
1357 IMimeMessage
*iface
,
1359 LPWEBPAGEOPTIONS pOptions
,
1360 IMimeMessageCallback
*pCallback
,
1361 IMoniker
**ppMoniker
)
1363 FIXME("(%p)->(%p, %p, %p, %p)\n", iface
, pRootStm
, pOptions
, pCallback
, ppMoniker
);
1368 static HRESULT WINAPI
MimeMessage_GetProp(
1369 IMimeMessage
*iface
,
1372 LPPROPVARIANT pValue
)
1374 FIXME("(%p)->(%s, 0x%x, %p)\n", iface
, pszName
, dwFlags
, pValue
);
1378 static HRESULT WINAPI
MimeMessage_SetProp(
1379 IMimeMessage
*iface
,
1382 LPCPROPVARIANT pValue
)
1384 FIXME("(%p)->(%s, 0x%x, %p)\n", iface
, pszName
, dwFlags
, pValue
);
1388 static HRESULT WINAPI
MimeMessage_DeleteProp(
1389 IMimeMessage
*iface
,
1392 FIXME("(%p)->(%s)\n", iface
, pszName
);
1396 static HRESULT WINAPI
MimeMessage_QueryProp(
1397 IMimeMessage
*iface
,
1401 boolean fCaseSensitive
)
1403 FIXME("(%p)->(%s, %s, %s, %s)\n", iface
, pszName
, pszCriteria
, fSubString
? "TRUE" : "FALSE", fCaseSensitive
? "TRUE" : "FALSE");
1407 static HRESULT WINAPI
MimeMessage_GetTextBody(
1408 IMimeMessage
*iface
,
1410 ENCODINGTYPE ietEncoding
,
1414 FIXME("(%p)->(%d, %d, %p, %p)\n", iface
, dwTxtType
, ietEncoding
, pStream
, phBody
);
1418 static HRESULT WINAPI
MimeMessage_SetTextBody(
1419 IMimeMessage
*iface
,
1421 ENCODINGTYPE ietEncoding
,
1426 FIXME("(%p)->(%d, %d, %p, %p, %p)\n", iface
, dwTxtType
, ietEncoding
, hAlternative
, pStream
, phBody
);
1430 static HRESULT WINAPI
MimeMessage_AttachObject(
1431 IMimeMessage
*iface
,
1436 FIXME("(%p)->(%s, %p, %p)\n", iface
, debugstr_guid(riid
), pvObject
, phBody
);
1440 static HRESULT WINAPI
MimeMessage_AttachFile(
1441 IMimeMessage
*iface
,
1446 FIXME("(%p)->(%s, %p, %p)\n", iface
, pszFilePath
, pstmFile
, phBody
);
1450 static HRESULT WINAPI
MimeMessage_AttachURL(
1451 IMimeMessage
*iface
,
1459 FIXME("(%p)->(%s, %s, 0x%x, %p, %p, %p)\n", iface
, pszBase
, pszURL
, dwFlags
, pstmURL
, ppszCIDURL
, phBody
);
1463 static HRESULT WINAPI
MimeMessage_GetAttachments(
1464 IMimeMessage
*iface
,
1466 LPHBODY
*pprghAttach
)
1468 FIXME("(%p)->(%p, %p)\n", iface
, pcAttach
, pprghAttach
);
1472 static HRESULT WINAPI
MimeMessage_GetAddressTable(
1473 IMimeMessage
*iface
,
1474 IMimeAddressTable
**ppTable
)
1476 FIXME("(%p)->(%p)\n", iface
, ppTable
);
1480 static HRESULT WINAPI
MimeMessage_GetSender(
1481 IMimeMessage
*iface
,
1482 LPADDRESSPROPS pAddress
)
1484 FIXME("(%p)->(%p)\n", iface
, pAddress
);
1488 static HRESULT WINAPI
MimeMessage_GetAddressTypes(
1489 IMimeMessage
*iface
,
1492 LPADDRESSLIST pList
)
1494 FIXME("(%p)->(%d, %d, %p)\n", iface
, dwAdrTypes
, dwProps
, pList
);
1498 static HRESULT WINAPI
MimeMessage_GetAddressFormat(
1499 IMimeMessage
*iface
,
1501 ADDRESSFORMAT format
,
1504 FIXME("(%p)->(%d, %d, %p)\n", iface
, dwAdrTypes
, format
, ppszFormat
);
1508 static HRESULT WINAPI
MimeMessage_EnumAddressTypes(
1509 IMimeMessage
*iface
,
1512 IMimeEnumAddressTypes
**ppEnum
)
1514 FIXME("(%p)->(%d, %d, %p)\n", iface
, dwAdrTypes
, dwProps
, ppEnum
);
1518 static HRESULT WINAPI
MimeMessage_SplitMessage(
1519 IMimeMessage
*iface
,
1521 IMimeMessageParts
**ppParts
)
1523 FIXME("(%p)->(%d, %p)\n", iface
, cbMaxPart
, ppParts
);
1527 static HRESULT WINAPI
MimeMessage_GetRootMoniker(
1528 IMimeMessage
*iface
,
1529 IMoniker
**ppMoniker
)
1531 FIXME("(%p)->(%p)\n", iface
, ppMoniker
);
1535 static const IMimeMessageVtbl MimeMessageVtbl
=
1537 MimeMessage_QueryInterface
,
1539 MimeMessage_Release
,
1540 MimeMessage_GetClassID
,
1541 MimeMessage_IsDirty
,
1544 MimeMessage_GetSizeMax
,
1545 MimeMessage_InitNew
,
1546 MimeMessage_GetMessageSource
,
1547 MimeMessage_GetMessageSize
,
1548 MimeMessage_LoadOffsetTable
,
1549 MimeMessage_SaveOffsetTable
,
1550 MimeMessage_GetFlags
,
1552 MimeMessage_HandsOffStorage
,
1553 MimeMessage_BindToObject
,
1554 MimeMessage_SaveBody
,
1555 MimeMessage_InsertBody
,
1556 MimeMessage_GetBody
,
1557 MimeMessage_DeleteBody
,
1558 MimeMessage_MoveBody
,
1559 MimeMessage_CountBodies
,
1560 MimeMessage_FindFirst
,
1561 MimeMessage_FindNext
,
1562 MimeMessage_ResolveURL
,
1563 MimeMessage_ToMultipart
,
1564 MimeMessage_GetBodyOffsets
,
1565 MimeMessage_GetCharset
,
1566 MimeMessage_SetCharset
,
1567 MimeMessage_IsBodyType
,
1568 MimeMessage_IsContentType
,
1569 MimeMessage_QueryBodyProp
,
1570 MimeMessage_GetBodyProp
,
1571 MimeMessage_SetBodyProp
,
1572 MimeMessage_DeleteBodyProp
,
1573 MimeMessage_SetOption
,
1574 MimeMessage_GetOption
,
1575 MimeMessage_CreateWebPage
,
1576 MimeMessage_GetProp
,
1577 MimeMessage_SetProp
,
1578 MimeMessage_DeleteProp
,
1579 MimeMessage_QueryProp
,
1580 MimeMessage_GetTextBody
,
1581 MimeMessage_SetTextBody
,
1582 MimeMessage_AttachObject
,
1583 MimeMessage_AttachFile
,
1584 MimeMessage_AttachURL
,
1585 MimeMessage_GetAttachments
,
1586 MimeMessage_GetAddressTable
,
1587 MimeMessage_GetSender
,
1588 MimeMessage_GetAddressTypes
,
1589 MimeMessage_GetAddressFormat
,
1590 MimeMessage_EnumAddressTypes
,
1591 MimeMessage_SplitMessage
,
1592 MimeMessage_GetRootMoniker
,
1595 /***********************************************************************
1596 * MimeOleCreateMessage (INETCOMM.@)
1598 HRESULT WINAPI
MimeOleCreateMessage(IUnknown
*pUnkOuter
, IMimeMessage
**ppMessage
)
1602 TRACE("(%p, %p)\n", pUnkOuter
, ppMessage
);
1606 FIXME("outer unknown not supported yet\n");
1612 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
1613 if (!This
) return E_OUTOFMEMORY
;
1615 This
->lpVtbl
= &MimeMessageVtbl
;
1618 *ppMessage
= (IMimeMessage
*)&This
->lpVtbl
;
1622 /***********************************************************************
1623 * MimeOleSetCompatMode (INETCOMM.@)
1625 HRESULT WINAPI
MimeOleSetCompatMode(DWORD dwMode
)
1627 FIXME("(0x%x)\n", dwMode
);
1631 /***********************************************************************
1632 * MimeOleCreateVirtualStream (INETCOMM.@)
1634 HRESULT WINAPI
MimeOleCreateVirtualStream(IStream
**ppStream
)
1637 FIXME("(%p)\n", ppStream
);
1639 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, ppStream
);
1643 typedef struct MimeSecurity
1645 const IMimeSecurityVtbl
*lpVtbl
;
1650 static HRESULT WINAPI
MimeSecurity_QueryInterface(
1651 IMimeSecurity
* iface
,
1655 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(riid
), obj
);
1657 if (IsEqualIID(riid
, &IID_IUnknown
) ||
1658 IsEqualIID(riid
, &IID_IMimeSecurity
))
1661 IUnknown_AddRef(iface
);
1665 FIXME("no interface for %s\n", debugstr_guid(riid
));
1667 return E_NOINTERFACE
;
1670 static ULONG WINAPI
MimeSecurity_AddRef(
1671 IMimeSecurity
* iface
)
1673 MimeSecurity
*This
= (MimeSecurity
*)iface
;
1674 TRACE("(%p)->()\n", iface
);
1675 return InterlockedIncrement(&This
->refs
);
1678 static ULONG WINAPI
MimeSecurity_Release(
1679 IMimeSecurity
* iface
)
1681 MimeSecurity
*This
= (MimeSecurity
*)iface
;
1684 TRACE("(%p)->()\n", iface
);
1686 refs
= InterlockedDecrement(&This
->refs
);
1689 HeapFree(GetProcessHeap(), 0, This
);
1695 static HRESULT WINAPI
MimeSecurity_InitNew(
1696 IMimeSecurity
* iface
)
1698 FIXME("(%p)->(): stub\n", iface
);
1702 static HRESULT WINAPI
MimeSecurity_CheckInit(
1703 IMimeSecurity
* iface
)
1705 FIXME("(%p)->(): stub\n", iface
);
1709 static HRESULT WINAPI
MimeSecurity_EncodeMessage(
1710 IMimeSecurity
* iface
,
1711 IMimeMessageTree
* pTree
,
1714 FIXME("(%p)->(%p, %08x): stub\n", iface
, pTree
, dwFlags
);
1718 static HRESULT WINAPI
MimeSecurity_EncodeBody(
1719 IMimeSecurity
* iface
,
1720 IMimeMessageTree
* pTree
,
1724 FIXME("(%p)->(%p, %p, %08x): stub\n", iface
, pTree
, hEncodeRoot
, dwFlags
);
1728 static HRESULT WINAPI
MimeSecurity_DecodeMessage(
1729 IMimeSecurity
* iface
,
1730 IMimeMessageTree
* pTree
,
1733 FIXME("(%p)->(%p, %08x): stub\n", iface
, pTree
, dwFlags
);
1737 static HRESULT WINAPI
MimeSecurity_DecodeBody(
1738 IMimeSecurity
* iface
,
1739 IMimeMessageTree
* pTree
,
1743 FIXME("(%p)->(%p, %p, %08x): stub\n", iface
, pTree
, hDecodeRoot
, dwFlags
);
1747 static HRESULT WINAPI
MimeSecurity_EnumCertificates(
1748 IMimeSecurity
* iface
,
1754 FIXME("(%p)->(%p, %08x, %p, %p): stub\n", iface
, hc
, dwUsage
, pPrev
, ppCert
);
1758 static HRESULT WINAPI
MimeSecurity_GetCertificateName(
1759 IMimeSecurity
* iface
,
1760 const PCX509CERT pX509Cert
,
1761 const CERTNAMETYPE cn
,
1764 FIXME("(%p)->(%p, %08x, %p): stub\n", iface
, pX509Cert
, cn
, ppszName
);
1768 static HRESULT WINAPI
MimeSecurity_GetMessageType(
1769 IMimeSecurity
* iface
,
1770 const HWND hwndParent
,
1774 FIXME("(%p)->(%p, %p, %p): stub\n", iface
, hwndParent
, pBody
, pdwSecType
);
1778 static HRESULT WINAPI
MimeSecurity_GetCertData(
1779 IMimeSecurity
* iface
,
1780 const PCX509CERT pX509Cert
,
1781 const CERTDATAID dataid
,
1782 LPPROPVARIANT pValue
)
1784 FIXME("(%p)->(%p, %x, %p): stub\n", iface
, pX509Cert
, dataid
, pValue
);
1789 static const IMimeSecurityVtbl MimeSecurityVtbl
=
1791 MimeSecurity_QueryInterface
,
1792 MimeSecurity_AddRef
,
1793 MimeSecurity_Release
,
1794 MimeSecurity_InitNew
,
1795 MimeSecurity_CheckInit
,
1796 MimeSecurity_EncodeMessage
,
1797 MimeSecurity_EncodeBody
,
1798 MimeSecurity_DecodeMessage
,
1799 MimeSecurity_DecodeBody
,
1800 MimeSecurity_EnumCertificates
,
1801 MimeSecurity_GetCertificateName
,
1802 MimeSecurity_GetMessageType
,
1803 MimeSecurity_GetCertData
1806 /***********************************************************************
1807 * MimeOleCreateSecurity (INETCOMM.@)
1809 HRESULT WINAPI
MimeOleCreateSecurity(IMimeSecurity
**ppSecurity
)
1813 TRACE("(%p)\n", ppSecurity
);
1817 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
1818 if (!This
) return E_OUTOFMEMORY
;
1820 This
->lpVtbl
= &MimeSecurityVtbl
;
1823 *ppSecurity
= (IMimeSecurity
*)&This
->lpVtbl
;