/[imapfilter]/imapfilter/imapfilter.h
ViewVC logotype

Annotation of /imapfilter/imapfilter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (hide annotations)
Fri Nov 9 15:52:52 2001 UTC (22 years, 5 months ago) by lefcha
Branch: MAIN
Changes since 1.20: +1 -1 lines
File MIME type: text/plain
Just indented to K&R style.

1 lefcha 1.9 #ifndef IMAPFILTER_H
2     #define IMAPFILTER_H
3    
4     #include <stdio.h>
5    
6     #ifndef DATA_H
7     #include "data.h"
8     #endif
9    
10 lefcha 1.11 /* Error codes returned by functions. */
11     #define ERROR_TRIVIAL 1
12     #define ERROR_FILE_OPEN 2
13     #define ERROR_CONFIG_PARSE 3
14     #define ERROR_MEMORY_ALLOCATION 4
15     #define ERROR_NETWORK 5
16 lefcha 1.17 #define ERROR_SSL 6
17     #define ERROR_UNDEFINED 7
18 lefcha 1.9
19     /* Flags that control the program's options. */
20 lefcha 1.16 #define OPTION_DETAILS_QUIET 0x01
21 lefcha 1.9 #define OPTION_DETAILS_NORMAL 0x02
22     #define OPTION_DETAILS_VERBOSE 0x04
23     #define OPTION_DETAILS_CLEAR 0xf8
24 lefcha 1.14 #define OPTION_HEADERS 0x08
25 lefcha 1.9
26 lefcha 1.12 /* Flags for logger. */
27     #define LOG_WRITE 0
28     #define LOG_SERVER 1
29     #define LOG_USERNAME 2
30     #define LOG_MAILBOX 3
31     #define LOG_FILTER 4
32     #define LOG_ACTION 5
33     #define LOG_DESTINATION_MAILBOX 6
34    
35 lefcha 1.17 /* Buffer size of the IMAP command. */
36 lefcha 1.9 #define SMALL_CMD 64
37     #define MEDIUM_CMD 256
38     #define BIG_CMD 8192
39    
40     /* Buffer size of server's response. */
41 lefcha 1.21 #define RESPONSE_BUF (4096 + 1)
42 lefcha 1.20 #define RESULT_BUF 512
43 lefcha 1.9
44 lefcha 1.16 /* Response codes. */
45     #define RESPONSE_BAD -1
46     #define RESPONSE_OK 0
47     #define RESPONSE_NO 1
48     #define RESPONSE_BYE 2
49 lefcha 1.20 #define RESPONSE_PREAUTH 3
50     #define RESPONSE_READONLY 4
51     #define RESPONSE_TRYCREATE 5
52 lefcha 1.16
53 lefcha 1.9 /* Buffer size of message's headers. */
54 lefcha 1.19 #define HEADERS_BUF 16384
55 lefcha 1.9
56 lefcha 1.1
57     #define min(A, B) ((A) < (B) ? (A) : (B))
58 lefcha 1.15 #define plural(A) ((A) == 1 ? "" : "s")
59 lefcha 1.1
60    
61 lefcha 1.17 /* socket.c */
62     #ifndef SSL_TLS
63 lefcha 1.9 int init_connection(char *serv, unsigned int port);
64 lefcha 1.17 #else
65     int init_connection(char *serv, unsigned int port, unsigned int protocol);
66     #endif
67     int ssl_init(unsigned int protocol);
68 lefcha 1.9 int close_connection(void);
69 lefcha 1.17 int socket_read(char *buf);
70     int socket_write(char *data);
71 lefcha 1.9
72     /* file.c */
73     int read_config(char *cfg);
74     #ifdef CHECK_PERMISSIONS
75     int check_permissions(char *cfg);
76     #endif
77     int parse_config(FILE * fp);
78 lefcha 1.10 void set_options(char *line, regmatch_t * match);
79 lefcha 1.1
80 lefcha 1.9 /* imapfilter.c */
81     void usage(void);
82 lefcha 1.1
83 lefcha 1.9 /* imap.c */
84 lefcha 1.16 unsigned int send_command(char *cmd);
85 lefcha 1.9 #ifdef DEBUG
86     int imap_noop(void);
87     #endif
88 lefcha 1.16 int imap_capability(void);
89 lefcha 1.9 int imap_logout(void);
90     int imap_login(char *user, char *pass);
91 lefcha 1.16 /* int imap_examine(char *mbox); */
92 lefcha 1.9 int imap_select(char *mbox);
93     int imap_status(char *mbox, char *items);
94     int imap_create(char *mbox);
95     int imap_search(char *search);
96 lefcha 1.16 int imap_fetch(char *mesg, char *headers, int peek);
97 lefcha 1.9 int imap_store(char *mesg, char *flags);
98     int imap_copy(char *mesg, char *mbox);
99     int imap_close(void);
100     int imap_expunge(void);
101    
102     /* log.c */
103 lefcha 1.13 void info(const char *info,...);
104     void verbose(const char *info,...);
105     void error(const char *errmsg,...);
106     void fatal(unsigned int errnum, const char *fatal,...);
107 lefcha 1.9 int open_logfile(void);
108     int create_logfile(void);
109     int close_logfile(void);
110 lefcha 1.12 void log_info(int flag, void *ptr);
111 lefcha 1.11 char *get_time(void);
112 lefcha 1.9
113 lefcha 1.13 /* memory.c */
114     void *xmalloc(size_t size);
115 lefcha 1.19 void *xrealloc(void *ptr, size_t size);
116 lefcha 1.13 char *xstrdup(const char *s);
117    
118 lefcha 1.16 /* misc.c */
119     char *strcasestr(const char *haystack, const char *needle);
120     char *ultostr(unsigned long int num, int base);
121 lefcha 1.20 char *xstrncpy(char *dest, char *src, size_t size);
122 lefcha 1.16
123 lefcha 1.9 /* request.c */
124     int test(void);
125 lefcha 1.16 int check_capabilities(void);
126 lefcha 1.9 int login(char *user, char *pass);
127     int select_mailbox(char *mbox);
128 lefcha 1.11 int mailbox_status(char *mbox);
129 lefcha 1.9 int close_mailbox(void);
130     int logout(void);
131    
132 lefcha 1.16 int apply_filters(filter_t ** filters);
133 lefcha 1.19 int match_filter(filter_t * filter, char **mesgs);
134 lefcha 1.9
135     void empty_fifo(mask_t ** mfifo);
136 lefcha 1.11 void queue_fifo(mask_t ** mfifo, mask_t * mask);
137     mask_t *dequeue_fifo(mask_t ** mfifo);
138 lefcha 1.9
139 lefcha 1.11 char *generate_filter_and(mask_t * mask, unsigned int masknum, unsigned int masklen);
140     char *generate_filter_or(mask_t * mask, unsigned int masknum, unsigned int masklen);
141 lefcha 1.9
142 lefcha 1.11 int apply_action(char *mesgs, unsigned int *type, char *destmbox, char *args);
143 lefcha 1.9 int action_delete(char *mesgs, char *args);
144 lefcha 1.11 int action_copy(char *mesgs, char *destmbox, char *args);
145     int action_move(char *mesgs, char *destmbox, char *args);
146     int action_list(char *mesgs, char *args);
147 lefcha 1.9
148     unsigned int convert_messages(char *mesgs);
149    
150 lefcha 1.11 /* response.c */
151 lefcha 1.20 void receive_response(char *buf);
152 lefcha 1.16 int server_response(unsigned int tag);
153     int greeting_response(void);
154     int capability_response(unsigned int tag);
155     int status_response(unsigned int tag);
156     int select_response(unsigned int tag);
157 lefcha 1.19 int search_response(unsigned int tag, char **mesgs);
158 lefcha 1.16 int fetch_response(unsigned int tag);
159     int copy_response(unsigned int tag);
160 lefcha 1.20 int analyze_response(char *buf);
161 lefcha 1.11
162 lefcha 1.13 #endif /* IMAPFILTER_H */

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26