remove selective download
[claws.git] / src / pop.h
index 0d8e93069803d7b4dd500f66f85963910c37cbe8..460b52c72a889b69df2bd5c735f4dd173aa3b381 100644 (file)
--- a/src/pop.h
+++ b/src/pop.h
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2003 Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #ifndef __POP_H__
 #define __POP_H__
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include <glib.h>
+#include <time.h>
+
+#include "session.h"
+#include "prefs_account.h"
+
+typedef struct _Pop3MsgInfo    Pop3MsgInfo;
+typedef struct _Pop3Session    Pop3Session;
 
-#include "socket.h"
+#define POP3_SESSION(obj)      ((Pop3Session *)obj)
 
 typedef enum {
-       POP3_GREETING_RECV,
-       POP3_GETAUTH_USER_SEND,
-       POP3_GETAUTH_USER_RECV,
-       POP3_GETAUTH_PASS_SEND,
-       POP3_GETAUTH_PASS_RECV,
-       POP3_GETAUTH_APOP_SEND,
-       POP3_GETAUTH_APOP_RECV,
-       POP3_GETRANGE_STAT_SEND,
-       POP3_GETRANGE_STAT_RECV,
-       POP3_GETRANGE_LAST_SEND,
-       POP3_GETRANGE_LAST_RECV,
-       POP3_GETRANGE_UIDL_SEND,
+       POP3_READY,
+       POP3_GREETING,
+#if USE_OPENSSL
+       POP3_STLS,
+#endif
+       POP3_GETAUTH_USER,
+       POP3_GETAUTH_PASS,
+       POP3_GETAUTH_APOP,
+       POP3_GETRANGE_STAT,
+       POP3_GETRANGE_LAST,
+       POP3_GETRANGE_UIDL,
        POP3_GETRANGE_UIDL_RECV,
-       POP3_GETSIZE_LIST_SEND,
+       POP3_GETSIZE_LIST,
        POP3_GETSIZE_LIST_RECV,
-       POP3_TOP_SEND,                   
-       POP3_TOP_RECV,                    
-       POP3_RETR_SEND,
+       POP3_RETR,
        POP3_RETR_RECV,
-       POP3_DELETE_SEND,
-       POP3_DELETE_RECV,
-       POP3_LOGOUT_SEND,
-       POP3_LOGOUT_RECV,
+       POP3_DELETE,
+       POP3_LOGOUT,
+       POP3_ERROR,
+
+       N_POP3_STATE
+} Pop3State;
+
+typedef enum {
+       RECV_TIME_NONE     = 0,
+       RECV_TIME_RECEIVED = 1,
+       RECV_TIME_KEEP     = 2
+} RecvTime;
+
+struct _Pop3MsgInfo
+{
+       gint size;
+       gchar *uidl;
+       time_t recv_time;
+       guint received : 1;
+       guint deleted  : 1;
+};
+
+struct _Pop3Session
+{
+       Session session;
+
+       Pop3State state;
+       gchar *prev_folder;
 
-       N_POP3_PHASE
-} Pop3Phase;
+       PrefsAccount *ac_prefs;
+
+       gchar *greeting;
+       gchar *user;
+       gchar *pass;
+       gint count;
+       gint total_bytes;
+       gint cur_msg;
+       gint cur_total_num;
+       gint cur_total_bytes;
+       gint cur_total_recv_bytes;
+
+       Pop3MsgInfo *msg;
+
+       GHashTable *uidl_table;
+
+       gboolean new_msg_exist;
+       gboolean uidl_is_valid;
+
+       time_t current_time;
+
+       gint error_val;
+
+       gpointer data;
+};
 
-#define MAX_HEADER_LEN  5000
 #define POPBUFSIZE     512
 #define IDLEN          128
 
@@ -78,28 +132,10 @@ typedef enum {
 #define                PS_RETAINED     26      /* message retained (internal use) */
 #define                PS_TRUNCATED    27      /* headers incomplete (internal use) */
 
-gint pop3_greeting_recv                (SockInfo *sock, gpointer data);
-gint pop3_getauth_user_send    (SockInfo *sock, gpointer data);
-gint pop3_getauth_user_recv    (SockInfo *sock, gpointer data);
-gint pop3_getauth_pass_send    (SockInfo *sock, gpointer data);
-gint pop3_getauth_pass_recv    (SockInfo *sock, gpointer data);
-gint pop3_getauth_apop_send    (SockInfo *sock, gpointer data);
-gint pop3_getauth_apop_recv    (SockInfo *sock, gpointer data);
-gint pop3_getrange_stat_send   (SockInfo *sock, gpointer data);
-gint pop3_getrange_stat_recv   (SockInfo *sock, gpointer data);
-gint pop3_getrange_last_send   (SockInfo *sock, gpointer data);
-gint pop3_getrange_last_recv   (SockInfo *sock, gpointer data);
-gint pop3_getrange_uidl_send   (SockInfo *sock, gpointer data);
-gint pop3_getrange_uidl_recv   (SockInfo *sock, gpointer data);
-gint pop3_getsize_list_send    (SockInfo *sock, gpointer data);
-gint pop3_getsize_list_recv    (SockInfo *sock, gpointer data);
-gint pop3_top_send              (SockInfo *sock, gpointer data);
-gint pop3_top_recv              (SockInfo *sock, gpointer data);
-gint pop3_retr_send            (SockInfo *sock, gpointer data);
-gint pop3_retr_recv            (SockInfo *sock, gpointer data);
-gint pop3_delete_send          (SockInfo *sock, gpointer data);
-gint pop3_delete_recv          (SockInfo *sock, gpointer data);
-gint pop3_logout_send          (SockInfo *sock, gpointer data);
-gint pop3_logout_recv          (SockInfo *sock, gpointer data);
+#define                PS_CONTINUE     128
+
+Session *pop3_session_new      (PrefsAccount   *account);
+GHashTable *pop3_get_uidl_table        (PrefsAccount   *account);
+gint pop3_write_uidl_list      (Pop3Session    *session);
 
 #endif /* __POP_H__ */