char *tunnel;
char *host;
int port;
+ char *folder;
char *user;
char *pass;
int use_ssl;
NULL, /* tunnel */
NULL, /* host */
0, /* port */
+ NULL, /* folder */
NULL, /* user */
NULL, /* pass */
0, /* use_ssl */
if (Verbose) {
if (imap->num_in_progress)
printf("(%d in progress) ", imap->num_in_progress);
- if (memcmp(cmd->cmd, "LOGIN", 5))
+ if (!starts_with(cmd->cmd, "LOGIN"))
printf(">>> %s", buf);
else
printf(">>> %d LOGIN <user> <pass>\n", cmd->tag);
else /*if (!strcmp("BAD", arg))*/
resp = RESP_BAD;
fprintf(stderr, "IMAP command '%s' returned response (%s) - %s\n",
- memcmp(cmdp->cmd, "LOGIN", 5) ?
+ !starts_with(cmdp->cmd, "LOGIN") ?
cmdp->cmd : "LOGIN <user> <pass>",
arg, cmd ? cmd : "");
}
ctx = xcalloc(1, sizeof(*ctx));
- ctx->imap = imap = xcalloc(sizeof(*imap), 1);
+ ctx->imap = imap = xcalloc(1, sizeof(*imap));
imap->buf.sock.fd[0] = imap->buf.sock.fd[1] = -1;
imap->in_progress_append = &imap->in_progress;
/* open connection to IMAP server */
if (srvc->tunnel) {
- const char *argv[] = { srvc->tunnel, NULL };
- struct child_process tunnel = {NULL};
+ struct child_process tunnel = CHILD_PROCESS_INIT;
imap_info("Starting tunnel '%s'... ", srvc->tunnel);
- tunnel.argv = argv;
+ argv_array_push(&tunnel.args, srvc->tunnel);
tunnel.use_shell = 1;
tunnel.in = -1;
tunnel.out = -1;
if (start_command(&tunnel))
- die("cannot start proxy %s", argv[0]);
+ die("cannot start proxy %s", srvc->tunnel);
imap->buf.sock.fd[0] = tunnel.out;
imap->buf.sock.fd[1] = tunnel.in;
return 1;
}
-static char *imap_folder;
-
static void git_imap_config(void)
{
const char *val = NULL;
git_config_get_bool("imap.sslverify", &server.ssl_verify);
git_config_get_bool("imap.preformattedhtml", &server.use_html);
- git_config_get_string("imap.folder", &imap_folder);
+ git_config_get_string("imap.folder", &server.folder);
if (!git_config_get_value("imap.host", &val)) {
if (!val) {
if (!server.port)
server.port = server.use_ssl ? 993 : 143;
- if (!imap_folder) {
+ if (!server.folder) {
fprintf(stderr, "no imap store specified\n");
return 1;
}
}
/* write it to the imap server */
- ctx = imap_open_store(&server, imap_folder);
+ ctx = imap_open_store(&server, server.folder);
if (!ctx) {
fprintf(stderr, "failed to open store\n");
return 1;