changeset 8730:9b5d68776d03 HEAD

imap: Store command args to client command contexts for debugging purposes.
author Timo Sirainen <tss@iki.fi>
date Fri, 06 Feb 2009 13:39:48 -0500
parents b7ebdade6cbd
children 3949c6d2e4c8
files src/imap/client.c src/imap/client.h
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/client.c	Fri Feb 06 13:38:54 2009 -0500
+++ b/src/imap/client.c	Fri Feb 06 13:39:48 2009 -0500
@@ -9,6 +9,7 @@
 #include "ostream.h"
 #include "var-expand.h"
 #include "imap-resp-code.h"
+#include "imap-util.h"
 #include "mail-namespace.h"
 #include "commands.h"
 
@@ -300,6 +301,7 @@
 bool client_read_args(struct client_command_context *cmd, unsigned int count,
 		      unsigned int flags, const struct imap_arg **args_r)
 {
+	string_t *str;
 	int ret;
 
 	i_assert(count <= INT_MAX);
@@ -309,6 +311,11 @@
 		/* all parameters read successfully */
 		i_assert(cmd->client->input_lock == NULL ||
 			 cmd->client->input_lock == cmd);
+
+		str = t_str_new(256);
+		imap_args_to_str(str, *args_r);
+		cmd->args = p_strdup(cmd->pool, str_c(str));
+
 		cmd->client->input_lock = NULL;
 		return TRUE;
 	} else if (ret == -2) {
--- a/src/imap/client.h	Fri Feb 06 13:38:54 2009 -0500
+++ b/src/imap/client.h	Fri Feb 06 13:39:48 2009 -0500
@@ -48,8 +48,14 @@
 	struct client *client;
 
 	pool_t pool;
+	/* IMAP command tag */
 	const char *tag;
+	/* Name of this command */
 	const char *name;
+	/* Parameters for this command. These are generated from parsed IMAP
+	   arguments, so they may not be exactly the same as how client sent
+	   them. */
+	const char *args;
 	enum command_flags cmd_flags;
 
 	command_func_t *func;