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
41b474d2
...
41b474d24f22b300e8fb0ace4a36e4ceade91b98
authored
2002-03-12 03:31:28 +0000
by
Sam Roberts
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Select now fails if the locking fails.
1 parent
190f1a2b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
16 deletions
imap4d/imap4d.h
imap4d/select.c
imap4d/imap4d.h
View file @
41b474d
...
...
@@ -169,7 +169,7 @@ extern int imap4d_search __P ((struct imap4d_command *, char *));
extern
int
imap4d_search0
__P
((
char
*
arg
,
int
isuid
,
char
*
replybuf
,
size_t
replysize
));
extern
int
imap4d_select
__P
((
struct
imap4d_command
*
,
char
*
));
extern
int
imap4d_select0
__P
((
struct
imap4d_command
*
,
char
*
,
int
));
extern
void
imap4d_select_status
__P
((
void
));
extern
int
imap4d_select_status
__P
((
void
));
extern
int
imap4d_status
__P
((
struct
imap4d_command
*
,
char
*
));
extern
int
imap4d_store
__P
((
struct
imap4d_command
*
,
char
*
));
extern
int
imap4d_store0
__P
((
char
*
,
int
,
char
*
,
size_t
));
...
...
imap4d/select.c
View file @
41b474d
...
...
@@ -80,44 +80,52 @@ imap4d_select0 (struct imap4d_command *command, char *arg, int flags)
if
(
!
mailbox_name
)
return
util_finish
(
command
,
RESP_NO
,
"Couldn't open mailbox"
);
if
(
mailbox_create
(
&
mbox
,
mailbox_name
)
==
0
&&
mailbox_open
(
mbox
,
flags
)
==
0
)
if
((
status
=
mailbox_create
(
&
mbox
,
mailbox_name
))
==
0
&&
(
status
=
mailbox_open
(
mbox
,
flags
))
==
0
)
{
free
(
mailbox_name
);
select_flags
=
flags
;
state
=
STATE_SEL
;
imap4d_select_status
();
if
((
status
=
imap4d_select_status
())
==
0
)
{
free
(
mailbox_name
);
/* Need to set the state explicitely for select. */
return
util_send
(
"%s OK [%s] %s Completed
\r\n
"
,
command
->
tag
,
(
MU_STREAM_READ
==
flags
)
?
"READ-ONLY"
:
"READ-WRITE"
,
command
->
name
);
}
status
=
util_finish
(
command
,
RESP_NO
,
"Couldn't open %s"
,
mailbox_name
);
}
status
=
util_finish
(
command
,
RESP_NO
,
"Couldn't open %s, %s"
,
mailbox_name
,
mu_errstring
(
status
));
free
(
mailbox_name
);
return
status
;
}
/* The code is shared between select and noop */
void
imap4d_select_status
()
int
imap4d_select_status
()
{
const
char
*
mflags
=
"
\\
Answered
\\
Flagged
\\
Deleted
\\
Seen
\\
Draft"
;
const
char
*
pflags
=
"
\\
Answered
\\
Deleted
\\
Seen"
;
unsigned
long
uidvalidity
=
0
;
size_t
count
=
0
,
recent
=
0
,
unseen
=
0
,
uidnext
=
0
;
int
status
=
0
;
if
(
state
!=
STATE_SEL
)
return
;
return
0
;
/* FIXME: this should be something! */
if
(
(
status
=
mailbox_uidvalidity
(
mbox
,
&
uidvalidity
))
||
(
status
=
mailbox_uidnext
(
mbox
,
&
uidnext
))
||
(
status
=
mailbox_messages_count
(
mbox
,
&
count
))
||
(
status
=
mailbox_messages_recent
(
mbox
,
&
recent
))
||
(
status
=
mailbox_message_unseen
(
mbox
,
&
unseen
))
)
return
status
;
mailbox_uidvalidity
(
mbox
,
&
uidvalidity
);
mailbox_uidnext
(
mbox
,
&
uidnext
);
mailbox_messages_count
(
mbox
,
&
count
);
mailbox_messages_recent
(
mbox
,
&
recent
);
mailbox_message_unseen
(
mbox
,
&
unseen
);
util_out
(
RESP_NONE
,
"%d EXISTS"
,
count
);
util_out
(
RESP_NONE
,
"%d RECENT"
,
recent
);
util_out
(
RESP_OK
,
"[UIDVALIDITY %d] UID valididy status"
,
uidvalidity
);
util_out
(
RESP_OK
,
"[UIDVALIDITY %d] UID valididy status"
,
uidvalidity
);
util_out
(
RESP_OK
,
"[UIDNEXT %d] Predicted next uid"
,
uidnext
);
if
(
unseen
)
util_out
(
RESP_OK
,
"[UNSEEN %d] first unseen messsage "
,
unseen
);
...
...
@@ -129,4 +137,7 @@ imap4d_select_status()
util_out
(
RESP_OK
,
"[PERMANENTFLAGS ()] No Permanent flags"
);
else
util_out
(
RESP_OK
,
"[PERMANENTFLAGS (%s)] Permanent flags"
,
pflags
);
return
0
;
}
...
...
Please
register
or
sign in
to post a comment