boolean's comment said it existed to ensure storage was a char and not
an int so it could be packed in a struct, but the only struct using it
doesn't care about the space taken.
/* Callbacks return TRUE crawl_folders should crawl the children of `folder'.
* Callbacks need not duplicate folder, as crawl_folders does not free it. */
/* Callbacks return TRUE crawl_folders should crawl the children of `folder'.
* Callbacks need not duplicate folder, as crawl_folders does not free it. */
-typedef boolean (crawl_callback_t)(char *folder, void *baton);
+typedef bool (crawl_callback_t)(char *folder, void *baton);
/* Crawl the folder hierarchy rooted at the relative path `dir'. For each
* folder, pass `callback' the folder name (as a path relative to the current
/* Crawl the folder hierarchy rooted at the relative path `dir'. For each
* folder, pass `callback' the folder name (as a path relative to the current
#ifndef TRUE
#define TRUE true
#endif
#ifndef TRUE
#define TRUE true
#endif
-typedef unsigned char boolean; /* not int so we can pack in a structure */
/* If we're using gcc then tell it extra information so it can do more
* compile-time checks. */
/* If we're using gcc then tell it extra information so it can do more
* compile-time checks. */
*
* On error, return FALSE and set an error in ctx; ctx is always allocated.
*/
*
* On error, return FALSE and set an error in ctx; ctx is always allocated.
*/
mh_oauth_new(mh_oauth_ctx **ctx, const char *svc_name);
/*
mh_oauth_new(mh_oauth_ctx **ctx, const char *svc_name);
/*
*
* On error, return FALSE and leave cred untouched.
*/
*
* On error, return FALSE and leave cred untouched.
*/
mh_oauth_refresh(mh_oauth_cred *cred);
/*
* Return whether access token is present and not expired at time T.
*/
mh_oauth_refresh(mh_oauth_cred *cred);
/*
* Return whether access token is present and not expired at time T.
*/
mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred) PURE;
/*
mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred) PURE;
/*
*
* On error, return FALSE.
*/
*
* On error, return FALSE.
*/
mh_oauth_cred_save(FILE *fp, mh_oauth_cred *cred, const char *user);
/*
mh_oauth_cred_save(FILE *fp, mh_oauth_cred *cred, const char *user);
/*
* Retrieve the various entries for the OAuth mechanism
*/
* Retrieve the various entries for the OAuth mechanism
*/
mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
char *errbuf, size_t errbuflen);
mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
char *errbuf, size_t errbuflen);
/* Whether the response was too big; if so, the rest of the output fields
* are undefined. */
/* Whether the response was too big; if so, the rest of the output fields
* are undefined. */
/* HTTP response code */
long res_code;
/* HTTP response code */
long res_code;
char res_body[RESPONSE_BODY_MAX];
};
char res_body[RESPONSE_BODY_MAX];
};
-static boolean get_json_strings(const char *, size_t, FILE *, ...) ENDNULL;
-static boolean make_query_url(char *, size_t, CURL *, const char *, ...) ENDNULL;
-static boolean post(struct curl_ctx *, const char *, const char *);
+static bool get_json_strings(const char *, size_t, FILE *, ...) ENDNULL;
+static bool make_query_url(char *, size_t, CURL *, const char *, ...) ENDNULL;
+static bool post(struct curl_ctx *, const char *, const char *);
int
mh_oauth_do_xoauth(const char *user, const char *svc, unsigned char **oauth_res,
int
mh_oauth_do_xoauth(const char *user, const char *svc, unsigned char **oauth_res,
is_json(const char *content_type)
{
return content_type != NULL
is_json(const char *content_type)
{
return content_type != NULL
return concat(user_agent, " libcurl/", curl, NULL);
}
return concat(user_agent, " libcurl/", curl, NULL);
}
mh_oauth_new(mh_oauth_ctx **result, const char *svc_name)
{
mh_oauth_ctx *ctx;
mh_oauth_new(mh_oauth_ctx **result, const char *svc_name)
{
mh_oauth_ctx *ctx;
cred_from_response(mh_oauth_cred *cred, const char *content_type,
const char *input, size_t input_len)
{
cred_from_response(mh_oauth_cred *cred, const char *content_type,
const char *input, size_t input_len)
{
- boolean result = FALSE;
char *access_token, *expires_in, *refresh_token;
const mh_oauth_ctx *ctx = cred->ctx;
char *access_token, *expires_in, *refresh_token;
const mh_oauth_ctx *ctx = cred->ctx;
do_access_request(mh_oauth_cred *cred, const char *req_body)
{
mh_oauth_ctx *ctx = cred->ctx;
do_access_request(mh_oauth_cred *cred, const char *req_body)
{
mh_oauth_ctx *ctx = cred->ctx;
mh_oauth_refresh(mh_oauth_cred *cred)
{
mh_oauth_refresh(mh_oauth_cred *cred)
{
mh_oauth_ctx *ctx = cred->ctx;
if (cred->refresh_token == NULL) {
mh_oauth_ctx *ctx = cred->ctx;
if (cred->refresh_token == NULL) {
mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred)
{
return cred->access_token != NULL && t + EXPIRY_FUDGE < cred->expires_at;
mh_oauth_access_token_valid(time_t t, const mh_oauth_cred *cred)
{
return cred->access_token != NULL && t + EXPIRY_FUDGE < cred->expires_at;
load_creds(struct user_creds **result, FILE *fp, mh_oauth_ctx *ctx)
{
load_creds(struct user_creds **result, FILE *fp, mh_oauth_ctx *ctx)
{
- boolean success = FALSE;
char name[NAMESZ], value_buf[BUFSIZ];
int state;
m_getfld_state_t getfld_ctx;
char name[NAMESZ], value_buf[BUFSIZ];
int state;
m_getfld_state_t getfld_ctx;
save_user(FILE *fp, const char *user, const char *access, const char *refresh,
long expires_at)
{
save_user(FILE *fp, const char *user, const char *access, const char *refresh,
long expires_at)
{
mh_oauth_cred_save(FILE *fp, mh_oauth_cred *cred, const char *user)
{
struct user_creds *user_creds;
mh_oauth_cred_save(FILE *fp, mh_oauth_cred *cred, const char *user)
{
struct user_creds *user_creds;
* building the entire URL. Some of URL may already have been written into the
* result array in that case.
*/
* building the entire URL. Some of URL may already have been written into the
* result array in that case.
*/
make_query_url(char *s, size_t size, CURL *curl, const char *base_url, ...)
{
make_query_url(char *s, size_t size, CURL *curl, const char *base_url, ...)
{
- boolean result = FALSE;
size_t len;
char *prefix;
va_list ap;
size_t len;
char *prefix;
va_list ap;
post(struct curl_ctx *ctx, const char *url, const char *req_body)
{
CURL *curl = ctx->curl;
post(struct curl_ctx *ctx, const char *url, const char *req_body)
{
CURL *curl = ctx->curl;
*
* Even in that case, tokens has been allocated and must be freed.
*/
*
* Even in that case, tokens has been allocated and must be freed.
*/
parse_json(jsmntok_t **tokens, size_t *tokens_len,
const char *input, size_t input_len, FILE *log)
{
parse_json(jsmntok_t **tokens, size_t *tokens_len,
const char *input, size_t input_len, FILE *log)
{
int skip_tokens = 0;
/* whether the current token represents a field name */
/* The next token will be the value. */
int skip_tokens = 0;
/* whether the current token represents a field name */
/* The next token will be the value. */
int i;
for (i = 1; i <= token_count; i++) {
int i;
for (i = 1; i <= token_count; i++) {
*
* log may be used for debug-logging if not NULL.
*/
*
* log may be used for debug-logging if not NULL.
*/
get_json_strings(const char *input, size_t input_len, FILE *log, ...)
{
get_json_strings(const char *input, size_t input_len, FILE *log, ...)
{
- boolean result = FALSE;
jsmntok_t *tokens;
size_t tokens_len;
va_list ap;
jsmntok_t *tokens;
size_t tokens_len;
va_list ap;
}
/* Update all service_info fields that are overridden in profile. */
}
/* Update all service_info fields that are overridden in profile. */
update_svc(mh_oauth_service_info *svc, const char *svc_name, char *errbuf,
size_t errbuflen)
{
update_svc(mh_oauth_service_info *svc, const char *svc_name, char *errbuf,
size_t errbuflen)
{
mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
char *errbuf, size_t errbuflen)
{
mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
char *errbuf, size_t errbuflen)
{
-get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
+get_folder_info_body (char *fold, char *msg, bool *crawl_children)
{
int i, retval = 1;
struct msgs *mp = NULL;
{
int i, retval = 1;
struct msgs *mp = NULL;
get_folder_info_callback (char *fold, void *baton)
{
get_folder_info_callback (char *fold, void *baton)
{
- boolean crawl_children;
NMH_UNUSED (baton);
get_folder_info_body (fold, NULL, &crawl_children);
NMH_UNUSED (baton);
get_folder_info_body (fold, NULL, &crawl_children);
static int
get_folder_info (char *fold, char *msg)
{
static int
get_folder_info (char *fold, char *msg)
{
- boolean crawl_children;
int retval;
retval = get_folder_info_body (fold, msg, &crawl_children);
int retval;
retval = get_folder_info_body (fold, msg, &crawl_children);
}
/* Return TRUE if the sequence 'name' is in 'sequences'. */
}
/* Return TRUE if the sequence 'name' is in 'sequences'. */
seq_in_list(char *name, char *sequences[])
{
int i;
seq_in_list(char *name, char *sequences[])
{
int i;
crawl_callback(char *folder, void *baton)
{
check_folder(folder, strlen(folder), baton);
crawl_callback(char *folder, void *baton)
{
check_folder(folder, strlen(folder), baton);