-
Notifications
You must be signed in to change notification settings - Fork 0
/
xoauth2.h
49 lines (38 loc) · 820 Bytes
/
xoauth2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* SPDX-License-Identifier: GPL-3.0-or-later */
/*
* Copyright (C) 2019-2022 Junjiro R. Okajima
*/
#ifndef __XOAUTH2_H__
#define __XOAUTH2_H__
#include <stddef.h>
#include "debug.h"
#include "xoauth2-client.h"
#include "pop3.h"
/* status */
#define XOAUTH2_YET 1
#define XOAUTH2_DONE (1 << 1)
#define XOAUTH2_SKIP (1 << 2)
#define XOAUTH2_PASSED (1 << 3)
enum proto {
SMTP,
POP3
/* will be added more */
};
struct xoauth2_arg {
int wfd, rfd;
char *cmd;
char *user;
};
struct g {
struct xoauth2_arg arg;
char cmd[16], user[64], res[256];
enum proto proto;
};
/* xoauth2.c */
extern struct g g;
int xoauth2(char *buf, unsigned int *status);
/* rtoken.c */
int refresh_token(char *user, char *rbuf, size_t rsz);
/* gmail.c */
int gmail_xoauth2(struct xoauth2_arg *arg, char *rbuf, size_t rsz);
#endif