Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/imap/cmd-close.c @ 9575:0a00dcc4f0ea HEAD
lib-storage: Allow shared namespace prefix to use %variable modifiers.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 26 May 2010 17:07:51 +0100 |
parents | 00cd9aacd03c |
children |
rev | line source |
---|---|
9532
00cd9aacd03c
Updated copyright notices to include year 2010.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
1 /* Copyright (c) 2002-2010 Dovecot authors, see the included COPYING file */ |
0 | 2 |
3 #include "common.h" | |
4 #include "commands.h" | |
1640
db14aa8e2b5c
API change for expunging messages. Not exactly what I wanted, but good
Timo Sirainen <tss@iki.fi>
parents:
1445
diff
changeset
|
5 #include "imap-expunge.h" |
0 | 6 |
3863
55df57c028d4
Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents:
3141
diff
changeset
|
7 bool cmd_close(struct client_command_context *cmd) |
0 | 8 { |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
2676
diff
changeset
|
9 struct client *client = cmd->client; |
1212 | 10 struct mailbox *mailbox = client->mailbox; |
2676
542edc7f6091
Don't crash if CLOSEing without open mailbox.
Timo Sirainen <tss@iki.fi>
parents:
2190
diff
changeset
|
11 struct mail_storage *storage; |
7632
6e2e4e5c52f3
Fixed CLOSE HIGEHSTMODSEQ race condition. Added some checks to make
Timo Sirainen <tss@iki.fi>
parents:
7629
diff
changeset
|
12 int ret; |
1212 | 13 |
3141
61abed5f7864
Moved command-specific variables from struct client to struct
Timo Sirainen <tss@iki.fi>
parents:
2676
diff
changeset
|
14 if (!client_verify_open_mailbox(cmd)) |
0 | 15 return TRUE; |
16 | |
7816
ea6727a1220e
Changed the way mailbox changing ambiguity is checked.
Timo Sirainen <tss@iki.fi>
parents:
7647
diff
changeset
|
17 i_assert(client->mailbox_change_lock == NULL); |
8157
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
18 client->mailbox = NULL; |
0 | 19 |
7632
6e2e4e5c52f3
Fixed CLOSE HIGEHSTMODSEQ race condition. Added some checks to make
Timo Sirainen <tss@iki.fi>
parents:
7629
diff
changeset
|
20 storage = mailbox_get_storage(mailbox); |
6e2e4e5c52f3
Fixed CLOSE HIGEHSTMODSEQ race condition. Added some checks to make
Timo Sirainen <tss@iki.fi>
parents:
7629
diff
changeset
|
21 if ((ret = imap_expunge(mailbox, NULL)) < 0) |
7319
d76c54e092f5
CLOSE: Synchronize the mailbox after expunging messages to actually get them
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
22 client_send_untagged_storage_error(client, storage); |
8157
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
23 if (mailbox_sync(mailbox, 0, 0, NULL) < 0) |
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
24 client_send_untagged_storage_error(client, storage); |
559
c834e77b624c
Mostly mbox locking/syncing fixes. Still some problems though.
Timo Sirainen <tss@iki.fi>
parents:
450
diff
changeset
|
25 |
8157
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
26 if (mailbox_close(&mailbox) < 0) |
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
27 client_send_untagged_storage_error(client, storage); |
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
28 client_update_mailbox_flags(client, NULL); |
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
29 |
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
30 client_send_tagline(cmd, "OK Close completed."); |
5ca8140fcc95
CLOSE: Don't send any mailbox changes or HIGHESTMODSEQ to client.
Timo Sirainen <tss@iki.fi>
parents:
7818
diff
changeset
|
31 return TRUE; |
0 | 32 } |