]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
IMAP: add CURLOPT_UPLOAD_FLAGS and --upload-flags
authortiymat <138939221+tiymat@users.noreply.github.com>
Sat, 11 Jan 2025 20:50:12 +0000 (17:20 -0330)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 4 Mar 2025 14:21:16 +0000 (15:21 +0100)
Set properties on the uploaded resource.

Test 3209 and 3210 verify.

Closes #15970

25 files changed:
docs/TODO
docs/cmdline-opts/Makefile.inc
docs/cmdline-opts/upload-file.md
docs/cmdline-opts/upload-flags.md [new file with mode: 0644]
docs/internals/STRPARSE.md
docs/libcurl/curl_easy_setopt.md
docs/libcurl/opts/CURLOPT_UPLOAD_FLAGS.md [new file with mode: 0644]
docs/libcurl/opts/Makefile.inc
docs/libcurl/symbols-in-versions
docs/options-in-versions
include/curl/curl.h
lib/easyoptions.c
lib/imap.c
lib/setopt.c
lib/urldata.h
src/tool_cfgable.c
src/tool_cfgable.h
src/tool_getparam.c
src/tool_getparam.h
src/tool_listhelp.c
src/tool_operate.c
src/tool_setopt.c
tests/data/Makefile.am
tests/data/test3209 [new file with mode: 0644]
tests/data/test3210 [new file with mode: 0644]

index 62affea011b3c4ebe5bb681293fbab20fd02877b..d4890f95d08ad936b80ad30ae526610b36879e9f 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -92,7 +92,6 @@
 
  9. IMAP
  9.1 Enhanced capability support
- 9.2 upload unread
 
  10. LDAP
  10.1 SASL based authentication mechanisms
  Add the ability, for an application that uses libcurl, to obtain the list of
  capabilities returned from the CAPABILITY command.
 
-9.2 upload unread
-
- Uploads over IMAP currently always set the email as "read" (or "seen"). It
- would be good to offer a way for users to select for uploads to remain
- unread.
-
 10. LDAP
 
 10.1 SASL based authentication mechanisms
index be6fadd26bb1cde86e59918f911191a4b84fba3d..3cc44c989604e98a61f28554021998dc4460e630 100644 (file)
@@ -301,6 +301,7 @@ DPAGES = \
   trace.md \
   unix-socket.md \
   upload-file.md \
+  upload-flags.md \
   url.md \
   url-query.md \
   use-ascii.md \
index 7e9ffbf1e68a58ecad4e6b6042f81b9d900dfb8d..5a2842e58ad80628eb9e1e3050e156cba2764df9 100644 (file)
@@ -31,7 +31,7 @@ filename or curl thinks that your last directory name is the remote filename
 to use.
 
 When putting the local filename at the end of the URL, curl ignores what is on
-the left side of any slash (/) or backslash (\) used in the filename and only
+the left side of any slash (/) or backslash (\\) used in the filename and only
 appends what is on the right side of the rightmost such character.
 
 Use the filename `-` (a single dash) to use stdin instead of a given file.
diff --git a/docs/cmdline-opts/upload-flags.md b/docs/cmdline-opts/upload-flags.md
new file mode 100644 (file)
index 0000000..e30fb3d
--- /dev/null
@@ -0,0 +1,24 @@
+---
+c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+SPDX-License-Identifier: curl
+Long: upload-flags
+Arg: <flags>
+Help: IMAP upload behavior
+Category: curl output
+Added: 8.13.0
+Multi: single
+See-also:
+  - upload-file
+Example:
+  - --upload-flags Flagged,!Seen --upload-file local/dir/file $URL
+---
+
+# `--upload-flags`
+
+Specify additional behavior to apply to uploaded files. Flags are
+specified as either a single flag value or a comma-separated list
+of flag values. These values are case-sensitive and may be negated
+by prepending them with a '-' character. Currently the following
+flag values are accepted: answered, deleted, draft, flagged, and
+seen. The currently-accepted flag values are used to set flags on
+IMAP uploads.
index b6117df9acefab7fa66333c8f443aa52ed23b7fa..82fae94bda2a353be2433b4962e61211b7d54a4a 100644 (file)
@@ -81,7 +81,7 @@ int Curl_str_quotedword(char **linep, struct Curl_str *out, const size_t max);
 ~~~
 
 Get a "quoted" word. This means everything that is provided within a leading
