wmcore: set DESTDIR so binary installs correctly.
[dockapps.git] / wmpop3lb / wmpop3 / Pop3Client.h
blobd5ad03953c9c5124ef570694fcf3e3ae2634b2ba
1 /* Author : Louis-Benoit JOURDAIN (lb@jourdain.org)
2 * based on the original work by Scott Holden ( scotth@thezone.net )
4 * multi Pop3 Email checker.
6 * Last Updated : Feb 7th, 2002
8 */
11 #ifndef POP3CLIENT
12 #define POP3CLIENT
14 #include <string.h>
15 #include <sys/types.h>
16 #include <sys/socket.h>
17 #include <netinet/in.h>
18 #include <netdb.h>
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <unistd.h>
22 #include <ctype.h>
23 #include <sys/poll.h>
25 #define MAIL_BUFLEN 64
26 #define CONF_BUFLEN 256
28 #define RSET_COLOR color = 0
29 #define SWAP_COLOR color = 1 - color
30 #define CH_COLOR(a) (color) ? a + 24 : a
32 #define WMPOP3_VERSION "2.4.2"
34 #define CHAR_WIDTH 5
35 #define CHAR_HEIGHT 5
36 #define TOP_MARGIN 5
37 #define LEFT_MARGIN 4
38 #define NUMBERS 93
39 #define LETTERS 85
40 #define SMALL_NUM 77
41 #define SN_CHAR_W 3
42 #define NB_DISP 8
43 #define EXTRA 1
44 #define NB_LINE 7
45 #define SEC_IN_MIN 60
46 #define YES 1
47 #define NO 0
48 #define SELECTONLY 1
49 #define NOSELECTONLY 0
51 /* get mail progress bar */
52 #define PROGRESSBAR_LEN 48
53 #define PROGRESSBAR_HEI 6
54 #define PROGRESSBAR_HPOS 10
55 #define PROGRESSBAR_VPOS ((6*6) + TOP_MARGIN)
57 #define ORIG_PB_TX 72
58 #define ORIG_PB_TY 65
60 #define ORIG_PB_BARX 73
61 #define ORIG_PB_BARY 71
63 #define SCROLL_LX 4 /* left X coordinate */
64 #define SCROLL_RX 6 /* right X coordinate */
65 #define SCROLL_TY 4 /* top Y coordinate */
66 #define SCROLL_BY 45 /* botton Y coordinate */
67 #define SCROLL_W 3
68 #define SCROLL_H 38 /* this is without SCROLL_EXT at each end */
69 #define SCROLL_EXT 2
71 #define TMPPREFIX "Pop3tmp"
72 #define TMPPREFIXLEN 7
73 #define TXT_MESSAGETOOBIG "From: %s\n\
74 Subject: %s\n\n\
76 The size of this email (%d) is above the configured maxdlsize value (%d) and\
77 was not downloaded\n"
79 #define TXT_ERROR "From: %s\n\
80 Subject: %s\n\n\
82 There was an error (%s) while getting this email from the server\n"
84 #define TXT_SEPARATOR "--------------------------------------------------------------------\n"
86 typedef struct s_scrollbar
88 int top;
89 int bottom;
90 int orig_y;
91 int orig_index_vert;
92 int allowedspace;
93 } t_scrollbar;
95 typedef struct s_mail
97 char from[MAIL_BUFLEN];
98 char subject[MAIL_BUFLEN];
99 char todelete;
100 long cksum; /* checksum of the header */
101 int new; /* mail is new */
102 } t_mail;
104 struct pop3_struct{
105 struct sockaddr_in server;
106 struct hostent *hp;
107 enum {CONNECTED, NOT_CONNECTED} connected;
108 char **mailclient; /* argv[] type of command */
109 char **newmailcommand; /* argv[] type of command */
110 char **selectedmesgcommand; /* argv[] type of command */
111 char username[256];
112 char popserver[128];
113 char password[256];
114 char mailseparator[256];
115 char inBuf[4096];
116 char outBuf[1024];
117 char alias[4];
118 char delstatus[9];
119 int s; /* socket */
120 int serverport;
121 int localPort;
122 int numOfMessages;
123 int numOfUnreadMessages;
124 int countunreadonly;
125 int sizeOfAllMessages;
126 int sizechanged;
127 int mailCheckDelay;
128 int forcedCheck;
129 int status;
130 int maxdlsize;
131 long nextCheckTime;
132 t_mail *mails;
134 typedef struct pop3_struct *Pop3;
137 Pop3 pop3Create(int nb_conf);
138 int pop3MakeConnection( Pop3 pc, char *serverName, int port);
139 int pop3IsConnected(Pop3 pc);
140 int pop3Login(Pop3 pc, char *name, char *pass);
141 int pop3Quit(Pop3 pc);
142 int pop3CheckMail(Pop3 pc);
143 int pop3GetTotalNumberOfMessages( Pop3 pc );
144 int pop3GetNumberOfUnreadMessages( Pop3 pc );
145 int pop3WriteOneMail(int nb, int dest_fd, Pop3 pc);
146 #endif