#include <h/oauth.h>
#include <h/utils.h>
+#include "m_maildir.h"
static const struct mh_oauth_service_info SERVICES[] = {
/* https://developers.google.com/accounts/docs/OAuth2InstalledApp */
}
/* Update all service_info fields that are overridden in profile. */
-static boolean
+static bool
update_svc(mh_oauth_service_info *svc, const char *svc_name, char *errbuf,
size_t errbuflen)
{
if (svc->name == NULL) { \
snprintf(errbuf, errbuflen, "%s", #name " is missing"); \
errbuf[errbuflen - 1] = '\0'; \
- return FALSE; \
+ return false; \
}
update(scope);
update(client_id);
svc->display_name = svc->name;
}
- return TRUE;
+ return true;
}
-boolean
+bool
mh_oauth_get_service_info(const char *svc_name, mh_oauth_service_info *svcinfo,
char *errbuf, size_t errbuflen)
{
svcinfo->client_secret = svcinfo->auth_endpoint = NULL;
svcinfo->token_endpoint = svcinfo->redirect_uri = NULL;
- for (i = 0; i < (int) (sizeof SERVICES / sizeof SERVICES[0]); i++) {
+ for (i = 0; i < (int)DIM(SERVICES); i++) {
if (strcmp(SERVICES[i].name, svc_name) == 0) {
copy_svc(svcinfo, &SERVICES[i]);
break;
}
}
- if (!update_svc(svcinfo, svc_name, errbuf, errbuflen)) {
- return FALSE;
- }
-
- return TRUE;
+ return update_svc(svcinfo, svc_name, errbuf, errbuflen);
}
const char *