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

Annotation of /imapfilter/imapfilter.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations)
Tue Oct 2 07:31:52 2001 UTC (22 years, 6 months ago) by lefcha
Branch: MAIN
Changes since 1.12: +9 -6 lines
File MIME type: text/plain
Added safer xmalloc and xstrdup.

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26