aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-04-03 07:04:11 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-04-03 07:04:11 +0800
commitbe23d106da1c548762218892fe058aee1fb9e36c (patch)
treed5a0954a4a35e69ac6121fdbd030ec99b8fbb761 /camel
parent22fe7e4d3a6ed76ea055f7df3b49a37be777cb05 (diff)
downloadgsoc2013-evolution-be23d106da1c548762218892fe058aee1fb9e36c.tar.gz
gsoc2013-evolution-be23d106da1c548762218892fe058aee1fb9e36c.tar.zst
gsoc2013-evolution-be23d106da1c548762218892fe058aee1fb9e36c.zip
Handle a ton more nspr i/o errno's. (stream_connect): Act as if we are
2002-04-02 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-ssl.c (set_errno): Handle a ton more nspr i/o errno's. (stream_connect): Act as if we are doing a non-blocking connect. This is to try and work around bug #15120 where users get an EINPROGRESS error. Maybe importing a PRFileDesc into SSL mode automagically makes it non-blocking? I dunno. 2002-04-01 Jeffrey Stedfast <fejj@ximian.com> * camel-folder-summary.c (message_info_new): Updated the construction of the references to match JWZ's updated algorithm initialization (ie, append any In-Reply-To reference onto any References header and never take more than a single message-id from the In-Reply-To header since anything after the first will probably just be email addresses). Fixes bug #1336. svn path=/trunk/; revision=16327
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog18
-rw-r--r--camel/camel-folder-summary.c39
-rw-r--r--camel/camel-tcp-stream-ssl.c63
3 files changed, 109 insertions, 11 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 8c1a6cdc07..96b013de75 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,21 @@
+2002-04-02 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-tcp-stream-ssl.c (set_errno): Handle a ton more nspr i/o
+ errno's.
+ (stream_connect): Act as if we are doing a non-blocking
+ connect. This is to try and work around bug #15120 where users get
+ an EINPROGRESS error. Maybe importing a PRFileDesc into SSL mode
+ automagically makes it non-blocking? I dunno.
+
+2002-04-01 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-folder-summary.c (message_info_new): Updated the
+ construction of the references to match JWZ's updated algorithm
+ initialization (ie, append any In-Reply-To reference onto any
+ References header and never take more than a single message-id
+ from the In-Reply-To header since anything after the first will
+ probably just be email addresses). Fixes bug #1336.
+
2002-04-03 Not Zed <NotZed@Ximian.com>
* camel-text-index.c (text_index_sync): Sync the key tables
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index c681ff6123..6aa37010a6 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -1522,7 +1522,7 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
CamelMessageInfo *mi;
const char *received;
guchar digest[16];
- struct _header_references *refs, *scan;
+ struct _header_references *refs, *irt, *scan;
char *msgid;
int count;
char *subject, *from, *to, *cc, *mlist;
@@ -1585,10 +1585,39 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
memcpy(mi->message_id.id.hash, digest, sizeof(mi->message_id.id.hash));
g_free(msgid);
}
- /* if we have a references, use that, otherwise, see if we have an in-reply-to
- header, with parsable content, otherwise *shrug* */
- if ((refs = header_references_decode(header_raw_find(&h, "references", NULL))) != NULL
- || (refs = header_references_decode(header_raw_find(&h, "in-reply-to", NULL))) != NULL) {
+
+ /* decode our references and in-reply-to headers */
+ refs = header_references_decode (header_raw_find (&h, "references", NULL));
+ irt = header_references_decode (header_raw_find (&h, "in-reply-to", NULL));
+ if (refs || irt) {
+ if (irt) {
+ struct _header_references *n, *r = irt;
+
+ /* If there are multiple things in In-Reply-To that look like Message-IDs,
+ only use the first one of them: odds are that the later ones are actually
+ email addresses, not IDs. */
+
+ /* since header_references_decode() returns the list in reverse order,
+ free all but the last In-Reply-To message-id */
+ while (r->next) {
+ n = r->next;
+ g_free (r->id);
+ g_free (r);
+ r = n;
+ }
+
+ irt = r;
+
+ /* The References field is populated from the ``References'' and/or ``In-Reply-To''
+ headers. If both headers exist, take the first thing in the In-Reply-To header
+ that looks like a Message-ID, and append it to the References header. */
+
+ if (refs)
+ irt->next = refs;
+
+ refs = irt;
+ }
+
count = header_references_list_size(&refs);
mi->references = g_malloc(sizeof(*mi->references) + ((count-1) * sizeof(mi->references->references[0])));
count = 0;
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index f44f87dc36..29d9fd7bcc 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -205,6 +205,9 @@ set_errno (int code)
{
/* FIXME: this should handle more. */
switch (code) {
+ case PR_INVALID_ARGUMENT_ERROR:
+ errno = EINVAL;
+ break;
case PR_PENDING_INTERRUPT_ERROR:
errno = EINTR;
break;
@@ -215,6 +218,27 @@ set_errno (int code)
case PR_WOULD_BLOCK_ERROR:
errno = EWOULDBLOCK;
break;
+ case PR_IN_PROGRESS_ERROR:
+ errno = EINPROGRESS;
+ break;
+ case PR_ALREADY_INITIATED_ERROR:
+ errno = EALREADY;
+ break;
+ case PR_NETWORK_UNREACHABLE_ERROR:
+ errno = EHOSTUNREACH;
+ break;
+ case PR_CONNECT_REFUSED_ERROR:
+ errno = ECONNREFUSED;
+ break;
+ case PR_CONNECT_TIMEOUT_ERROR:
+ errno = ETIMEDOUT;
+ break;
+ case PR_NOT_CONNECTED_ERROR:
+ errno = ENOTCONN;
+ break;
+ case PR_CONNECT_RESET_ERROR:
+ errno = ECONNRESET;
+ break;
case PR_IO_ERROR:
default:
errno = EIO;
@@ -578,12 +602,39 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
int errnosave;
set_errno (PR_GetError ());
- errnosave = errno;
- PR_Close (fd);
- ssl->priv->sockfd = NULL;
- errno = errnosave;
-
- return -1;
+ if (errno == EINPROGRESS) {
+ gboolean connected = FALSE;
+ PRPollDesc poll;
+
+ do {
+ poll.fd = fd;
+ poll.in_flags = PR_POLL_WRITE | PR_POLL_EXCEPT;
+ poll.out_flags = 0;
+
+ timeout = PR_INTERVAL_MIN;
+
+ if (PR_Poll (&poll, 1, timeout) == PR_FAILURE) {
+ set_errno (PR_GetError ());
+ goto exception;
+ }
+
+ if (PR_GetConnectStatus (&poll) == PR_FAILURE) {
+ set_errno (PR_GetError ());
+ if (errno != EINPROGRESS)
+ goto exception;
+ } else {
+ connected = TRUE;
+ }
+ } while (!connected);
+ } else {
+ exception:
+ errnosave = errno;
+ PR_Close (fd);
+ ssl->priv->sockfd = NULL;
+ errno = errnosave;
+
+ return -1;
+ }
}
ssl->priv->sockfd = fd;