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

Annotation of /imapfilter/imapfilter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.16 - (hide annotations)
Mon Oct 8 08:52:49 2001 UTC (22 years, 5 months ago) by lefcha
Branch: MAIN
CVS Tags: release-0_6_2
Branch point for: release-0_6_2-patches
Changes since 1.15: +27 -11 lines
File MIME type: text/plain
Fixes and improvements on IMAP4rev1 compliance.

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26