dovecot-2.2: imap: Handle UID commands without a wrapper UID com...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 24 19:49:06 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/558b0b13779d
changeset: 15925:558b0b13779d
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 24 19:48:55 2013 +0200
description:
imap: Handle UID commands without a wrapper UID command.
This avoids calling command hooks once for UID command and again for the
real command.
diffstat:
src/imap/Makefile.am | 1 -
src/imap/cmd-uid.c | 28 ----------------------------
src/imap/imap-client.c | 12 +++++++++++-
src/imap/imap-commands.c | 1 -
4 files changed, 11 insertions(+), 31 deletions(-)
diffs (76 lines):
diff -r 08edb5716823 -r 558b0b13779d src/imap/Makefile.am
--- a/src/imap/Makefile.am Sun Feb 24 19:39:52 2013 +0200
+++ b/src/imap/Makefile.am Sun Feb 24 19:48:55 2013 +0200
@@ -57,7 +57,6 @@
cmd-store.c \
cmd-subscribe.c \
cmd-thread.c \
- cmd-uid.c \
cmd-unselect.c \
cmd-unsubscribe.c \
cmd-urlfetch.c \
diff -r 08edb5716823 -r 558b0b13779d src/imap/cmd-uid.c
--- a/src/imap/cmd-uid.c Sun Feb 24 19:39:52 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/* Copyright (c) 2002-2013 Dovecot authors, see the included COPYING file */
-
-#include "imap-common.h"
-#include "imap-commands.h"
-
-bool cmd_uid(struct client_command_context *cmd)
-{
- struct command *command;
- const char *cmd_name;
-
- /* UID <command> <args> */
- cmd_name = imap_parser_read_word(cmd->parser);
- if (cmd_name == NULL)
- return FALSE;
-
- command = command_find(t_strconcat("UID ", cmd_name, NULL));
- if (command == NULL) {
- client_send_command_error(cmd, t_strconcat(
- "Unknown UID command ", cmd_name, NULL));
- return TRUE;
- }
-
- cmd->name = p_strconcat(cmd->pool, "UID ", cmd_name, NULL);
- cmd->cmd_flags = command->flags;
- cmd->func = command->func;
- cmd->uid = TRUE;
- return command_exec(cmd);
-}
diff -r 08edb5716823 -r 558b0b13779d src/imap/imap-client.c
--- a/src/imap/imap-client.c Sun Feb 24 19:39:52 2013 +0200
+++ b/src/imap/imap-client.c Sun Feb 24 19:48:55 2013 +0200
@@ -794,7 +794,17 @@
cmd->name = imap_parser_read_word(cmd->parser);
if (cmd->name == NULL)
return FALSE; /* need more data */
- cmd->name = p_strdup(cmd->pool, cmd->name);
+
+ /* UID commands are a special case. better to handle them
+ here. */
+ if (!cmd->uid && strcasecmp(cmd->name, "UID") == 0) {
+ cmd->uid = TRUE;
+ cmd->name = imap_parser_read_word(cmd->parser);
+ if (cmd->name == NULL)
+ return FALSE; /* need more data */
+ }
+ cmd->name = !cmd->uid ? p_strdup(cmd->pool, cmd->name) :
+ p_strconcat(cmd->pool, "UID ", cmd->name, NULL);
imap_refresh_proctitle();
}
diff -r 08edb5716823 -r 558b0b13779d src/imap/imap-commands.c
--- a/src/imap/imap-commands.c Sun Feb 24 19:39:52 2013 +0200
+++ b/src/imap/imap-commands.c Sun Feb 24 19:48:55 2013 +0200
@@ -38,7 +38,6 @@
{ "FETCH", cmd_fetch, COMMAND_FLAG_USES_SEQS },
{ "SEARCH", cmd_search, COMMAND_FLAG_USES_SEQS },
{ "STORE", cmd_store, COMMAND_FLAG_USES_SEQS },
- { "UID", cmd_uid, 0 },
{ "UID COPY", cmd_copy, COMMAND_FLAG_BREAKS_SEQS },
{ "UID FETCH", cmd_fetch, COMMAND_FLAG_BREAKS_SEQS },
{ "UID SEARCH", cmd_search, COMMAND_FLAG_BREAKS_SEQS },
More information about the dovecot-cvs
mailing list