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
9f08b185
...
9f08b1859533e65404cc9dd39b09370ac8577075
authored
2007-11-12 12:40:27 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(mh_qfetch): Implement quick_get method.
1 parent
e6d644c1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
libproto/mh/mbox.c
libproto/mh/mbox.c
View file @
9f08b18
...
...
@@ -246,6 +246,44 @@ mh_scan0 (mu_mailbox_t mailbox, size_t msgno MU_ARG_UNUSED, size_t *pcount,
return
status
;
}
static
int
mh_qfetch
(
struct
_amd_data
*
amd
,
mu_message_qid_t
qid
)
{
char
*
p
;
size_t
num
=
0
;
int
attr_flags
=
0
;
struct
_mh_message
*
msg
;
p
=
qid
+
strlen
(
qid
)
-
1
;
if
(
!
isdigit
(
*
p
))
return
EINVAL
;
for
(
p
--
;
p
>=
qid
&&
isdigit
(
*
p
);
p
--
)
;
if
(
p
==
qid
)
return
EINVAL
;
num
=
strtoul
(
p
+
1
,
NULL
,
10
);
if
(
*
p
==
','
)
{
attr_flags
|=
MU_ATTRIBUTE_DELETED
;
p
--
;
}
if
(
*
p
!=
'/'
)
return
EINVAL
;
msg
=
calloc
(
1
,
sizeof
(
*
msg
));
msg
->
seq_number
=
num
;
msg
->
amd_message
.
attr_flags
=
attr_flags
;
msg
->
amd_message
.
deleted
=
attr_flags
&
MU_ATTRIBUTE_DELETED
;
_amd_message_insert
(
amd
,
(
struct
_amd_message
*
)
msg
);
return
0
;
}
/* Note: In this particular implementation the message sequence number
serves also as its UID. This allows to avoid many problems related
to keeping the uids in the headers of the messages. */
...
...
@@ -285,6 +323,7 @@ _mailbox_mh_init (mu_mailbox_t mailbox)
amd
->
msg_finish_delivery
=
NULL
;
amd
->
msg_file_name
=
_mh_message_name
;
amd
->
scan0
=
mh_scan0
;
amd
->
qfetch
=
mh_qfetch
;
amd
->
msg_cmp
=
mh_message_cmp
;
amd
->
message_uid
=
mh_message_uid
;
amd
->
next_uid
=
_mh_next_seq
;
...
...
Please
register
or
sign in
to post a comment