Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
19cb4bcd
Commit
19cb4bcd
authored
Nov 26, 2007
by
Huw Davies
Committed by
Alexandre Julliard
Nov 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inetcomm: Implement IMimeBody:IsContentType.
parent
0bcd3077
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
2 deletions
+58
-2
mimeole.c
dlls/inetcomm/mimeole.c
+51
-2
mimeole.c
dlls/inetcomm/tests/mimeole.c
+7
-0
No files found.
dlls/inetcomm/mimeole.c
View file @
19cb4bcd
...
...
@@ -101,6 +101,8 @@ typedef struct MimeBody
struct
list
headers
;
struct
list
new_props
;
/* FIXME: This should be in a PropertySchema */
DWORD
next_prop_id
;
char
*
content_pri_type
;
char
*
content_sub_type
;
}
MimeBody
;
static
inline
MimeBody
*
impl_from_IMimeBody
(
IMimeBody
*
iface
)
...
...
@@ -343,6 +345,30 @@ static void read_value(header_t *header, char **cur)
*
cur
=
end
;
}
static
void
init_content_type
(
MimeBody
*
body
,
header_t
*
header
)
{
char
*
slash
;
DWORD
len
;
if
(
header
->
prop
->
id
!=
PID_HDR_CNTTYPE
)
{
ERR
(
"called with header %s
\n
"
,
header
->
prop
->
name
);
return
;
}
slash
=
strchr
(
header
->
value
.
pszVal
,
'/'
);
if
(
!
slash
)
{
WARN
(
"malformed context type value
\n
"
);
return
;
}
len
=
slash
-
header
->
value
.
pszVal
;
body
->
content_pri_type
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
+
1
);
memcpy
(
body
->
content_pri_type
,
header
->
value
.
pszVal
,
len
);
body
->
content_pri_type
[
len
]
=
'\0'
;
body
->
content_sub_type
=
strdupA
(
slash
+
1
);
}
static
HRESULT
parse_headers
(
MimeBody
*
body
,
IStream
*
stm
)
{
char
*
header_buf
,
*
cur_header_ptr
;
...
...
@@ -357,6 +383,9 @@ static HRESULT parse_headers(MimeBody *body, IStream *stm)
{
read_value
(
header
,
&
cur_header_ptr
);
list_add_tail
(
&
body
->
headers
,
&
header
->
entry
);
if
(
header
->
prop
->
id
==
PID_HDR_CNTTYPE
)
init_content_type
(
body
,
header
);
}
HeapFree
(
GetProcessHeap
(),
0
,
header_buf
);
...
...
@@ -448,6 +477,8 @@ static ULONG WINAPI MimeBody_Release(IMimeBody* iface)
empty_header_list
(
&
This
->
headers
);
empty_new_prop_list
(
&
This
->
new_props
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
content_pri_type
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
content_sub_type
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -631,8 +662,24 @@ static HRESULT WINAPI MimeBody_IsContentType(
LPCSTR
pszPriType
,
LPCSTR
pszSubType
)
{
FIXME
(
"stub
\n
"
);
return
E_NOTIMPL
;
MimeBody
*
This
=
impl_from_IMimeBody
(
iface
);
TRACE
(
"(%p)->(%s, %s)
\n
"
,
This
,
debugstr_a
(
pszPriType
),
debugstr_a
(
pszSubType
));
if
(
pszPriType
)
{
const
char
*
pri
=
This
->
content_pri_type
;
if
(
!
pri
)
pri
=
"text"
;
if
(
strcasecmp
(
pri
,
pszPriType
))
return
S_FALSE
;
}
if
(
pszSubType
)
{
const
char
*
sub
=
This
->
content_sub_type
;
if
(
!
sub
)
sub
=
"plain"
;
if
(
strcasecmp
(
sub
,
pszSubType
))
return
S_FALSE
;
}
return
S_OK
;
}
static
HRESULT
WINAPI
MimeBody_BindToObject
(
...
...
@@ -875,6 +922,8 @@ HRESULT MimeBody_create(IUnknown *outer, void **obj)
list_init
(
&
This
->
headers
);
list_init
(
&
This
->
new_props
);
This
->
next_prop_id
=
FIRST_CUSTOM_PROP_ID
;
This
->
content_pri_type
=
NULL
;
This
->
content_sub_type
=
NULL
;
*
obj
=
(
IMimeBody
*
)
&
This
->
lpVtbl
;
return
S_OK
;
...
...
dlls/inetcomm/tests/mimeole.c
View file @
19cb4bcd
...
...
@@ -113,6 +113,13 @@ static void test_CreateBody(void)
IStream_Seek
(
in
,
off
,
STREAM_SEEK_CUR
,
&
pos
);
ok
(
pos
.
LowPart
==
328
,
"pos %u
\n
"
,
pos
.
LowPart
);
hr
=
IMimeBody_IsContentType
(
body
,
"multipart"
,
"mixed"
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
hr
=
IMimeBody_IsContentType
(
body
,
"text"
,
"plain"
);
ok
(
hr
==
S_FALSE
,
"ret %08x
\n
"
,
hr
);
hr
=
IMimeBody_IsContentType
(
body
,
NULL
,
"mixed"
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
IMimeBody_Release
(
body
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment