Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
920daf3b
...
920daf3b3206c3ffb39fe9662c6d0e95110451bb
authored
2000-05-10 03:07:16 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
mbx_unix.c message.c message.h message0.h rfc822.c
message_get_size.
1 parent
de5a84ae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
12 deletions
mailbox/mbx_unix.c
mailbox/message.c
mailbox/message.h
mailbox/message0.h
mailbox/mbx_unix.c
View file @
920daf3
...
...
@@ -1265,9 +1265,9 @@ mailbox_unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg)
off_t
offset
=
0
;
mailbox_unix_data_t
mud
;
mailbox_unix_message_t
mum
;
message_t
msg
;
istream_t
is
;
header_t
header
;
message_t
msg
=
NULL
;
istream_t
is
=
NULL
;
header_t
header
=
NULL
;
if
(
mbox
==
NULL
||
pmsg
==
NULL
||
(
mud
=
(
mailbox_unix_data_t
)
mbox
->
data
)
==
NULL
||
...
...
@@ -1294,6 +1294,9 @@ mailbox_unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg)
return
status
;
}
if
(
nread
==
0
)
break
;
tbuf
=
realloc
(
pbuf
,
offset
+
nread
);
if
(
tbuf
==
NULL
)
{
...
...
@@ -1315,8 +1318,9 @@ mailbox_unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg)
}
/* set the header */
status
=
header_init
(
&
header
,
pbuf
,
offset
,
MU_HEADER_RFC822
,
mum
);
if
(
status
!=
0
)
if
((
status
=
header_init
(
&
header
,
pbuf
,
offset
,
MU_HEADER_RFC822
,
mum
))
!=
0
||
(
status
=
message_set_header
(
msg
,
header
,
mum
))
!=
0
)
{
free
(
pbuf
);
message_destroy
(
&
msg
,
mum
);
...
...
@@ -1327,9 +1331,9 @@ mailbox_unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg)
/* prepare the istream */
status
=
istream_init
(
&
is
,
mailbox_unix_readstream
,
mum
);
if
(
status
!=
0
)
if
((
status
=
istream_init
(
&
is
,
mailbox_unix_readstream
,
mum
))
!=
0
||
(
status
=
message_set_istream
(
msg
,
is
,
mum
))
!=
0
)
{
free
(
pbuf
);
message_destroy
(
&
msg
,
mum
);
return
status
;
}
...
...
@@ -1337,6 +1341,19 @@ mailbox_unix_get_message (mailbox_t mbox, size_t msgno, message_t *pmsg)
/* set the attribute */
status
=
message_set_attribute
(
msg
,
mum
->
new_attr
,
mum
);
if
(
status
!=
0
)
{
message_destroy
(
&
msg
,
mum
);
return
status
;
}
/* set the size */
status
=
message_set_size
(
msg
,
mum
->
body_end
-
mum
->
body
,
mum
);
if
(
status
!=
0
)
{
message_destroy
(
&
msg
,
mum
);
return
status
;
}
if
(
pmsg
)
*
pmsg
=
msg
;
...
...
mailbox/message.c
View file @
920daf3
...
...
@@ -157,7 +157,7 @@ message_destroy (message_t *pmsg, void *owner)
message_t
msg
=
*
pmsg
;
msg
->
ref_count
--
;
if
((
msg
->
owner
&&
msg
->
owner
!
=
owner
)
||
if
((
msg
->
owner
&&
msg
->
owner
=
=
owner
)
||
(
msg
->
owner
==
NULL
&&
msg
->
ref_count
<=
0
))
{
/* header */
...
...
@@ -247,13 +247,24 @@ message_set_ostream (message_t msg, ostream_t os, void *owner)
}
int
message_
size
(
message_t
msg
,
size_t
*
size
)
message_
get_size
(
message_t
msg
,
size_t
*
p
size
)
{
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
msg
->
_size
)
return
msg
->
_size
(
msg
,
size
);
return
ENOSYS
;
if
(
psize
)
*
psize
=
msg
->
size
;
return
0
;
}
int
message_set_size
(
message_t
msg
,
size_t
size
,
void
*
owner
)
{
if
(
msg
==
NULL
)
return
EINVAL
;
if
(
msg
->
owner
!=
owner
)
return
EACCES
;
msg
->
size
=
size
;
return
0
;
}
int
...
...
mailbox/message.h
View file @
920daf3
...
...
@@ -54,6 +54,7 @@ extern int message_set_ostream __P ((message_t, ostream_t, void *owner));
extern
int
message_is_multipart
__P
((
message_t
));
extern
int
message_get_size
__P
((
message_t
,
size_t
*
));
extern
int
message_set_size
__P
((
message_t
,
size_t
,
void
*
owner
));
extern
int
message_get_attribute
__P
((
message_t
,
attribute_t
*
));
extern
int
message_set_attribute
__P
((
message_t
,
attribute_t
,
void
*
owner
));
...
...
mailbox/message0.h
View file @
920daf3
...
...
@@ -48,6 +48,7 @@ struct _message
body_t
body
;
attribute_t
attribute
;
size_t
num
;
size_t
size
;
/* who is the owner */
void
*
owner
;
...
...
Please
register
or
sign in
to post a comment