Blob Blame History Raw
From 7a70f01fe8084431901433a2f74cb9c70fd00568 Mon Sep 17 00:00:00 2001
From: Timo Sirainen <timo.sirainen@open-xchange.com>
Date: Mon, 17 Aug 2020 18:26:01 +0300
Subject: [PATCH] lib-imap: Add imap_parser_client_read_tag()

---
 src/lib-imap/imap-parser.c | 6 ++++++
 src/lib-imap/imap-parser.h | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/src/lib-imap/imap-parser.c b/src/lib-imap/imap-parser.c
index 52d79282fa..cc283f5c06 100644
--- a/src/lib-imap/imap-parser.c
+++ b/src/lib-imap/imap-parser.c
@@ -1014,3 +1014,9 @@ int imap_parser_read_command_name(struct imap_parser *parser,
 {
 	return imap_parser_read_next_atom(parser, FALSE, name_r);
 }
+
+int imap_parser_client_read_tag(struct imap_parser *parser,
+				const char **tag_r)
+{
+	return imap_parser_read_next_atom(parser, FALSE, tag_r);
+}
diff --git a/src/lib-imap/imap-parser.h b/src/lib-imap/imap-parser.h
index 5e09d61d2b..cd3748c00f 100644
--- a/src/lib-imap/imap-parser.h
+++ b/src/lib-imap/imap-parser.h
@@ -108,5 +108,10 @@ int imap_parser_read_tag(struct imap_parser *parser, const char **tag_r);
    needed, -1 if input isn't a valid command name string. */
 int imap_parser_read_command_name(struct imap_parser *parser,
 				  const char **name_r);
+/* For IMAP clients: Read the command tag, which could also be "+" or "*".
+   Returns 1 if tag was returned, 0 if more data is needed, -1 if input isn't
+   valid. */
+int imap_parser_client_read_tag(struct imap_parser *parser,
+				const char **tag_r);
 
 #endif