-and an ending double character. No escaping possible.
+and an ending double quote character. No escaping possible.
 
 `max` is the longest accepted word, or it returns error.
 
index b6e08912ee0043054c04b34cbfeca8a595872879..bf5f90e25fb1bab4562ae7748cc02b70034669a3 100644 (file)
@@ -1273,6 +1273,10 @@ Upload data. See CURLOPT_UPLOAD(3)
 
 Set upload buffer size. See CURLOPT_UPLOAD_BUFFERSIZE(3)
 
+## CURLOPT_UPLOAD_FLAGS
+
+Set upload flags. See CURLOPT_UPLOAD_FLAGS(3)
+
 ## CURLOPT_URL
 
 URL to work on. See CURLOPT_URL(3)
diff --git a/docs/libcurl/opts/CURLOPT_UPLOAD_FLAGS.md b/docs/libcurl/opts/CURLOPT_UPLOAD_FLAGS.md
new file mode 100644 (file)
index 0000000..06b53f3
--- /dev/null
@@ -0,0 +1,100 @@
+---
+c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
+SPDX-License-Identifier: curl
+Title: CURLOPT_UPLOAD_FLAGS
+Section: 3
+Source: libcurl
+See-also:
+  - CURLOPT_UPLOAD (3)
+Protocol:
+  - IMAP
+  - IMAPS
+Added-in: 8.13.0
+---
+
+# NAME
+
+CURLOPT_UPLOAD_FLAGS - upload flags for IMAP
+
+# SYNOPSIS
+
+~~~c
+#include <curl/curl.h>
+
+CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD_FLAGS, long bitmask);
+~~~
+
+# DESCRIPTION
+
+Pass a long as parameter, which is set to a bitmask, to tell libcurl which
+flags to send the server relating to uploaded files. The current supported
+flags are **CURLULFLAG_ANSWERED**, which sets the **Answered** flag for IMAP
+uploads, **CURLULFLAG_DELETED**, which sets the **Deleted** flag for IMAP
+uploads, **CURLULFLAG_DRAFT**, which sets the **Draft** flag for IMAP uploads,
+**CURLULFLAG_FLAGGED**, which sets the **Flagged** flag for IMAP uploads, and
+**CURLULFLAG_SEEN**, which sets the **Seen** flag for IMAP uploads.
+
+# DEFAULT
+
+A bitmask with only the **CURLULFLAG_SEEN** flag set.
+
+# %PROTOCOLS%
+
+# EXAMPLE
+
+~~~c
+static size_t read_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
+{
+  FILE *src = userdata;
+  /* copy as much data as possible into the 'ptr' buffer, but no more than
+     'size' * 'nmemb' bytes */
+  size_t retcode = fread(ptr, size, nmemb, src);
+
+  return retcode;
+}
+
+int main(void)
+{
+  CURL *curl = curl_easy_init();
+  if(curl) {
+    FILE *src = fopen("local-file", "r");
+    curl_off_t fsize; /* set this to the size of the input file */
+
+    /* we want to use our own read function */
+    curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_cb);
+
+    /* enable uploading */
+    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
+
+    /* specify target */
+    curl_easy_setopt(curl, CURLOPT_URL, "imap://example.com:993/mailbox");
+
+    /* provide username */
+    curl_easy_setopt(curl, CURLOPT_USERNAME, "user@example.com");
+
+    /* provide password */
+    curl_easy_setopt(curl, CURLOPT_PASSWORD, "password");
+
+    /* specify that uploaded mail should be considered flagged */
+    curl_easy_setopt(curl, CURLOPT_UPLOAD_FLAGS, CURLULFLAG_FLAGGED);
+
+    /* now specify which pointer to pass to our callback */
+    curl_easy_setopt(curl, CURLOPT_READDATA, src);
+
+    /* Set the size of the file to upload */
+    curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize);
+
+    /* perform the upload */
+    curl_easy_perform(curl);
+  }
+}
+~~~
+
+# %AVAILABILITY%
+
+# RETURN VALUE
+
+curl_easy_setopt(3) returns a CURLcode indicating success or error.
+
+CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
+libcurl-errors(3).
index 9d8606dd06842b53ea49b0a692ccd7fee5cdee29..24f668cb07767d2b28760c89479111fc160f7fd3 100644 (file)
@@ -411,6 +411,7 @@ man_MANS =                                      \
   CURLOPT_UPKEEP_INTERVAL_MS.3                  \
   CURLOPT_UPLOAD.3                              \
   CURLOPT_UPLOAD_BUFFERSIZE.3                   \
