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
15 #include <sys/types.h>
16 #include <sys/socket.h>
17 #include <netinet/in.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"
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)
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 */
68 #define SCROLL_H 38 /* this is without SCROLL_EXT at each end */
71 #define TMPPREFIX "Pop3tmp"
72 #define TMPPREFIXLEN 7
73 #define TXT_MESSAGETOOBIG "From: %s\n\
76 The size of this email (%d) is above the configured maxdlsize value (%d) and\
79 #define TXT_ERROR "From: %s\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
97 char from
[MAIL_BUFLEN
];
98 char subject
[MAIL_BUFLEN
];
100 long cksum
; /* checksum of the header */
101 int new; /* mail is new */
105 struct sockaddr_in server
;
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 */
114 char mailseparator
[256];
123 int numOfUnreadMessages
;
125 int sizeOfAllMessages
;
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
);