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
;
109 static inline MimeBody
*impl_from_IMimeBody( IMimeBody
*iface
)
111 return (MimeBody
*)((char*)iface
- FIELD_OFFSET(MimeBody
, lpVtbl
));
114 static LPSTR
strdupA(LPCSTR str
)
117 int len
= strlen(str
);
118 ret
= HeapAlloc(GetProcessHeap(), 0, len
+ 1);
119 memcpy(ret
, str
, len
+ 1);
123 #define PARSER_BUF_SIZE 1024
125 /*****************************************************
126 * copy_headers_to_buf [internal]
128 * Copies the headers into a '\0' terminated memory block and leave
129 * the stream's current position set to after the blank line.
131 static HRESULT
copy_headers_to_buf(IStream
*stm
, char **ptr
)
134 DWORD size
= PARSER_BUF_SIZE
, offset
= 0, last_end
= 0;
146 buf
= HeapAlloc(GetProcessHeap(), 0, size
+ 1);
150 buf
= HeapReAlloc(GetProcessHeap(), 0, buf
, size
+ 1);
158 hr
= IStream_Read(stm
, buf
+ offset
, size
- offset
, &read
);
159 if(FAILED(hr
)) goto fail
;
164 if(read
== 0) done
= 1;
166 while(!done
&& (end
= strstr(buf
+ last_end
, "\r\n")))
168 DWORD new_end
= end
- buf
+ 2;
169 if(new_end
- last_end
== 2)
172 off
.QuadPart
= new_end
;
173 IStream_Seek(stm
, off
, STREAM_SEEK_SET
, NULL
);
186 HeapFree(GetProcessHeap(), 0, buf
);
190 static header_t
*read_prop(MimeBody
*body
, char **ptr
)
192 char *colon
= strchr(*ptr
, ':');
193 const property_t
*prop
;
196 if(!colon
) return NULL
;
200 for(prop
= default_props
; prop
->name
; prop
++)
202 if(!strcasecmp(*ptr
, prop
->name
))
204 TRACE("%s: found match with default property id %d\n", *ptr
, prop
->id
);
211 property_list_entry_t
*prop_entry
;
212 LIST_FOR_EACH_ENTRY(prop_entry
, &body
->new_props
, property_list_entry_t
, entry
)
214 if(!strcasecmp(*ptr
, prop_entry
->prop
.name
))
216 TRACE("%s: found match with already added new property id %d\n", *ptr
, prop_entry
->prop
.id
);
217 prop
= &prop_entry
->prop
;
223 prop_entry
= HeapAlloc(GetProcessHeap(), 0, sizeof(*prop_entry
));
224 prop_entry
->prop
.name
= strdupA(*ptr
);
225 prop_entry
->prop
.id
= body
->next_prop_id
++;
226 prop_entry
->prop
.flags
= 0;
227 prop_entry
->prop
.default_vt
= VT_LPSTR
;
228 list_add_tail(&body
->new_props
, &prop_entry
->entry
);
229 prop
= &prop_entry
->prop
;
230 TRACE("%s: allocating new prop id %d\n", *ptr
, prop_entry
->prop
.id
);
234 ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(*ret
));
236 PropVariantInit(&ret
->value
);
237 list_init(&ret
->params
);
243 static void unfold_header(char *header
, int len
)
245 char *start
= header
, *cp
= header
;
248 while(*cp
== ' ' || *cp
== '\t')
254 memmove(start
, cp
, len
+ 1);
256 cp
= strstr(start
, "\r\n");
263 } while(*cp
== ' ' || *cp
== '\t');
268 static void add_param(header_t
*header
, const char *p
)
270 const char *key
= p
, *value
, *cp
= p
;
274 TRACE("got param %s\n", p
);
276 while (*key
== ' ' || *key
== '\t' ) key
++;
278 cp
= strchr(key
, '=');
281 WARN("malformed parameter - skipping\n");
285 name
= HeapAlloc(GetProcessHeap(), 0, cp
- key
+ 1);
286 memcpy(name
, key
, cp
- key
);
287 name
[cp
- key
] = '\0';
291 param
= HeapAlloc(GetProcessHeap(), 0, sizeof(*param
));
293 param
->value
= strdupA(value
);
294 list_add_tail(&header
->params
, ¶m
->entry
);
297 static void split_params(header_t
*header
, char *value
)
299 char *cp
= value
, *start
= value
;
305 if(!in_quote
&& *cp
== ';')
308 if(done_value
) add_param(header
, start
);
313 in_quote
= !in_quote
;
316 if(done_value
) add_param(header
, start
);
319 static void read_value(header_t
*header
, char **cur
)
321 char *end
= *cur
, *value
;
325 end
= strstr(end
, "\r\n");
327 } while(*end
== ' ' || *end
== '\t');
330 value
= HeapAlloc(GetProcessHeap(), 0, len
+ 1);
331 memcpy(value
, *cur
, len
);
334 unfold_header(value
, len
);
335 TRACE("value %s\n", debugstr_a(value
));
337 if(header
->prop
->flags
& MPF_HASPARAMS
)
339 split_params(header
, value
);
340 TRACE("value w/o params %s\n", debugstr_a(value
));
343 header
->value
.vt
= VT_LPSTR
;
344 header
->value
.pszVal
= value
;
349 static void init_content_type(MimeBody
*body
, header_t
*header
)
354 if(header
->prop
->id
!= PID_HDR_CNTTYPE
)
356 ERR("called with header %s\n", header
->prop
->name
);
360 slash
= strchr(header
->value
.pszVal
, '/');
363 WARN("malformed context type value\n");
366 len
= slash
- header
->value
.pszVal
;
367 body
->content_pri_type
= HeapAlloc(GetProcessHeap(), 0, len
+ 1);
368 memcpy(body
->content_pri_type
, header
->value
.pszVal
, len
);
369 body
->content_pri_type
[len
] = '\0';
370 body
->content_sub_type
= strdupA(slash
+ 1);
373 static HRESULT
parse_headers(MimeBody
*body
, IStream
*stm
)
375 char *header_buf
, *cur_header_ptr
;
379 hr
= copy_headers_to_buf(stm
, &header_buf
);
380 if(FAILED(hr
)) return hr
;
382 cur_header_ptr
= header_buf
;
383 while((header
= read_prop(body
, &cur_header_ptr
)))
385 read_value(header
, &cur_header_ptr
);
386 list_add_tail(&body
->headers
, &header
->entry
);
388 if(header
->prop
->id
== PID_HDR_CNTTYPE
)
389 init_content_type(body
, header
);
392 HeapFree(GetProcessHeap(), 0, header_buf
);
396 static void emptry_param_list(struct list
*list
)
398 param_t
*param
, *cursor2
;
400 LIST_FOR_EACH_ENTRY_SAFE(param
, cursor2
, list
, param_t
, entry
)
402 list_remove(¶m
->entry
);
403 HeapFree(GetProcessHeap(), 0, param
->name
);
404 HeapFree(GetProcessHeap(), 0, param
->value
);
405 HeapFree(GetProcessHeap(), 0, param
);
409 static void empty_header_list(struct list
*list
)
411 header_t
*header
, *cursor2
;
413 LIST_FOR_EACH_ENTRY_SAFE(header
, cursor2
, list
, header_t
, entry
)
415 list_remove(&header
->entry
);
416 PropVariantClear(&header
->value
);
417 emptry_param_list(&header
->params
);
418 HeapFree(GetProcessHeap(), 0, header
);
422 static void empty_new_prop_list(struct list
*list
)
424 property_list_entry_t
*prop
, *cursor2
;
426 LIST_FOR_EACH_ENTRY_SAFE(prop
, cursor2
, list
, property_list_entry_t
, entry
)
428 list_remove(&prop
->entry
);
429 HeapFree(GetProcessHeap(), 0, (char *)prop
->prop
.name
);
430 HeapFree(GetProcessHeap(), 0, prop
);
434 static HRESULT WINAPI
MimeBody_QueryInterface(IMimeBody
* iface
,
438 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(riid
), ppvObject
);
442 if (IsEqualIID(riid
, &IID_IUnknown
) ||
443 IsEqualIID(riid
, &IID_IPersist
) ||
444 IsEqualIID(riid
, &IID_IPersistStreamInit
) ||
445 IsEqualIID(riid
, &IID_IMimePropertySet
) ||
446 IsEqualIID(riid
, &IID_IMimeBody
))
453 IUnknown_AddRef((IUnknown
*)*ppvObject
);
457 FIXME("no interface for %s\n", debugstr_guid(riid
));
458 return E_NOINTERFACE
;
461 static ULONG WINAPI
MimeBody_AddRef(IMimeBody
* iface
)
463 MimeBody
*This
= impl_from_IMimeBody(iface
);
464 TRACE("(%p)->()\n", iface
);
465 return InterlockedIncrement(&This
->refs
);
468 static ULONG WINAPI
MimeBody_Release(IMimeBody
* iface
)
470 MimeBody
*This
= impl_from_IMimeBody(iface
);
473 TRACE("(%p)->()\n", iface
);
475 refs
= InterlockedDecrement(&This
->refs
);
478 empty_header_list(&This
->headers
);
479 empty_new_prop_list(&This
->new_props
);
481 HeapFree(GetProcessHeap(), 0, This
->content_pri_type
);
482 HeapFree(GetProcessHeap(), 0, This
->content_sub_type
);
483 HeapFree(GetProcessHeap(), 0, This
);
489 static HRESULT WINAPI
MimeBody_GetClassID(
498 static HRESULT WINAPI
MimeBody_IsDirty(
505 static HRESULT WINAPI
MimeBody_Load(
509 MimeBody
*This
= impl_from_IMimeBody(iface
);
510 TRACE("(%p)->(%p)\n", iface
, pStm
);
511 return parse_headers(This
, pStm
);
514 static HRESULT WINAPI
MimeBody_Save(
523 static HRESULT WINAPI
MimeBody_GetSizeMax(
525 ULARGE_INTEGER
* pcbSize
)
531 static HRESULT WINAPI
MimeBody_InitNew(
534 TRACE("%p->()\n", iface
);
538 static HRESULT WINAPI
MimeBody_GetPropInfo(
541 LPMIMEPROPINFO pInfo
)
547 static HRESULT WINAPI
MimeBody_SetPropInfo(
550 LPCMIMEPROPINFO pInfo
)
556 static HRESULT WINAPI
MimeBody_GetProp(
560 LPPROPVARIANT pValue
)
566 static HRESULT WINAPI
MimeBody_SetProp(
570 LPCPROPVARIANT pValue
)
576 static HRESULT WINAPI
MimeBody_AppendProp(
580 LPPROPVARIANT pValue
)
586 static HRESULT WINAPI
MimeBody_DeleteProp(
594 static HRESULT WINAPI
MimeBody_CopyProps(
598 IMimePropertySet
* pPropertySet
)
604 static HRESULT WINAPI
MimeBody_MoveProps(
608 IMimePropertySet
* pPropertySet
)
614 static HRESULT WINAPI
MimeBody_DeleteExcept(
623 static HRESULT WINAPI
MimeBody_QueryProp(
628 boolean fCaseSensitive
)
634 static HRESULT WINAPI
MimeBody_GetCharset(
636 LPHCHARSET phCharset
)
642 static HRESULT WINAPI
MimeBody_SetCharset(
645 CSETAPPLYTYPE applytype
)
651 static HRESULT WINAPI
MimeBody_GetParameters(
655 LPMIMEPARAMINFO
* pprgParam
)
661 static HRESULT WINAPI
MimeBody_IsContentType(
666 MimeBody
*This
= impl_from_IMimeBody(iface
);
668 TRACE("(%p)->(%s, %s)\n", This
, debugstr_a(pszPriType
), debugstr_a(pszSubType
));
671 const char *pri
= This
->content_pri_type
;
672 if(!pri
) pri
= "text";
673 if(strcasecmp(pri
, pszPriType
)) return S_FALSE
;
678 const char *sub
= This
->content_sub_type
;
679 if(!sub
) sub
= "plain";
680 if(strcasecmp(sub
, pszSubType
)) return S_FALSE
;
686 static HRESULT WINAPI
MimeBody_BindToObject(
695 static HRESULT WINAPI
MimeBody_Clone(
697 IMimePropertySet
** ppPropertySet
)
703 static HRESULT WINAPI
MimeBody_SetOption(
706 LPCPROPVARIANT pValue
)
712 static HRESULT WINAPI
MimeBody_GetOption(
715 LPPROPVARIANT pValue
)
721 static HRESULT WINAPI
MimeBody_EnumProps(
724 IMimeEnumProperties
** ppEnum
)
730 static HRESULT WINAPI
MimeBody_IsType(
732 IMSGBODYTYPE bodytype
)
738 static HRESULT WINAPI
MimeBody_SetDisplayName(
746 static HRESULT WINAPI
MimeBody_GetDisplayName(
754 static HRESULT WINAPI
MimeBody_GetOffsets(
756 LPBODYOFFSETS pOffsets
)
762 static HRESULT WINAPI
MimeBody_GetCurrentEncoding(
764 ENCODINGTYPE
* pietEncoding
)
766 MimeBody
*This
= impl_from_IMimeBody(iface
);
768 TRACE("(%p)->(%p)\n", This
, pietEncoding
);
770 *pietEncoding
= This
->encoding
;
774 static HRESULT WINAPI
MimeBody_SetCurrentEncoding(
776 ENCODINGTYPE ietEncoding
)
778 MimeBody
*This
= impl_from_IMimeBody(iface
);
780 TRACE("(%p)->(%d)\n", This
, ietEncoding
);
782 This
->encoding
= ietEncoding
;
786 static HRESULT WINAPI
MimeBody_GetEstimatedSize(
788 ENCODINGTYPE ietEncoding
,
795 static HRESULT WINAPI
MimeBody_GetDataHere(
797 ENCODINGTYPE ietEncoding
,
804 static HRESULT WINAPI
MimeBody_GetData(
806 ENCODINGTYPE ietEncoding
,
813 static HRESULT WINAPI
MimeBody_SetData(
815 ENCODINGTYPE ietEncoding
,
825 static HRESULT WINAPI
MimeBody_EmptyData(
832 static HRESULT WINAPI
MimeBody_CopyTo(
840 static HRESULT WINAPI
MimeBody_GetTransmitInfo(
842 LPTRANSMITINFO pTransmitInfo
)
848 static HRESULT WINAPI
MimeBody_SaveToFile(
850 ENCODINGTYPE ietEncoding
,
857 static HRESULT WINAPI
MimeBody_GetHandle(
861 MimeBody
*This
= impl_from_IMimeBody(iface
);
862 TRACE("(%p)->(%p)\n", iface
, phBody
);
864 *phBody
= This
->handle
;
865 return This
->handle
? S_OK
: MIME_E_NO_DATA
;
868 static IMimeBodyVtbl body_vtbl
=
870 MimeBody_QueryInterface
,
879 MimeBody_GetPropInfo
,
880 MimeBody_SetPropInfo
,
887 MimeBody_DeleteExcept
,
891 MimeBody_GetParameters
,
892 MimeBody_IsContentType
,
893 MimeBody_BindToObject
,
899 MimeBody_SetDisplayName
,
900 MimeBody_GetDisplayName
,
902 MimeBody_GetCurrentEncoding
,
903 MimeBody_SetCurrentEncoding
,
904 MimeBody_GetEstimatedSize
,
905 MimeBody_GetDataHere
,
910 MimeBody_GetTransmitInfo
,
915 #define FIRST_CUSTOM_PROP_ID 0x100
917 HRESULT
MimeBody_create(IUnknown
*outer
, void **obj
)
923 if(outer
) return CLASS_E_NOAGGREGATION
;
925 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
926 if (!This
) return E_OUTOFMEMORY
;
928 This
->lpVtbl
= &body_vtbl
;
931 list_init(&This
->headers
);
932 list_init(&This
->new_props
);
933 This
->next_prop_id
= FIRST_CUSTOM_PROP_ID
;
934 This
->content_pri_type
= NULL
;
935 This
->content_sub_type
= NULL
;
936 This
->encoding
= IET_7BIT
;
938 *obj
= (IMimeBody
*)&This
->lpVtbl
;
942 typedef struct MimeMessage
944 const IMimeMessageVtbl
*lpVtbl
;
949 static HRESULT WINAPI
MimeMessage_QueryInterface(IMimeMessage
*iface
, REFIID riid
, void **ppv
)
951 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(riid
), ppv
);
953 if (IsEqualIID(riid
, &IID_IUnknown
) ||
954 IsEqualIID(riid
, &IID_IPersist
) ||
955 IsEqualIID(riid
, &IID_IPersistStreamInit
) ||
956 IsEqualIID(riid
, &IID_IMimeMessageTree
) ||
957 IsEqualIID(riid
, &IID_IMimeMessage
))
960 IUnknown_AddRef(iface
);
964 FIXME("no interface for %s\n", debugstr_guid(riid
));
966 return E_NOINTERFACE
;
969 static ULONG WINAPI
MimeMessage_AddRef(IMimeMessage
*iface
)
971 MimeMessage
*This
= (MimeMessage
*)iface
;
972 TRACE("(%p)->()\n", iface
);
973 return InterlockedIncrement(&This
->refs
);
976 static ULONG WINAPI
MimeMessage_Release(IMimeMessage
*iface
)
978 MimeMessage
*This
= (MimeMessage
*)iface
;
981 TRACE("(%p)->()\n", iface
);
983 refs
= InterlockedDecrement(&This
->refs
);
986 HeapFree(GetProcessHeap(), 0, This
);
992 /*** IPersist methods ***/
993 static HRESULT WINAPI
MimeMessage_GetClassID(
997 FIXME("(%p)->(%p)\n", iface
, pClassID
);
1001 /*** IPersistStreamInit methods ***/
1002 static HRESULT WINAPI
MimeMessage_IsDirty(
1003 IMimeMessage
*iface
)
1005 FIXME("(%p)->()\n", iface
);
1009 static HRESULT WINAPI
MimeMessage_Load(
1010 IMimeMessage
*iface
,
1012 FIXME("(%p)->(%p)\n", iface
, pStm
);
1016 static HRESULT WINAPI
MimeMessage_Save(
1017 IMimeMessage
*iface
,
1021 FIXME("(%p)->(%p, %s)\n", iface
, pStm
, fClearDirty
? "TRUE" : "FALSE");
1025 static HRESULT WINAPI
MimeMessage_GetSizeMax(
1026 IMimeMessage
*iface
,
1027 ULARGE_INTEGER
*pcbSize
)
1029 FIXME("(%p)->(%p)\n", iface
, pcbSize
);
1033 static HRESULT WINAPI
MimeMessage_InitNew(
1034 IMimeMessage
*iface
)
1036 FIXME("(%p)->()\n", iface
);
1040 /*** IMimeMessageTree methods ***/
1041 static HRESULT WINAPI
MimeMessage_GetMessageSource(
1042 IMimeMessage
*iface
,
1046 FIXME("(%p)->(%p, 0x%x)\n", iface
, ppStream
, dwFlags
);
1050 static HRESULT WINAPI
MimeMessage_GetMessageSize(
1051 IMimeMessage
*iface
,
1055 FIXME("(%p)->(%p, 0x%x)\n", iface
, pcbSize
, dwFlags
);
1059 static HRESULT WINAPI
MimeMessage_LoadOffsetTable(
1060 IMimeMessage
*iface
,
1063 FIXME("(%p)->(%p)\n", iface
, pStream
);
1067 static HRESULT WINAPI
MimeMessage_SaveOffsetTable(
1068 IMimeMessage
*iface
,
1072 FIXME("(%p)->(%p, 0x%x)\n", iface
, pStream
, dwFlags
);
1077 static HRESULT WINAPI
MimeMessage_GetFlags(
1078 IMimeMessage
*iface
,
1081 FIXME("(%p)->(%p)\n", iface
, pdwFlags
);
1085 static HRESULT WINAPI
MimeMessage_Commit(
1086 IMimeMessage
*iface
,
1089 FIXME("(%p)->(0x%x)\n", iface
, dwFlags
);
1094 static HRESULT WINAPI
MimeMessage_HandsOffStorage(
1095 IMimeMessage
*iface
)
1097 FIXME("(%p)->()\n", iface
);
1101 static HRESULT WINAPI
MimeMessage_BindToObject(
1102 IMimeMessage
*iface
,
1107 FIXME("(%p)->(%p, %s, %p)\n", iface
, hBody
, debugstr_guid(riid
), ppvObject
);
1111 static HRESULT WINAPI
MimeMessage_SaveBody(
1112 IMimeMessage
*iface
,
1117 FIXME("(%p)->(%p, 0x%x, %p)\n", iface
, hBody
, dwFlags
, pStream
);
1121 static HRESULT WINAPI
MimeMessage_InsertBody(
1122 IMimeMessage
*iface
,
1123 BODYLOCATION location
,
1127 FIXME("(%p)->(%d, %p, %p)\n", iface
, location
, hPivot
, phBody
);
1131 static HRESULT WINAPI
MimeMessage_GetBody(
1132 IMimeMessage
*iface
,
1133 BODYLOCATION location
,
1137 FIXME("(%p)->(%d, %p, %p)\n", iface
, location
, hPivot
, phBody
);
1141 static HRESULT WINAPI
MimeMessage_DeleteBody(
1142 IMimeMessage
*iface
,
1146 FIXME("(%p)->(%p, %08x)\n", iface
, hBody
, dwFlags
);
1150 static HRESULT WINAPI
MimeMessage_MoveBody(
1151 IMimeMessage
*iface
,
1153 BODYLOCATION location
)
1155 FIXME("(%p)->(%d)\n", iface
, location
);
1159 static HRESULT WINAPI
MimeMessage_CountBodies(
1160 IMimeMessage
*iface
,
1165 FIXME("(%p)->(%p, %s, %p)\n", iface
, hParent
, fRecurse
? "TRUE" : "FALSE", pcBodies
);
1169 static HRESULT WINAPI
MimeMessage_FindFirst(
1170 IMimeMessage
*iface
,
1171 LPFINDBODY pFindBody
,
1174 FIXME("(%p)->(%p, %p)\n", iface
, pFindBody
, phBody
);
1178 static HRESULT WINAPI
MimeMessage_FindNext(
1179 IMimeMessage
*iface
,
1180 LPFINDBODY pFindBody
,
1183 FIXME("(%p)->(%p, %p)\n", iface
, pFindBody
, phBody
);
1187 static HRESULT WINAPI
MimeMessage_ResolveURL(
1188 IMimeMessage
*iface
,
1195 FIXME("(%p)->(%p, %s, %s, 0x%x, %p)\n", iface
, hRelated
, pszBase
, pszURL
, dwFlags
, phBody
);
1199 static HRESULT WINAPI
MimeMessage_ToMultipart(
1200 IMimeMessage
*iface
,
1203 LPHBODY phMultipart
)
1205 FIXME("(%p)->(%p, %s, %p)\n", iface
, hBody
, pszSubType
, phMultipart
);
1209 static HRESULT WINAPI
MimeMessage_GetBodyOffsets(
1210 IMimeMessage
*iface
,
1212 LPBODYOFFSETS pOffsets
)
1214 FIXME("(%p)->(%p, %p)\n", iface
, hBody
, pOffsets
);
1218 static HRESULT WINAPI
MimeMessage_GetCharset(
1219 IMimeMessage
*iface
,
1220 LPHCHARSET phCharset
)
1222 FIXME("(%p)->(%p)\n", iface
, phCharset
);
1226 static HRESULT WINAPI
MimeMessage_SetCharset(
1227 IMimeMessage
*iface
,
1229 CSETAPPLYTYPE applytype
)
1231 FIXME("(%p)->(%p, %d)\n", iface
, hCharset
, applytype
);
1235 static HRESULT WINAPI
MimeMessage_IsBodyType(
1236 IMimeMessage
*iface
,
1238 IMSGBODYTYPE bodytype
)
1240 FIXME("(%p)->(%p, %d)\n", iface
, hBody
, bodytype
);
1244 static HRESULT WINAPI
MimeMessage_IsContentType(
1245 IMimeMessage
*iface
,
1250 FIXME("(%p)->(%p, %s, %s)\n", iface
, hBody
, pszPriType
, pszSubType
);
1254 static HRESULT WINAPI
MimeMessage_QueryBodyProp(
1255 IMimeMessage
*iface
,
1260 boolean fCaseSensitive
)
1262 FIXME("(%p)->(%p, %s, %s, %s, %s)\n", iface
, hBody
, pszName
, pszCriteria
, fSubString
? "TRUE" : "FALSE", fCaseSensitive
? "TRUE" : "FALSE");
1266 static HRESULT WINAPI
MimeMessage_GetBodyProp(
1267 IMimeMessage
*iface
,
1271 LPPROPVARIANT pValue
)
1273 FIXME("(%p)->(%p, %s, 0x%x, %p)\n", iface
, hBody
, pszName
, dwFlags
, pValue
);
1277 static HRESULT WINAPI
MimeMessage_SetBodyProp(
1278 IMimeMessage
*iface
,
1282 LPCPROPVARIANT pValue
)
1284 FIXME("(%p)->(%p, %s, 0x%x, %p)\n", iface
, hBody
, pszName
, dwFlags
, pValue
);
1288 static HRESULT WINAPI
MimeMessage_DeleteBodyProp(
1289 IMimeMessage
*iface
,
1293 FIXME("(%p)->(%p, %s)\n", iface
, hBody
, pszName
);
1297 static HRESULT WINAPI
MimeMessage_SetOption(
1298 IMimeMessage
*iface
,
1300 LPCPROPVARIANT pValue
)
1302 FIXME("(%p)->(%d, %p)\n", iface
, oid
, pValue
);
1306 static HRESULT WINAPI
MimeMessage_GetOption(
1307 IMimeMessage
*iface
,
1309 LPPROPVARIANT pValue
)
1311 FIXME("(%p)->(%d, %p)\n", iface
, oid
, pValue
);
1315 /*** IMimeMessage methods ***/
1316 static HRESULT WINAPI
MimeMessage_CreateWebPage(
1317 IMimeMessage
*iface
,
1319 LPWEBPAGEOPTIONS pOptions
,
1320 IMimeMessageCallback
*pCallback
,
1321 IMoniker
**ppMoniker
)
1323 FIXME("(%p)->(%p, %p, %p, %p)\n", iface
, pRootStm
, pOptions
, pCallback
, ppMoniker
);
1328 static HRESULT WINAPI
MimeMessage_GetProp(
1329 IMimeMessage
*iface
,
1332 LPPROPVARIANT pValue
)
1334 FIXME("(%p)->(%s, 0x%x, %p)\n", iface
, pszName
, dwFlags
, pValue
);
1338 static HRESULT WINAPI
MimeMessage_SetProp(
1339 IMimeMessage
*iface
,
1342 LPCPROPVARIANT pValue
)
1344 FIXME("(%p)->(%s, 0x%x, %p)\n", iface
, pszName
, dwFlags
, pValue
);
1348 static HRESULT WINAPI
MimeMessage_DeleteProp(
1349 IMimeMessage
*iface
,
1352 FIXME("(%p)->(%s)\n", iface
, pszName
);
1356 static HRESULT WINAPI
MimeMessage_QueryProp(
1357 IMimeMessage
*iface
,
1361 boolean fCaseSensitive
)
1363 FIXME("(%p)->(%s, %s, %s, %s)\n", iface
, pszName
, pszCriteria
, fSubString
? "TRUE" : "FALSE", fCaseSensitive
? "TRUE" : "FALSE");
1367 static HRESULT WINAPI
MimeMessage_GetTextBody(
1368 IMimeMessage
*iface
,
1370 ENCODINGTYPE ietEncoding
,
1374 FIXME("(%p)->(%d, %d, %p, %p)\n", iface
, dwTxtType
, ietEncoding
, pStream
, phBody
);
1378 static HRESULT WINAPI
MimeMessage_SetTextBody(
1379 IMimeMessage
*iface
,
1381 ENCODINGTYPE ietEncoding
,
1386 FIXME("(%p)->(%d, %d, %p, %p, %p)\n", iface
, dwTxtType
, ietEncoding
, hAlternative
, pStream
, phBody
);
1390 static HRESULT WINAPI
MimeMessage_AttachObject(
1391 IMimeMessage
*iface
,
1396 FIXME("(%p)->(%s, %p, %p)\n", iface
, debugstr_guid(riid
), pvObject
, phBody
);
1400 static HRESULT WINAPI
MimeMessage_AttachFile(
1401 IMimeMessage
*iface
,
1406 FIXME("(%p)->(%s, %p, %p)\n", iface
, pszFilePath
, pstmFile
, phBody
);
1410 static HRESULT WINAPI
MimeMessage_AttachURL(
1411 IMimeMessage
*iface
,
1419 FIXME("(%p)->(%s, %s, 0x%x, %p, %p, %p)\n", iface
, pszBase
, pszURL
, dwFlags
, pstmURL
, ppszCIDURL
, phBody
);
1423 static HRESULT WINAPI
MimeMessage_GetAttachments(
1424 IMimeMessage
*iface
,
1426 LPHBODY
*pprghAttach
)
1428 FIXME("(%p)->(%p, %p)\n", iface
, pcAttach
, pprghAttach
);
1432 static HRESULT WINAPI
MimeMessage_GetAddressTable(
1433 IMimeMessage
*iface
,
1434 IMimeAddressTable
**ppTable
)
1436 FIXME("(%p)->(%p)\n", iface
, ppTable
);
1440 static HRESULT WINAPI
MimeMessage_GetSender(
1441 IMimeMessage
*iface
,
1442 LPADDRESSPROPS pAddress
)
1444 FIXME("(%p)->(%p)\n", iface
, pAddress
);
1448 static HRESULT WINAPI
MimeMessage_GetAddressTypes(
1449 IMimeMessage
*iface
,
1452 LPADDRESSLIST pList
)
1454 FIXME("(%p)->(%d, %d, %p)\n", iface
, dwAdrTypes
, dwProps
, pList
);
1458 static HRESULT WINAPI
MimeMessage_GetAddressFormat(
1459 IMimeMessage
*iface
,
1461 ADDRESSFORMAT format
,
1464 FIXME("(%p)->(%d, %d, %p)\n", iface
, dwAdrTypes
, format
, ppszFormat
);
1468 static HRESULT WINAPI
MimeMessage_EnumAddressTypes(
1469 IMimeMessage
*iface
,
1472 IMimeEnumAddressTypes
**ppEnum
)
1474 FIXME("(%p)->(%d, %d, %p)\n", iface
, dwAdrTypes
, dwProps
, ppEnum
);
1478 static HRESULT WINAPI
MimeMessage_SplitMessage(
1479 IMimeMessage
*iface
,
1481 IMimeMessageParts
**ppParts
)
1483 FIXME("(%p)->(%d, %p)\n", iface
, cbMaxPart
, ppParts
);
1487 static HRESULT WINAPI
MimeMessage_GetRootMoniker(
1488 IMimeMessage
*iface
,
1489 IMoniker
**ppMoniker
)
1491 FIXME("(%p)->(%p)\n", iface
, ppMoniker
);
1495 static const IMimeMessageVtbl MimeMessageVtbl
=
1497 MimeMessage_QueryInterface
,
1499 MimeMessage_Release
,
1500 MimeMessage_GetClassID
,
1501 MimeMessage_IsDirty
,
1504 MimeMessage_GetSizeMax
,
1505 MimeMessage_InitNew
,
1506 MimeMessage_GetMessageSource
,
1507 MimeMessage_GetMessageSize
,
1508 MimeMessage_LoadOffsetTable
,
1509 MimeMessage_SaveOffsetTable
,
1510 MimeMessage_GetFlags
,
1512 MimeMessage_HandsOffStorage
,
1513 MimeMessage_BindToObject
,
1514 MimeMessage_SaveBody
,
1515 MimeMessage_InsertBody
,
1516 MimeMessage_GetBody
,
1517 MimeMessage_DeleteBody
,
1518 MimeMessage_MoveBody
,
1519 MimeMessage_CountBodies
,
1520 MimeMessage_FindFirst
,
1521 MimeMessage_FindNext
,
1522 MimeMessage_ResolveURL
,
1523 MimeMessage_ToMultipart
,
1524 MimeMessage_GetBodyOffsets
,
1525 MimeMessage_GetCharset
,
1526 MimeMessage_SetCharset
,
1527 MimeMessage_IsBodyType
,
1528 MimeMessage_IsContentType
,
1529 MimeMessage_QueryBodyProp
,
1530 MimeMessage_GetBodyProp
,
1531 MimeMessage_SetBodyProp
,
1532 MimeMessage_DeleteBodyProp
,
1533 MimeMessage_SetOption
,
1534 MimeMessage_GetOption
,
1535 MimeMessage_CreateWebPage
,
1536 MimeMessage_GetProp
,
1537 MimeMessage_SetProp
,
1538 MimeMessage_DeleteProp
,
1539 MimeMessage_QueryProp
,
1540 MimeMessage_GetTextBody
,
1541 MimeMessage_SetTextBody
,
1542 MimeMessage_AttachObject
,
1543 MimeMessage_AttachFile
,
1544 MimeMessage_AttachURL
,
1545 MimeMessage_GetAttachments
,
1546 MimeMessage_GetAddressTable
,
1547 MimeMessage_GetSender
,
1548 MimeMessage_GetAddressTypes
,
1549 MimeMessage_GetAddressFormat
,
1550 MimeMessage_EnumAddressTypes
,
1551 MimeMessage_SplitMessage
,
1552 MimeMessage_GetRootMoniker
,
1555 /***********************************************************************
1556 * MimeOleCreateMessage (INETCOMM.@)
1558 HRESULT WINAPI
MimeOleCreateMessage(IUnknown
*pUnkOuter
, IMimeMessage
**ppMessage
)
1562 TRACE("(%p, %p)\n", pUnkOuter
, ppMessage
);
1566 FIXME("outer unknown not supported yet\n");
1572 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
1573 if (!This
) return E_OUTOFMEMORY
;
1575 This
->lpVtbl
= &MimeMessageVtbl
;
1578 *ppMessage
= (IMimeMessage
*)&This
->lpVtbl
;
1582 /***********************************************************************
1583 * MimeOleSetCompatMode (INETCOMM.@)
1585 HRESULT WINAPI
MimeOleSetCompatMode(DWORD dwMode
)
1587 FIXME("(0x%x)\n", dwMode
);
1591 /***********************************************************************
1592 * MimeOleCreateVirtualStream (INETCOMM.@)
1594 HRESULT WINAPI
MimeOleCreateVirtualStream(IStream
**ppStream
)
1597 FIXME("(%p)\n", ppStream
);
1599 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, ppStream
);
1603 typedef struct MimeSecurity
1605 const IMimeSecurityVtbl
*lpVtbl
;
1610 static HRESULT WINAPI
MimeSecurity_QueryInterface(
1611 IMimeSecurity
* iface
,
1615 TRACE("(%p)->(%s, %p)\n", iface
, debugstr_guid(riid
), obj
);
1617 if (IsEqualIID(riid
, &IID_IUnknown
) ||
1618 IsEqualIID(riid
, &IID_IMimeSecurity
))
1621 IUnknown_AddRef(iface
);
1625 FIXME("no interface for %s\n", debugstr_guid(riid
));
1627 return E_NOINTERFACE
;
1630 static ULONG WINAPI
MimeSecurity_AddRef(
1631 IMimeSecurity
* iface
)
1633 MimeSecurity
*This
= (MimeSecurity
*)iface
;
1634 TRACE("(%p)->()\n", iface
);
1635 return InterlockedIncrement(&This
->refs
);
1638 static ULONG WINAPI
MimeSecurity_Release(
1639 IMimeSecurity
* iface
)
1641 MimeSecurity
*This
= (MimeSecurity
*)iface
;
1644 TRACE("(%p)->()\n", iface
);
1646 refs
= InterlockedDecrement(&This
->refs
);
1649 HeapFree(GetProcessHeap(), 0, This
);
1655 static HRESULT WINAPI
MimeSecurity_InitNew(
1656 IMimeSecurity
* iface
)
1658 FIXME("(%p)->(): stub\n", iface
);
1662 static HRESULT WINAPI
MimeSecurity_CheckInit(
1663 IMimeSecurity
* iface
)
1665 FIXME("(%p)->(): stub\n", iface
);
1669 static HRESULT WINAPI
MimeSecurity_EncodeMessage(
1670 IMimeSecurity
* iface
,
1671 IMimeMessageTree
* pTree
,
1674 FIXME("(%p)->(%p, %08x): stub\n", iface
, pTree
, dwFlags
);
1678 static HRESULT WINAPI
MimeSecurity_EncodeBody(
1679 IMimeSecurity
* iface
,
1680 IMimeMessageTree
* pTree
,
1684 FIXME("(%p)->(%p, %p, %08x): stub\n", iface
, pTree
, hEncodeRoot
, dwFlags
);
1688 static HRESULT WINAPI
MimeSecurity_DecodeMessage(
1689 IMimeSecurity
* iface
,
1690 IMimeMessageTree
* pTree
,
1693 FIXME("(%p)->(%p, %08x): stub\n", iface
, pTree
, dwFlags
);
1697 static HRESULT WINAPI
MimeSecurity_DecodeBody(
1698 IMimeSecurity
* iface
,
1699 IMimeMessageTree
* pTree
,
1703 FIXME("(%p)->(%p, %p, %08x): stub\n", iface
, pTree
, hDecodeRoot
, dwFlags
);
1707 static HRESULT WINAPI
MimeSecurity_EnumCertificates(
1708 IMimeSecurity
* iface
,
1714 FIXME("(%p)->(%p, %08x, %p, %p): stub\n", iface
, hc
, dwUsage
, pPrev
, ppCert
);
1718 static HRESULT WINAPI
MimeSecurity_GetCertificateName(
1719 IMimeSecurity
* iface
,
1720 const PCX509CERT pX509Cert
,
1721 const CERTNAMETYPE cn
,
1724 FIXME("(%p)->(%p, %08x, %p): stub\n", iface
, pX509Cert
, cn
, ppszName
);
1728 static HRESULT WINAPI
MimeSecurity_GetMessageType(
1729 IMimeSecurity
* iface
,
1730 const HWND hwndParent
,
1734 FIXME("(%p)->(%p, %p, %p): stub\n", iface
, hwndParent
, pBody
, pdwSecType
);
1738 static HRESULT WINAPI
MimeSecurity_GetCertData(
1739 IMimeSecurity
* iface
,
1740 const PCX509CERT pX509Cert
,
1741 const CERTDATAID dataid
,
1742 LPPROPVARIANT pValue
)
1744 FIXME("(%p)->(%p, %x, %p): stub\n", iface
, pX509Cert
, dataid
, pValue
);
1749 static const IMimeSecurityVtbl MimeSecurityVtbl
=
1751 MimeSecurity_QueryInterface
,
1752 MimeSecurity_AddRef
,
1753 MimeSecurity_Release
,
1754 MimeSecurity_InitNew
,
1755 MimeSecurity_CheckInit
,
1756 MimeSecurity_EncodeMessage
,
1757 MimeSecurity_EncodeBody
,
1758 MimeSecurity_DecodeMessage
,
1759 MimeSecurity_DecodeBody
,
1760 MimeSecurity_EnumCertificates
,
1761 MimeSecurity_GetCertificateName
,
1762 MimeSecurity_GetMessageType
,
1763 MimeSecurity_GetCertData
1766 /***********************************************************************
1767 * MimeOleCreateSecurity (INETCOMM.@)
1769 HRESULT WINAPI
MimeOleCreateSecurity(IMimeSecurity
**ppSecurity
)
1773 TRACE("(%p)\n", ppSecurity
);
1777 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
1778 if (!This
) return E_OUTOFMEMORY
;
1780 This
->lpVtbl
= &MimeSecurityVtbl
;
1783 *ppSecurity
= (IMimeSecurity
*)&This
->lpVtbl
;