+  CURLOPT_UPLOAD_FLAGS.3                        \
   CURLOPT_URL.3                                 \
   CURLOPT_USE_SSL.3                             \
   CURLOPT_USERAGENT.3                           \
index 39771cafc9c45cb77572e991f7cda17c570ade2c..5e744f02d4166b67e3fef4d848cde67f3f0da80e 100644 (file)
@@ -895,6 +895,7 @@ CURLOPT_UNRESTRICTED_AUTH       7.10.4
 CURLOPT_UPKEEP_INTERVAL_MS      7.62.0
 CURLOPT_UPLOAD                  7.1
 CURLOPT_UPLOAD_BUFFERSIZE       7.62.0
+CURLOPT_UPLOAD_FLAGS            8.13.0
 CURLOPT_URL                     7.1
 CURLOPT_USE_SSL                 7.17.0
 CURLOPT_USERAGENT               7.1
@@ -1128,6 +1129,11 @@ CURLUPART_SCHEME                7.62.0
 CURLUPART_URL                   7.62.0
 CURLUPART_USER                  7.62.0
 CURLUPART_ZONEID                7.65.0
+CURLULFLAG_ANSWERED             8.13.0
+CURLULFLAG_DELETED              8.13.0
+CURLULFLAG_DRAFT                8.13.0
+CURLULFLAG_FLAGGED              8.13.0
+CURLULFLAG_SEEN                 8.13.0
 CURLUSESSL_ALL                  7.17.0
 CURLUSESSL_CONTROL              7.17.0
 CURLUSESSL_NONE                 7.17.0
index 057cbafccd9f4ff5ab9513a97668197c14e2e546..fceff631bfc6682072042a2a1e03cea5773fee9c 100644 (file)
 --trace-time                         7.14.0
 --unix-socket                        7.40.0
 --upload-file (-T)                   4.0
+--upload-flags                       8.13.0
 --url                                7.5
 --url-query                          7.87.0
 --use-ascii (-B)                     5.0
