Added work offline availability.
[claws.git] / src / pop.h
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 Hiroyuki Yamamoto
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 #ifndef __POP_H__
21 #define __POP_H__
22
23 #include <glib.h>
24
25 #include "socket.h"
26
27 typedef struct _Pop3MsgInfo     Pop3MsgInfo;
28
29 typedef enum {
30         POP3_GREETING_RECV,
31         POP3_GETAUTH_USER_SEND,
32         POP3_GETAUTH_USER_RECV,
33         POP3_GETAUTH_PASS_SEND,
34         POP3_GETAUTH_PASS_RECV,
35         POP3_GETAUTH_APOP_SEND,
36         POP3_GETAUTH_APOP_RECV,
37         POP3_GETRANGE_STAT_SEND,
38         POP3_GETRANGE_STAT_RECV,
39         POP3_GETRANGE_LAST_SEND,
40         POP3_GETRANGE_LAST_RECV,
41         POP3_GETRANGE_UIDL_SEND,
42         POP3_GETRANGE_UIDL_RECV,
43         POP3_GETSIZE_LIST_SEND,
44         POP3_GETSIZE_LIST_RECV,
45         POP3_TOP_SEND,                   
46         POP3_TOP_RECV,                    
47         POP3_RETR_SEND,
48         POP3_RETR_RECV,
49         POP3_DELETE_SEND,
50         POP3_DELETE_RECV,
51         POP3_LOGOUT_SEND,
52         POP3_LOGOUT_RECV,
53
54         N_POP3_PHASE
55 } Pop3Phase;
56
57 struct _Pop3MsgInfo
58 {
59         gint size;
60         gchar *uidl;
61         guint received : 1;
62         guint deleted  : 1;
63 };
64
65 #define POPBUFSIZE      512
66 #define IDLEN           128
67
68 /* exit code values */
69 #define         PS_SUCCESS      0       /* successful receipt of messages */
70 #define         PS_NOMAIL       1       /* no mail available */
71 #define         PS_SOCKET       2       /* socket I/O woes */
72 #define         PS_AUTHFAIL     3       /* user authorization failed */
73 #define         PS_PROTOCOL     4       /* protocol violation */
74 #define         PS_SYNTAX       5       /* command-line syntax error */
75 #define         PS_IOERR        6       /* bad permissions on rc file */
76 #define         PS_ERROR        7       /* protocol error */
77 #define         PS_EXCLUDE      8       /* client-side exclusion error */
78 #define         PS_LOCKBUSY     9       /* server responded lock busy */
79 #define         PS_SMTP         10      /* SMTP error */
80 #define         PS_DNS          11      /* fatal DNS error */
81 #define         PS_BSMTP        12      /* output batch could not be opened */
82 #define         PS_MAXFETCH     13      /* poll ended by fetch limit */
83 /* leave space for more codes */
84 #define         PS_UNDEFINED    23      /* something I hadn't thought of */
85 #define         PS_TRANSIENT    24      /* transient failure (internal use) */
86 #define         PS_REFUSED      25      /* mail refused (internal use) */
87 #define         PS_RETAINED     26      /* message retained (internal use) */
88 #define         PS_TRUNCATED    27      /* headers incomplete (internal use) */
89
90 gint pop3_greeting_recv         (SockInfo *sock, gpointer data);
91 gint pop3_getauth_user_send     (SockInfo *sock, gpointer data);
92 gint pop3_getauth_user_recv     (SockInfo *sock, gpointer data);
93 gint pop3_getauth_pass_send     (SockInfo *sock, gpointer data);
94 gint pop3_getauth_pass_recv     (SockInfo *sock, gpointer data);
95 gint pop3_getauth_apop_send     (SockInfo *sock, gpointer data);
96 gint pop3_getauth_apop_recv     (SockInfo *sock, gpointer data);
97 gint pop3_getrange_stat_send    (SockInfo *sock, gpointer data);
98 gint pop3_getrange_stat_recv    (SockInfo *sock, gpointer data);
99 gint pop3_getrange_last_send    (SockInfo *sock, gpointer data);
100 gint pop3_getrange_last_recv    (SockInfo *sock, gpointer data);
101 gint pop3_getrange_uidl_send    (SockInfo *sock, gpointer data);
102 gint pop3_getrange_uidl_recv    (SockInfo *sock, gpointer data);
103 gint pop3_getsize_list_send     (SockInfo *sock, gpointer data);
104 gint pop3_getsize_list_recv     (SockInfo *sock, gpointer data);
105 gint pop3_top_send              (SockInfo *sock, gpointer data);
106 gint pop3_top_recv              (SockInfo *sock, gpointer data);
107 gint pop3_retr_send             (SockInfo *sock, gpointer data);
108 gint pop3_retr_recv             (SockInfo *sock, gpointer data);
109 gint pop3_delete_send           (SockInfo *sock, gpointer data);
110 gint pop3_delete_recv           (SockInfo *sock, gpointer data);
111 gint pop3_logout_send           (SockInfo *sock, gpointer data);
112 gint pop3_logout_recv           (SockInfo *sock, gpointer data);
113
114 #endif /* __POP_H__ */