1ee99e04e26c1276c131a43924ce72d831af777a
[claws.git] / src / inc.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 __INC_H__
21 #define __INC_H__
22
23 #ifdef HAVE_CONFIG_H
24 #  include "config.h"
25 #endif
26
27 #include <glib.h>
28 #include <time.h>
29
30 #include "mainwindow.h"
31 #include "progressdialog.h"
32 #include "prefs_account.h"
33 #include "pop.h"
34 #include "automaton.h"
35 #include "socket.h"
36
37 typedef struct _IncProgressDialog       IncProgressDialog;
38 typedef struct _IncSession              IncSession;
39 typedef struct _Pop3State               Pop3State;
40
41 typedef enum
42 {
43         INC_SUCCESS,
44         INC_CONNECT_ERROR,
45         INC_AUTH_FAILED,
46         INC_ERROR,
47         INC_NOSPACE,
48         INC_CANCEL
49 } IncState;
50
51 struct _IncProgressDialog
52 {
53         ProgressDialog *dialog;
54
55         MainWindow *mainwin;
56
57         gboolean show_dialog;
58
59         GList *queue_list;      /* list of IncSession */
60 };
61
62 struct _IncSession
63 {
64         Pop3State *pop3_state;
65         Automaton *atm;
66
67         gpointer data;
68 };
69
70 struct _Pop3State
71 {
72         gboolean cancelled;
73         PrefsAccount *ac_prefs;
74         GHashTable *folder_table;
75
76         gchar *prev_folder;
77
78         SockInfo *sockinfo;
79
80         gchar *greeting;
81         gchar *user;
82         gchar *pass;
83         gint count;
84         gint new;
85         gint total_bytes;
86         gint cur_msg;
87         gint cur_total_num;
88         gint cur_total_bytes;
89         gint cur_total_recv_bytes;
90
91         Pop3MsgInfo *msg;
92
93         GHashTable *uidl_table;
94         GSList *uidl_todelete_list;
95         
96         gboolean uidl_is_valid;
97
98         time_t current_time;
99
100         gint error_val;
101         IncState inc_state;
102
103         IncSession *session;
104 };
105
106 #define TIMEOUT_ITV     200
107
108 void inc_mail                   (MainWindow     *mainwin,
109                                  gboolean notify);
110 void inc_all_account_mail       (MainWindow     *mainwin,
111                                  gboolean notify);
112 void inc_selective_download     (MainWindow     *mainwin, 
113                                  PrefsAccount *acc,
114                                  gint         session);
115 void inc_progress_update        (Pop3State      *state,
116                                  Pop3Phase       phase);
117 gint inc_drop_message           (const gchar    *file,
118                                  Pop3State      *state);
119
120 gboolean inc_is_active          (void);
121
122 void inc_cancel_all             (void);
123
124 void inc_lock                   (void);
125 void inc_unlock                 (void);
126
127 void inc_autocheck_timer_init   (MainWindow     *mainwin);
128 void inc_autocheck_timer_set    (void);
129 void inc_autocheck_timer_remove (void);
130
131 #endif /* __INC_H__ */