index c80708f3f052493516a86c4028e30d3ef52b462e..8e62310b9d19ed5c155fa277971ac335fe1e5ac2 100644 (file)
@@ -1024,6 +1024,12 @@ typedef enum {
 #define CURLALTSVC_H2           (1<<4)
 #define CURLALTSVC_H3           (1<<5)
 
+/* bitmask values for CURLOPT_UPLOAD_FLAGS */
+#define CURLULFLAG_ANSWERED (1L<<0)
+#define CURLULFLAG_DELETED  (1L<<1)
+#define CURLULFLAG_DRAFT    (1L<<2)
+#define CURLULFLAG_FLAGGED  (1L<<3)
+#define CURLULFLAG_SEEN     (1L<<4)
 
 struct curl_hstsentry {
   char *name;
@@ -2237,6 +2243,8 @@ typedef enum {
   /* maximum number of keepalive probes (Linux, *BSD, macOS, etc.) */
   CURLOPT(CURLOPT_TCP_KEEPCNT, CURLOPTTYPE_LONG, 326),
 
+  CURLOPT(CURLOPT_UPLOAD_FLAGS, CURLOPTTYPE_LONG, 327),
+
   CURLOPT_LASTENTRY /* the last unused */
 } CURLoption;
 
index f2ced2cb5083ec6d633745ef99d30e9242283cd2..be617b5d2a21ec9b2cd527132922a8dfb2e70f41 100644 (file)
@@ -353,6 +353,7 @@ struct curl_easyoption Curl_easyopts[] = {
   {"UPKEEP_INTERVAL_MS", CURLOPT_UPKEEP_INTERVAL_MS, CURLOT_LONG, 0},
   {"UPLOAD", CURLOPT_UPLOAD, CURLOT_LONG, 0},
   {"UPLOAD_BUFFERSIZE", CURLOPT_UPLOAD_BUFFERSIZE, CURLOT_LONG, 0},
+  {"UPLOAD_FLAGS", CURLOPT_UPLOAD_FLAGS, CURLOT_LONG, 0},
   {"URL", CURLOPT_URL, CURLOT_STRING, 0},
   {"USERAGENT", CURLOPT_USERAGENT, CURLOT_STRING, 0},
   {"USERNAME", CURLOPT_USERNAME, CURLOT_STRING, 0},
@@ -377,6 +378,6 @@ struct curl_easyoption Curl_easyopts[] = {
  */
 int Curl_easyopts_check(void)
 {
-  return (CURLOPT_LASTENTRY % 10000) != (326 + 1);
+  return (CURLOPT_LASTENTRY % 10000) != (327 + 1);
 }
 #endif
index 778530ea959dba3f2abf9c3857a6e9b0c1eb24e4..c05ff1e1402abd61c4395dfae6abeba6520398a1 100644 (file)
@@ -36,6 +36,7 @@
  ***************************************************************************/
 
 #include "curl_setup.h"
+#include "dynbuf.h"
 
 #ifndef CURL_DISABLE_IMAP
 
@@ -192,6 +193,10 @@ static const struct SASLproto saslimap = {
   SASL_FLAG_BASE64            /* Configuration flags */
 };
 
+struct ulbits {
+  int bit;
+  const char *flag;
+};
 
 /***********************************************************************
  *
@@ -760,6 +765,7 @@ static CURLcode imap_perform_append(struct Curl_easy *data)
   CURLcode result = CURLE_OK;
   struct IMAP *imap = data->req.p.imap;
   char *mailbox;
+  struct dynbuf flags;
 
   /* Check we have a mailbox */
   if(!imap->mailbox) {
@@ -808,10 +814,43 @@ static CURLcode imap_perform_append(struct Curl_easy *data)
   if(!mailbox)
     return CURLE_OUT_OF_MEMORY;
 
-  /* Send the APPEND command */
-  result = imap_sendf(data, "APPEND %s (\\Seen) {%" FMT_OFF_T "}",
-                      mailbox, data->state.infilesize);
+  /* Generate flags string and send the APPEND command */
+  Curl_dyn_init(&flags, 100);
+  if(data->set.upload_flags) {
+    int i;
+    struct ulbits ulflag[] = {
+      {CURLULFLAG_ANSWERED, "Answered"},
+      {CURLULFLAG_DELETED, "Deleted"},
+      {CURLULFLAG_DRAFT, "Draft"},
+      {CURLULFLAG_FLAGGED, "Flagged"},
+      {CURLULFLAG_SEEN, "Seen"},
+      {0, NULL}
+    };
+
+    result = CURLE_OUT_OF_MEMORY;
+    if(Curl_dyn_add(&flags, " (")) {
+      goto cleanup;
+    }
+
+    for(i = 0; ulflag[i].bit; i++) {
+      if(data->set.upload_flags & ulflag[i].bit) {
+        if((Curl_dyn_len(&flags) > 2 && Curl_dyn_add(&flags, " ")) ||
+           Curl_dyn_add(&flags, "\\") || Curl_dyn_add(&flags, ulflag[i].flag))
+            goto cleanup;
+      }
+    }
+
+    if(Curl_dyn_add(&flags, ")"))
+      goto cleanup;
+  }
+  else if(Curl_dyn_add(&flags, ""))
+    goto cleanup;
+
+  result = imap_sendf(data, "APPEND %s%s {%" FMT_OFF_T "}",
+                      mailbox, Curl_dyn_ptr(&flags), data->state.infilesize);
 
+cleanup:
+  Curl_dyn_free(&flags);
   free(mailbox);
 
   if(!result)
index e3f944bdd3028ee350051f530bc8aabf3b6ac679..8aafc20fd74f5028ebc020a323439644ed5feeb7 100644 (file)
@@ -1403,7 +1403,9 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
      */
     Curl_safefree(data->set.str[STRING_SSL_ENGINE]);
     return Curl_ssl_set_engine_default(data);
-
+  case CURLOPT_UPLOAD_FLAGS:
+    data->set.upload_flags = (unsigned char)arg;
+    break;
   default:
     /* unknown option */
     return CURLE_UNKNOWN_OPTION;
index e944a95c07c025c8498b898f972c38f5b2c9638b..f22903f64f755b8e1c3e2414f3386f8369cafc31 100644 (file)
@@ -1723,6 +1723,7 @@ struct UserDefined {
                              to be used in the library's request(s) */
   unsigned char ipver; /* the CURL_IPRESOLVE_* defines in the public header
                           file 0 - whatever, 1 - v2, 2 - v6 */
+  unsigned char upload_flags; /* flags set by CURLOPT_UPLOAD_FLAGS */
 #ifdef HAVE_GSSAPI
   /* GSS-API credential delegation, see the documentation of
      CURLOPT_GSSAPI_DELEGATION */
index d7ee7b1b224a9b3fe5dc8add68319fd884fa94df..3de7cbd921c9f626722dfae0461c99a02bc07ffd 100644 (file)
@@ -45,6 +45,7 @@ void config_init(struct OperationConfig *config)
   config->http09_allowed = FALSE;
   config->ftp_skip_ip = TRUE;
   config->file_clobber_mode = CLOBBER_DEFAULT;
+  config->upload_flags = CURLULFLAG_SEEN;
   curlx_dyn_init(&config->postdata, MAX_FILE2MEMORY);
 }
 
index 950ef3862f1bddde7b25c12ed3789f38db19b65f..6a60a1622f77ae5a2cda650bc55f0b6d9fbe1580 100644 (file)
@@ -216,6 +216,7 @@ struct OperationConfig {
     CLOBBER_NEVER, /* If the file exists, always fail */
     CLOBBER_ALWAYS /* If the file exists, always overwrite it */
   } file_clobber_mode;
+  unsigned char upload_flags; /* Bitmask for --upload-flags */
   unsigned short porttouse;
   BIT(remote_time);
   BIT(cookiesession);       /* new session? */
index 5364098d2f1458d86bec98521a55b2abe7ed1317..e5837a1fff30cba9779b0a9b626d6c8069616e6f 100644 (file)
@@ -339,6 +339,7 @@ static const struct LongShort aliases[]= {
   {"trace-time",                 ARG_BOOL, ' ', C_TRACE_TIME},
   {"unix-socket",                ARG_FILE, ' ', C_UNIX_SOCKET},
   {"upload-file",                ARG_FILE, 'T', C_UPLOAD_FILE},
+  {"upload-flags",               ARG_STRG, ' ', C_UPLOAD_FLAGS},
   {"url",                        ARG_STRG, ' ', C_URL},
   {"url-query",                  ARG_STRG, ' ', C_URL_QUERY},
   {"use-ascii",                  ARG_BOOL, 'B', C_USE_ASCII},
@@ -1622,6 +1623,65 @@ static ParameterError parse_time_cond(struct GlobalConfig *global,
   return err;
 }
 
+struct flagmap {
+  const char *name;
+  size_t len;
+  unsigned char flag;
+};
+
+static const struct flagmap flag_table[] = {
+  {"answered", 8, CURLULFLAG_ANSWERED},
+  {"deleted",  7, CURLULFLAG_DELETED},
+  {"draft",    5, CURLULFLAG_DRAFT},
+  {"flagged",  7, CURLULFLAG_FLAGGED},
+  {"seen",     4, CURLULFLAG_SEEN},
+  {NULL,       0, 0}
+};
+
+static ParameterError parse_upload_flags(struct OperationConfig *config,
+                                      char *nextarg)
+{
+  char *flag;
+  ParameterError err = PARAM_OK;
+  char *tmp = strdup(nextarg);
+
+  if(!tmp)
+    return PARAM_NO_MEM;
+
+  flag = tmp;
+  while(flag) {
+    bool negate;
+    const struct flagmap *map;
+    char *next = strchr(flag, ','); /* Find next comma or end */
+    if(next)
+      *next++ = '\0';
+
+    negate = (*flag == '-');
+    if(negate)
+      flag++;
+
+    for(map = flag_table; map->name; map++) {
+      if(!strncmp(flag, map->name, map->len) && flag[map->len] == '\0') {
+        if(negate)
+          config->upload_flags &= (unsigned char)~map->flag;
+        else
+          config->upload_flags |= map->flag;
+        break;
+      }
+    }
+
+   if(!map->name) {
+     err = PARAM_OPTION_UNKNOWN;
+     break;
+   }
+
+   flag = next;
+  }
+
+  free(tmp);
+  return err;
+}
+
 ParameterError getparameter(const char *flag, /* f or -long-flag */
                             char *nextarg,    /* NULL if unset */
                             argv_item_t cleararg1,
@@ -2909,6 +2969,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
     case C_MPTCP: /* --mptcp */
       config->mptcp = TRUE;
       break;
+    case C_UPLOAD_FLAGS: /* --upload-flags */
+      err = parse_upload_flags(config, nextarg);
+      break;
     default: /* unknown flag */
       err = PARAM_OPTION_UNKNOWN;
       break;
index bcfb35f0657e3dfb9116856774f74db8f3ec2094..f058020ea7ccb6be8b7c363824fad890b68db85a 100644 (file)
@@ -293,6 +293,7 @@ typedef enum {
   C_IP_TOS,
   C_UNIX_SOCKET,
   C_UPLOAD_FILE,
+  C_UPLOAD_FLAGS,
   C_URL,
   C_URL_QUERY,
   C_USE_ASCII,
index 4605bf9cf02fa9f09f3875a61561deb221c01ce2..6aa6ec42a6188d0db22f5774ed7dd304884bcfb6 100644 (file)
@@ -808,6 +808,9 @@ const struct helptxt helptext[] = {
   {"-T, --upload-file <file>",
    "Transfer local FILE to destination",
    CURLHELP_IMPORTANT | CURLHELP_UPLOAD},
+  {"    --upload-flags <flags>",
+   "IMAP upload behavior",
+   CURLHELP_CURL | CURLHELP_OUTPUT},
   {"    --url <url/file>",
    "URL(s) to work with",
    CURLHELP_CURL},
index 1412758ebb4d83bede94140be681551d73ad7671..e7da9a5a82e5e49a0831dd08d454173b6f547584 100644 (file)
@@ -1749,6 +1749,9 @@ static CURLcode config2setopts(struct GlobalConfig *global,
     }
 #endif
   }
+  /* new in 8.13.0 */
+  if(config->upload_flags)
+    my_setopt(curl, CURLOPT_UPLOAD_FLAGS, (long)config->upload_flags);
   return result;
 }
 
index 3770c9e495565ffe1c44b7c47c8b387d3cb0cd99..02bb47fcd43f815d321c0b7dc8b540ffdd634775 100644 (file)
@@ -164,6 +164,7 @@ static const struct NameValue setopt_nv_CURLNONZERODEFAULTS[] = {
   NV1(CURLOPT_PROXY_SSL_VERIFYPEER, 1),
   NV1(CURLOPT_PROXY_SSL_VERIFYHOST, 1),
   NV1(CURLOPT_SOCKS5_AUTH, 1),
+  NV1(CURLOPT_UPLOAD_FLAGS, CURLULFLAG_SEEN),
   NVEND
 };
 
index 0f4e2c13869201687cf68341b4ffa4f5fa3f66f4..83fa55c1c986204144e9a8b3530a98250c5dc8b6 100644 (file)
@@ -273,6 +273,7 @@ test3032 \
 \
 test3100 test3101 test3102 test3103 test3104 test3105 \
 test3200 \
-test3201 test3202 test3203 test3204 test3205 test3207 test3208
-
+test3201 test3202 test3203 test3204 test3205 test3207 test3208 test3209 \
+test3210 \
+\
 EXTRA_DIST = $(TESTCASES) DISABLED
diff --git a/tests/data/test3209 b/tests/data/test3209
new file mode 100644 (file)
index 0000000..4c1c188
--- /dev/null
@@ -0,0 +1,62 @@
+<testcase>
+<info>
+<keywords>
+IMAP
+Clear Text
+APPEND
+UPLOAD
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+imap
+</server>
+<name>
+Upload message via IMAP with upload flags
+</name>
+<command>
+imap://%HOSTIP:%IMAPPORT/%TESTNUMBER -T %LOGDIR/upload%TESTNUMBER -u user:secret --upload-flags answered,deleted,draft,flagged,seen
+</command>
+<file name="%LOGDIR/upload%TESTNUMBER">
+Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+From: Fred Foobar <foobar@example.COM>
+Subject: afternoon meeting
+To: joe@example.com
+Message-Id: <B27397-0100000@example.COM>
+MIME-Version: 1.0
+Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+
+Hello Joe, do you think we can meet at 3:30 tomorrow?
+</file>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol crlf="yes">
+A001 CAPABILITY
+A002 LOGIN user secret
+A003 APPEND %TESTNUMBER (\Answered \Deleted \Draft \Flagged \Seen) {286}
+A004 LOGOUT
+</protocol>
+<upload>
+Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+From: Fred Foobar <foobar@example.COM>
+Subject: afternoon meeting
+To: joe@example.com
+Message-Id: <B27397-0100000@example.COM>
+MIME-Version: 1.0
+Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+
+Hello Joe, do you think we can meet at 3:30 tomorrow?
+</upload>
+</verify>
+</testcase>
diff --git a/tests/data/test3210 b/tests/data/test3210
new file mode 100644 (file)
index 0000000..7056b9c
--- /dev/null
@@ -0,0 +1,62 @@
+<testcase>
+<info>
+<keywords>
+IMAP
+Clear Text
+APPEND
+UPLOAD
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+imap
+</server>
+<name>
+Upload message unread via IMAP
+</name>
+<command>
+imap://%HOSTIP:%IMAPPORT/%TESTNUMBER -T %LOGDIR/upload%TESTNUMBER -u user:secret --upload-flags -seen
+</command>
+<file name="%LOGDIR/upload%TESTNUMBER">
+Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+From: Fred Foobar <foobar@example.COM>
+Subject: afternoon meeting
+To: joe@example.com
+Message-Id: <B27397-0100000@example.COM>
+MIME-Version: 1.0
+Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+</file>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol crlf="yes">
+A001 CAPABILITY
+A002 LOGIN user secret
+A003 APPEND %TESTNUMBER {356}
+A004 LOGOUT
+</protocol>
+<upload>
+Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
+From: Fred Foobar <foobar@example.COM>
+Subject: afternoon meeting
+To: joe@example.com
+Message-Id: <B27397-0100000@example.COM>
+MIME-Version: 1.0
+Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+</upload>
+</verify>
+</testcase>