inc.h (2996B)
1 /* 2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client 3 * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team 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 3 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, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef __INC_H__ 21 #define __INC_H__ 22 23 #include <glib.h> 24 25 #include "mainwindow.h" 26 #include "gtk/progressdialog.h" 27 #include "prefs_account.h" 28 #include "session.h" 29 #include "pop.h" 30 31 typedef struct _IncProgressDialog IncProgressDialog; 32 typedef struct _IncSession IncSession; 33 34 typedef enum 35 { 36 INC_SUCCESS, 37 INC_CONNECT_ERROR, 38 INC_AUTH_FAILED, 39 INC_LOCKED, 40 INC_ERROR, 41 INC_NO_SPACE, 42 INC_IO_ERROR, 43 INC_SOCKET_ERROR, 44 INC_EOF, 45 INC_TIMEOUT, 46 INC_CANCEL 47 } IncState; 48 49 struct _IncProgressDialog 50 { 51 ProgressDialog *dialog; 52 53 MainWindow *mainwin; 54 55 gboolean show_dialog; 56 57 GDateTime *progress_tv; 58 GDateTime *folder_tv; 59 60 GList *queue_list; /* list of IncSession */ 61 gint cur_row; 62 }; 63 64 struct _IncSession 65 { 66 Session *session; 67 IncState inc_state; 68 69 gint cur_total_bytes; 70 71 gpointer data; 72 }; 73 74 #define TIMEOUT_ITV 200 75 76 void inc_mail (MainWindow *mainwin, 77 gboolean notify); 78 gint inc_account_mail (MainWindow *mainwin, 79 PrefsAccount *account); 80 81 /* This function just blindly checks all accounts in the passed 82 * account_list, and doesn't care about whether the configuration 83 * says they should be checked or not. These checks should be done 84 * by the caller, and account_list should look accordingly. 85 * The caller is responsible for freeing the list afterwards. */ 86 void inc_account_list_mail (MainWindow *mainwin, 87 GList *list, /* linked list of PrefsAccount* pointers */ 88 gboolean autocheck, 89 gboolean notify); 90 91 /* Starts mail incorporations for all accounts. */ 92 void inc_all_account_mail (MainWindow *mainwin, gboolean notify); 93 94 void inc_progress_update (Pop3Session *session); 95 96 void inc_pop_before_smtp (PrefsAccount *acc); 97 98 gboolean inc_is_active (void); 99 100 void inc_cancel_all (void); 101 102 extern guint inc_lock_count; 103 #define inc_lock() { \ 104 inc_lock_real(); \ 105 debug_print("called inc_lock (lock count %d)\n", inc_lock_count); \ 106 } 107 108 #define inc_unlock() { \ 109 inc_unlock_real(); \ 110 debug_print("called inc_unlock (lock count %d)\n", inc_lock_count); \ 111 } 112 113 void inc_lock_real (void); 114 void inc_unlock_real (void); 115 116 gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg); 117 118 void inc_reset_offline_override_timers(); 119 120 #endif /* __INC_H__ */