/*
* git-imap-send - drops patches into an imap Drafts folder
* derived from isync/mbsync - mailbox synchronizer
*
* Copyright (C) 2000-2002 Michael R. Elkins <me@mutt.org>
* Copyright (C) 2002-2004 Oswald Buddenhagen <ossi@users.sf.net>
* Copyright (C) 2004 Theodore Y. Ts'o <tytso@mit.edu>
* Copyright (C) 2006 Mike McCormack
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "cache.h"
#include "credential.h"
#include "exec_cmd.h"
#include "run-command.h"
#ifdef NO_OPENSSL
typedef void *SSL;
#endif
static const char imap_send_usage[] = "git imap-send < <mbox>";
#undef DRV_OK
#define DRV_OK 0
#define DRV_MSG_BAD -1
#define DRV_BOX_BAD -2
#define DRV_STORE_BAD -3
static int Verbose, Quiet;
__attribute__((format (printf, 1, 2)))
static void imap_info(const char *, ...);
__attribute__((format (printf, 1, 2)))
static void imap_warn(const char *, ...);
static char *next_arg(char **);
__attribute__((format (printf, 3, 4)))
static int nfsnprintf(char *buf, int blen, const char *fmt, ...);
static int nfvasprintf(char **strp, const char *fmt, va_list ap)
{
int len;
char tmp[8192];
len = vsnprintf(tmp, sizeof(tmp), fmt, ap);
if (len < 0)
die("Fatal: Out of memory");
if (len >= sizeof(tmp))
die("imap command overflow!");
*strp = xmemdupz(tmp, len);
return len;
}
struct imap_server_conf {
char *name;
char *tunnel;
char *host;
int port;
char *user;
char *pass;
int use_ssl;
int ssl_verify;
int use_html;
char *auth_method;
};
static struct imap_server_conf server = {
NULL, /* name */
NULL, /* tunnel */
NULL, /* host */
|