struct imap_msg {
char *command; /* Command to send */
- int queue; /* If true, queue for later delivery */
+ bool queue; /* If true, queue for later delivery */
struct imap_msg *next; /* Next pointer */
};
static int capability_set(const char *);
static void clear_capability(void);
static int have_capability(void);
-static int send_imap_command(netsec_context *, int noflush, char **errstr,
+static int send_imap_command(netsec_context *, bool noflush, char **errstr,
const char *fmt, ...) CHECK_PRINTF(4, 5);
static int get_imap_response(netsec_context *, const char *token,
char **tokenresp, char **status, int failerr,
static void ts_report(struct timeval *tv, const char *fmt, ...)
CHECK_PRINTF(2, 3);
-static void add_msg(int queue, const char *fmt, ...) CHECK_PRINTF(2, 3);
+static void add_msg(bool queue, const char *fmt, ...) CHECK_PRINTF(2, 3);
static bool timestamp = false;
} else {
char *capstring;
- if (send_imap_command(nsc, 0, &errstr, "CAPABILITY") != OK) {
+ if (send_imap_command(nsc, false, &errstr, "CAPABILITY") != OK) {
fprintf(stderr, "Unable to send CAPABILITY command: %s\n", errstr);
goto finish;
}
"has no support for STARTTLS\n");
goto finish;
}
- if (send_imap_command(nsc, 0, &errstr, "STARTTLS") != OK) {
+ if (send_imap_command(nsc, false, &errstr, "STARTTLS") != OK) {
fprintf(stderr, "Unable to issue STARTTLS: %s\n", errstr);
goto finish;
}
if (!have_capability()) {
char *capstring;
- if (send_imap_command(nsc, 0, &errstr, "CAPABILITY") != OK) {
+ if (send_imap_command(nsc, false, &errstr, "CAPABILITY") != OK) {
fprintf(stderr, "Unable to send CAPABILITY command: %s\n", errstr);
goto finish;
}
free(imsg);
}
- ts_report(&tv_auth, "Total command execution time");
+ if (timestamp)
+ ts_report(&tv_auth, "Total command execution time");
send_imap_command(nsc, 0, NULL, "LOGOUT");
get_imap_response(nsc, NULL, NULL, NULL, 0, NULL);
finish:
netsec_shutdown(nsc);
- ts_report(&tv_start, "Total elapsed time");
+ if (timestamp)
+ ts_report(&tv_start, "Total elapsed time");
exit(0);
}
*/
static int
-send_imap_command(netsec_context *nsc, int noflush, char **errstr,
+send_imap_command(netsec_context *nsc, bool noflush, char **errstr,
const char *fmt, ...)
{
static unsigned int seq = 0; /* Tag sequence number */
{
char *line;
struct imap_cmd *cmd;
- int numerrs = 0;
+ bool numerrs = false;
if (tokenresponse)
*tokenresponse = NULL;
cmd->next = cmd->next->next;
if (failerr && strncmp(line + strlen(cmd2->tag),
"OK ", 3) != 0) {
- numerrs++;
+ numerrs = true;
netsec_err(errstr, "%s", line + strlen(cmd2->tag));
}
free(cmd2);
}
}
- return numerrs == 0 ? OK : NOTOK;
+ return numerrs ? NOTOK : OK;
}
/*
*/
static void
-add_msg(int queue, const char *fmt, ...)
+add_msg(bool queue, const char *fmt, ...)
{
struct imap_msg *imsg;
va_list ap;