--- sylpheed/libsylph/news.c.alt-nntperr 2006-01-17 08:32:17 +0300 +++ sylpheed/libsylph/news.c 2006-05-21 21:30:27 +0400 @@ -267,7 +267,8 @@ static NNTPSession *news_session_get(Fol } if (time(NULL) - rfolder->session->last_access_time < - SESSION_TIMEOUT_INTERVAL) { + SESSION_TIMEOUT_INTERVAL + && !nntp_error(NNTP_SESSION(rfolder->session))) { return NNTP_SESSION(rfolder->session); } @@ -280,6 +281,8 @@ static NNTPSession *news_session_get(Fol folder->account->nntpport : NNTP_PORT); session_destroy(rfolder->session); rfolder->session = news_session_new_for_folder(folder); + } else { + nntp_reset_error(NNTP_SESSION(rfolder->session)); } if (rfolder->session) --- sylpheed/libsylph/nntp.c.alt-nntperr 2005-09-13 12:18:44 +0400 +++ sylpheed/libsylph/nntp.c 2006-05-21 21:30:27 +0400 @@ -399,33 +399,52 @@ static gint nntp_gen_command(NNTPSession ok = nntp_ok(sock, argbuf); if (ok == NN_AUTHREQ) { if (!session->userid || !session->passwd) { - session->auth_failed = TRUE; + session->auth_failed = session->error = TRUE; return ok; } ok = nntp_gen_send(sock, "AUTHINFO USER %s", session->userid); - if (ok != NN_SUCCESS) + if (ok != NN_SUCCESS) { + session->error = TRUE; return ok; + } ok = nntp_ok(sock, NULL); if (ok == NN_AUTHCONT) { ok = nntp_gen_send(sock, "AUTHINFO PASS %s", session->passwd); - if (ok != NN_SUCCESS) + if (ok != NN_SUCCESS) { + session->error = TRUE; return ok; + } ok = nntp_ok(sock, NULL); } if (ok != NN_SUCCESS) { - session->auth_failed = TRUE; + session->auth_failed = session->error = TRUE; return ok; } ok = nntp_gen_send(sock, "%s", buf); - if (ok != NN_SUCCESS) + if (ok != NN_SUCCESS) { + session->error = TRUE; return ok; + } ok = nntp_ok(sock, argbuf); } session_set_access_time(SESSION(session)); + if (ok != NN_SUCCESS) + session->error = TRUE; + return ok; } + +gboolean nntp_error(NNTPSession *session) +{ + return session->error; +} + +void nntp_reset_error(NNTPSession *session) +{ + session->error = FALSE; +} --- sylpheed/libsylph/nntp.h.alt-nntperr 2005-09-13 12:18:44 +0400 +++ sylpheed/libsylph/nntp.h 2006-05-21 21:30:27 +0400 @@ -37,6 +37,7 @@ struct _NNTPSession gchar *userid; gchar *passwd; + gboolean error; gboolean auth_failed; }; @@ -106,4 +107,7 @@ gint nntp_newnews (NNTPSession *session gint nntp_mode (NNTPSession *sessio, gboolean stream); +gboolean nntp_error (NNTPSession *sock); +void nntp_reset_error (NNTPSession *sock); + #endif /* __NNTP_H__ */