From: Paul Mangan Date: Fri, 28 Mar 2003 07:46:00 +0000 (+0000) Subject: sync with 0.8.11cvs15 X-Git-Tag: rel_0_9_0~151 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=40e1a89611c15a25de29564abaaa4e1a3f6fe0a9 sync with 0.8.11cvs15 --- diff --git a/ChangeLog b/ChangeLog index a85e30a1d..ee7c4f1ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-03-28 + + * src/pop.h: changed error value to enum. + * src/pop.c: pop3_retr_recv(): return PS_IOERR when inc_drop_message() + failed. + pop3_ok(): return appropriate error value based on current state. + Output warning to log if error occurs. + 2003-03-27 * src/nntp.[ch] diff --git a/ChangeLog.claws b/ChangeLog.claws index 50c676f1a..6da45f5e9 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,8 @@ +2003-03-28 [paul] 0.8.11claws61 + + * sync with 0.8.11cvs15 + see ChangeLog 2003-03-28 + 2003-03-27 [christoph] 0.8.11claws60 * src/folder.c diff --git a/ChangeLog.jp b/ChangeLog.jp index bd62fa816..9d5860916 100644 --- a/ChangeLog.jp +++ b/ChangeLog.jp @@ -1,3 +1,11 @@ +2003-03-28 + + * src/pop.h: ¥¨¥é¡¼Ãͤò enum ¤ËÊѹ¹¡£ + * src/pop.c: pop3_retr_recv(): inc_drop_message() ¤¬¼ºÇÔ¤·¤¿¤é + PS_IOERR ¤òÊÖ¤¹¤è¤¦¤Ë¤·¤¿¡£ + pop3_ok(): ¸½ºß¤Î¾õÂ֤˴ð¤Å¤¤¤ÆŬÀڤʥ¨¥é¡¼ÃͤòÊÖ¤¹¤è¤¦¤Ë¤·¤¿¡£ + ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï·Ù¹ð¤ò¥í¥°¤Ë½ÐÎϤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£ + 2003-03-27 * src/nntp.[ch] diff --git a/configure.ac b/configure.ac index f659c28a5..d8ae8632e 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=11 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws60 +EXTRA_VERSION=claws61 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/pop.c b/src/pop.c index 2b5634223..ef738a70a 100644 --- a/src/pop.c +++ b/src/pop.c @@ -79,7 +79,7 @@ static gint pop3_write_msg_to_file (const gchar *file, guint len); static Pop3State pop3_lookup_next (Pop3Session *session); -static gint pop3_ok (Pop3Session *session, +static Pop3ErrorValue pop3_ok (Pop3Session *session, const gchar *msg); static gint pop3_session_recv_msg (Session *session, @@ -229,7 +229,6 @@ static gint pop3_getrange_uidl_recv(Pop3Session *session, const gchar *msg) gchar id[IDLEN + 1]; gint num; time_t recv_time; - gint next_state; if (msg[0] == '.') { session->uidl_is_valid = TRUE; @@ -301,7 +300,6 @@ static gint pop3_retr_recv(Pop3Session *session, const gchar *data, guint len) { gchar *file; gint drop_ok; - gint next_state; file = get_tmp_file(); if (pop3_write_msg_to_file(file, data, len) < 0) { @@ -314,7 +312,7 @@ static gint pop3_retr_recv(Pop3Session *session, const gchar *data, guint len) drop_ok = inc_drop_message(file, session); g_free(file); if (drop_ok < 0) { - session->error_val = PS_ERROR; + session->error_val = PS_IOERR; return -1; } @@ -615,9 +613,11 @@ static Pop3State pop3_lookup_next(Pop3Session *session) return POP3_RETR; } -static gint pop3_ok(Pop3Session *session, const gchar *msg) +static Pop3ErrorValue pop3_ok(Pop3Session *session, const gchar *msg) { - gint ok; + Pop3ErrorValue ok; + + log_print("POP3< %s\n", msg); if (!strncmp(msg, "+OK", 3)) ok = PS_SUCCESS; @@ -625,32 +625,49 @@ static gint pop3_ok(Pop3Session *session, const gchar *msg) if (strstr(msg + 4, "lock") || strstr(msg + 4, "Lock") || strstr(msg + 4, "LOCK") || - strstr(msg + 4, "wait")) + strstr(msg + 4, "wait")) { + log_warning(_("mailbox is locked\n")); ok = PS_LOCKBUSY; - else - ok = PS_PROTOCOL; + } else { + switch (session->state) { +#if USE_OPENSSL + case POP3_STLS: + log_warning(_("can't start TLS session\n")); + ok = PS_ERROR; + break; +#endif + case POP3_GETAUTH_USER: + case POP3_GETAUTH_PASS: + case POP3_GETAUTH_APOP: + log_warning(_("error occurred on authentication\n")); + ok = PS_AUTHFAIL; + break; + default: + log_warning(_("error occured on POP3 session\n")); + ok = PS_ERROR; + } + } fprintf(stderr, "POP3: %s\n", msg); } else ok = PS_PROTOCOL; + session->error_val = ok; return ok; } static gint pop3_session_recv_msg(Session *session, const gchar *msg) { Pop3Session *pop3_session = POP3_SESSION(session); - gint val; + Pop3ErrorValue val; const gchar *body; body = msg; if (pop3_session->state != POP3_GETRANGE_UIDL_RECV && pop3_session->state != POP3_GETSIZE_LIST_RECV) { - log_print("POP3< %s\n", msg); val = pop3_ok(pop3_session, msg); if (val != PS_SUCCESS) { pop3_session->state = POP3_ERROR; - pop3_session->error_val = val; return -1; } diff --git a/src/pop.h b/src/pop.h index 460b52c72..3cc15a3d3 100644 --- a/src/pop.h +++ b/src/pop.h @@ -59,6 +59,33 @@ typedef enum { N_POP3_STATE } Pop3State; +typedef enum { + PS_SUCCESS = 0, /* command successful */ + PS_NOMAIL = 1, /* no mail available */ + PS_SOCKET = 2, /* socket I/O woes */ + PS_AUTHFAIL = 3, /* user authorization failed */ + PS_PROTOCOL = 4, /* protocol violation */ + PS_SYNTAX = 5, /* command-line syntax error */ + PS_IOERR = 6, /* file I/O error */ + PS_ERROR = 7, /* protocol error */ + PS_EXCLUDE = 8, /* client-side exclusion error */ + PS_LOCKBUSY = 9, /* server responded lock busy */ + PS_SMTP = 10, /* SMTP error */ + PS_DNS = 11, /* fatal DNS error */ + PS_BSMTP = 12, /* output batch could not be opened */ + PS_MAXFETCH = 13, /* poll ended by fetch limit */ + + /* leave space for more codes */ + + PS_UNDEFINED = 23, /* something I hadn't thought of */ + PS_TRANSIENT = 24, /* transient failure (internal use) */ + PS_REFUSED = 25, /* mail refused (internal use) */ + PS_RETAINED = 26, /* message retained (internal use) */ + PS_TRUNCATED = 27, /* headers incomplete (internal use) */ + + PS_CONTINUE = 128 /* more responses may follow */ +} Pop3ErrorValue; + typedef enum { RECV_TIME_NONE = 0, RECV_TIME_RECEIVED = 1, @@ -102,7 +129,7 @@ struct _Pop3Session time_t current_time; - gint error_val; + Pop3ErrorValue error_val; gpointer data; }; @@ -110,29 +137,6 @@ struct _Pop3Session #define POPBUFSIZE 512 #define IDLEN 128 -/* exit code values */ -#define PS_SUCCESS 0 /* successful receipt of messages */ -#define PS_NOMAIL 1 /* no mail available */ -#define PS_SOCKET 2 /* socket I/O woes */ -#define PS_AUTHFAIL 3 /* user authorization failed */ -#define PS_PROTOCOL 4 /* protocol violation */ -#define PS_SYNTAX 5 /* command-line syntax error */ -#define PS_IOERR 6 /* bad permissions on rc file */ -#define PS_ERROR 7 /* protocol error */ -#define PS_EXCLUDE 8 /* client-side exclusion error */ -#define PS_LOCKBUSY 9 /* server responded lock busy */ -#define PS_SMTP 10 /* SMTP error */ -#define PS_DNS 11 /* fatal DNS error */ -#define PS_BSMTP 12 /* output batch could not be opened */ -#define PS_MAXFETCH 13 /* poll ended by fetch limit */ -/* leave space for more codes */ -#define PS_UNDEFINED 23 /* something I hadn't thought of */ -#define PS_TRANSIENT 24 /* transient failure (internal use) */ -#define PS_REFUSED 25 /* mail refused (internal use) */ -#define PS_RETAINED 26 /* message retained (internal use) */ -#define PS_TRUNCATED 27 /* headers incomplete (internal use) */ - -#define PS_CONTINUE 128 Session *pop3_session_new (PrefsAccount *account); GHashTable *pop3_get_uidl_table (PrefsAccount *account);