* cmd_queue - Add a IMAP command to the queue
* @param adata Imap Account data
* @param cmdstr Command string
- * @param flags Server flags, e.g. #IMAP_CMD_POLL
+ * @param flags Server flags, see #ImapCmdFlags
* @retval 0 Success
* @retval <0 Failure, e.g. #IMAP_CMD_BAD
*
* If the queue is full, attempts to drain it.
*/
-static int cmd_queue(struct ImapAccountData *adata, const char *cmdstr, int flags)
+static int cmd_queue(struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags)
{
if (cmd_queue_full(adata))
{
* cmd_start - Start a new IMAP command
* @param adata Imap Account data
* @param cmdstr Command string
- * @param flags Command flags, e.g. #IMAP_CMD_QUEUE
+ * @param flags Command flags, see #ImapCmdFlags
* @retval 0 Success
* @retval <0 Failure, e.g. #IMAP_CMD_BAD
*/
-static int cmd_start(struct ImapAccountData *adata, const char *cmdstr, int flags)
+static int cmd_start(struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags)
{
int rc;
* imap_exec - Execute a command and wait for the response from the server
* @param adata Imap Account data
* @param cmdstr Command to execute
- * @param flags Flags, e.g. #IMAP_CMD_PASS
+ * @param flags Flags, see #ImapCmdFlags
* @retval #IMAP_EXEC_SUCCESS Command successful or queued
* @retval #IMAP_EXEC_ERROR Command returned an error
* @retval #IMAP_EXEC_FATAL Imap connection failure
*
* Also, handle untagged responses.
*/
-int imap_exec(struct ImapAccountData *adata, const char *cmdstr, int flags)
+int imap_exec(struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags)
{
int rc;
#define IMAP_NEWMAIL_PENDING (1 << 3) ///< New mail is waiting on the server
#define IMAP_FLAGS_PENDING (1 << 4) ///< Flags have changed on the server
-/* imap_exec flags (see imap_exec) */
+typedef uint8_t ImapCmdFlags; ///< Flags for imap_exec(), e.g. #IMAP_CMD_PASS
+#define IMAP_CMD_NO_FLAGS 0 ///< No flags are set
#define IMAP_CMD_PASS (1 << 0) ///< Command contains a password. Suppress logging
#define IMAP_CMD_QUEUE (1 << 1) ///< Queue a command, do not execute
#define IMAP_CMD_POLL (1 << 2) ///< Poll the tcp connection before running the imap command
void imap_cmd_finish(struct ImapAccountData *adata);
bool imap_code(const char *s);
const char *imap_cmd_trailer(struct ImapAccountData *adata);
-int imap_exec(struct ImapAccountData *adata, const char *cmdstr, int flags);
+int imap_exec(struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags);
int imap_cmd_idle(struct ImapAccountData *adata);
/* message.c */