imap4d.h
4.38 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2001 Free Software Foundation, Inc.
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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _IMAP4D_H
#define _IMAP4D_H 1
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define _GNU_SOURCE
#ifdef HAVE_SHADOW_H
#include <shadow.h>
#endif
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <syslog.h>
#include <pwd.h>
#include <grp.h>
#include <stdarg.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <mailutils/mailbox.h>
#include <mailutils/message.h>
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/address.h>
#include <mailutils/registrar.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __P
# ifdef __STDC__
# define __P(args) args
# else
# define __P(args) ()
# endif
#endif /*__P */
struct imap4d_command
{
const char *name;
int (*func) __P ((struct imap4d_command *, char *));
int states;
int success;
int failure;
char *tag;
};
/* Global variables and constants*/
#define STATE_NONE (1 << 0)
#define STATE_NONAUTH (1 << 1)
#define STATE_AUTH (1 << 2)
#define STATE_SEL (1 << 3)
#define STATE_LOGOUT (1 << 4)
#define STATE_ALL (STATE_NONE | STATE_NONAUTH | STATE_AUTH | STATE_SEL \
| STATE_LOGOUT)
#define RESP_OK 0
#define RESP_BAD 1
#define RESP_NO 2
#define RESP_BYE 3
#define RESP_NONE 4
extern struct imap4d_command imap4d_command_table[];
extern FILE *ofile;
extern unsigned int timeout;
extern mailbox_t mbox;
extern unsigned int state;
/* Imap4 commands */
int imap4d_capability __P ((struct imap4d_command *, char *));
int imap4d_noop __P ((struct imap4d_command *, char *));
int imap4d_logout __P ((struct imap4d_command *, char *));
int imap4d_authenticate __P ((struct imap4d_command *, char *));
int imap4d_login __P ((struct imap4d_command *, char *));
int imap4d_select __P ((struct imap4d_command *, char *));
int imap4d_select0 __P ((struct imap4d_command *, char *, int));
int imap4d_examine __P ((struct imap4d_command *, char *));
int imap4d_create __P ((struct imap4d_command *, char *));
int imap4d_delete __P ((struct imap4d_command *, char *));
int imap4d_rename __P ((struct imap4d_command *, char *));
int imap4d_subscribe __P ((struct imap4d_command *, char *));
int imap4d_unsubscribe __P ((struct imap4d_command *, char *));
int imap4d_list __P ((struct imap4d_command *, char *));
int imap4d_lsub __P ((struct imap4d_command *, char *));
int imap4d_status __P ((struct imap4d_command *, char *));
int imap4d_append __P ((struct imap4d_command *, char *));
int imap4d_check __P ((struct imap4d_command *, char *));
int imap4d_close __P ((struct imap4d_command *, char *));
int imap4d_expunge __P ((struct imap4d_command *, char *));
int imap4d_search __P ((struct imap4d_command *, char *));
int imap4d_fetch __P ((struct imap4d_command *, char *));
int imap4d_store __P ((struct imap4d_command *, char *));
int imap4d_copy __P ((struct imap4d_command *, char *));
int imap4d_uid __P ((struct imap4d_command *, char *));
/* Helper functions. */
int util_out __P ((int rc, const char *f, ...));
int util_send __P ((const char *f, ...));
int util_start __P ((char *tag));
int util_finish __P ((struct imap4d_command *, int sc, const char *f, ...));
int util_getstate __P ((void));
int util_do_command __P ((char *prompt));
char *imap4d_readline __P ((int fd));
void util_quit __P ((int));
char *util_getword __P ((char *s, char **save_ptr));
int util_token __P ((char *s, size_t, char **save_ptr));
int util_msgset __P ((char *s, int **set, int *n, int isuid));
int util_upper __P ((char *));
struct imap4d_command *util_getcommand __P ((char *cmd,
struct imap4d_command []));
#ifdef __cplusplus
}
#endif
#endif /* _IMAP4D_H */