weather objects: convert to generic object payload
[monky] / src / mail.h
1 /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */
2
3 #ifndef _MAIL_H
4 #define _MAIL_H
5
6 #include "timed_thread.h"
7 #include <time.h>
8
9 /* forward declare to make gcc happy */
10 struct text_object;
11
12 extern char *current_mail_spool;
13
14 struct mail_s {                 // for imap and pop3
15         unsigned long unseen;
16         unsigned long messages;
17         unsigned long used;
18         unsigned long quota;
19         unsigned long port;
20         unsigned int retries;
21         float interval;
22         double last_update;
23         char host[128];
24         char user[128];
25         char pass[128];
26         char command[1024];
27         char folder[128];
28         timed_thread *p_timed_thread;
29         char secure;
30 };
31
32 struct local_mail_s {
33         char *mbox;
34         int mail_count;
35         int new_mail_count;
36         int seen_mail_count;
37         int unseen_mail_count;
38         int flagged_mail_count;
39         int unflagged_mail_count;
40         int forwarded_mail_count;
41         int unforwarded_mail_count;
42         int replied_mail_count;
43         int unreplied_mail_count;
44         int draft_mail_count;
45         int trashed_mail_count;
46         float interval;
47         time_t last_mtime;
48         double last_update;
49 };
50
51 void update_mail_count(struct local_mail_s *);
52
53 #define POP3_TYPE 1
54 #define IMAP_TYPE 2
55
56 void parse_local_mail_args(struct text_object *, const char *);
57
58 #define PRINT_MAILS_PROTO_GENERATOR(x) \
59 void print_##x##mails(struct text_object *, char *, int);
60
61 PRINT_MAILS_PROTO_GENERATOR()
62 PRINT_MAILS_PROTO_GENERATOR(new_)
63 PRINT_MAILS_PROTO_GENERATOR(seen_)
64 PRINT_MAILS_PROTO_GENERATOR(unseen_)
65 PRINT_MAILS_PROTO_GENERATOR(flagged_)
66 PRINT_MAILS_PROTO_GENERATOR(unflagged_)
67 PRINT_MAILS_PROTO_GENERATOR(forwarded_)
68 PRINT_MAILS_PROTO_GENERATOR(unforwarded_)
69 PRINT_MAILS_PROTO_GENERATOR(replied_)
70 PRINT_MAILS_PROTO_GENERATOR(unreplied_)
71 PRINT_MAILS_PROTO_GENERATOR(draft_)
72 PRINT_MAILS_PROTO_GENERATOR(trashed_)
73
74 /* FIXME: this is here for the config leftovers only */
75 struct mail_s *parse_mail_args(char, const char *);
76
77 void parse_imap_mail_args(struct text_object *, const char *);
78 void parse_pop3_mail_args(struct text_object *, const char *);
79 void free_mail_obj(struct text_object *);
80 void print_imap_unseen(struct text_object *, char *, int);
81 void print_imap_messages(struct text_object *, char *, int);
82 void print_pop3_unseen(struct text_object *, char *, int);
83 void print_pop3_used(struct text_object *, char *, int);
84
85 #endif /* _MAIL_H */