dovecot-1.2: Added imap_dquote_append().
dovecot at dovecot.org
dovecot at dovecot.org
Sat Jun 21 09:25:48 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/8f3115354d14
changeset: 7916:8f3115354d14
user: Timo Sirainen <tss at iki.fi>
date: Sat Jun 21 09:21:51 2008 +0300
description:
Added imap_dquote_append().
diffstat:
2 files changed, 26 insertions(+)
src/lib-imap/imap-quote.c | 23 +++++++++++++++++++++++
src/lib-imap/imap-quote.h | 3 +++
diffs (41 lines):
diff -r 1789ac4637b0 -r 8f3115354d14 src/lib-imap/imap-quote.c
--- a/src/lib-imap/imap-quote.c Sat Jun 21 09:21:38 2008 +0300
+++ b/src/lib-imap/imap-quote.c Sat Jun 21 09:21:51 2008 +0300
@@ -108,3 +108,26 @@ const char *imap_quote(pool_t pool, cons
t_pop();
return ret;
}
+
+void imap_dquote_append(string_t *dest, const char *src)
+{
+ str_append_c(dest, '"');
+ for (; *src != '\0'; src++) {
+ switch (*src) {
+ case '"':
+ case '\\':
+ str_append_c(dest, '\\');
+ str_append_c(dest, *src);
+ break;
+ default:
+ if ((unsigned char)*src >= 0x80) {
+ /* 8bit input not allowed in dquotes */
+ break;
+ }
+
+ str_append_c(dest, *src);
+ break;
+ }
+ }
+ str_append_c(dest, '"');
+}
diff -r 1789ac4637b0 -r 8f3115354d14 src/lib-imap/imap-quote.h
--- a/src/lib-imap/imap-quote.h Sat Jun 21 09:21:38 2008 +0300
+++ b/src/lib-imap/imap-quote.h Sat Jun 21 09:21:51 2008 +0300
@@ -15,4 +15,7 @@ void imap_quote_append(string_t *str, co
imap_quote_append(str, (const unsigned char *)(value), \
(size_t)-1, compress_lwsp)
+/* Append data to destination string quoted using "". */
+void imap_dquote_append(string_t *dest, const char *src);
+
#endif
More information about the dovecot-cvs
mailing list