Commit 8a0e37a3 8a0e37a387d905d9974bf8701996d60979b3c642 by Alain Magloire

Some minor bugfixes.

1 parent 86d51d05
2001-06-01 Alain Magloire
* mailbox/debug.c(debug_print): Noop is format is NULL;
* mailbox/mbx_imap.c (imap_messages_count): Hack! Force a
reconnect if the server timeout on us. This is not the right
approach and does not work well, fix later.
(message_operation): Check if selected is not null, first.
* mailbox/folder_imap.c (folder_imap_create): Wrong state.
* mailbox/mime.c: Pass down the return value if not ENOENT.
2001-05-30 Dave Inglis
* mailbox/mbx_pop.c (CHECK_ERROR): Force the mailbox to call connect
again when an error occured. For example the QPopper(Qalcomm) POP3
server timeout very quickly, 30 seconds violating the RFC. So when
Readin the stream again we reconnect.
2001-05-30 Dave Inglis
* mailbox/filter_trans.c (base64_decode): The variable should
......
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Library Public License as published by
......@@ -97,7 +97,8 @@ int
debug_print (debug_t debug, size_t level, const char *format, ...)
{
va_list ap;
if (debug == NULL)
if (debug == NULL || format == NULL)
return EINVAL;
if (!(debug->level & level))
......
......@@ -422,7 +422,7 @@ folder_imap_create (folder_t folder)
case IMAP_CREATE:
status = imap_send (f_imap);
CHECK_EAGAIN (f_imap, status);
f_imap->state = IMAP_DELETE_ACK;
f_imap->state = IMAP_CREATE_ACK;
case IMAP_CREATE_ACK:
status = imap_parse (f_imap);
......@@ -951,7 +951,7 @@ imap_string (f_imap_t f_imap, char **ptr)
return status;
}
/* FIXME: does not worl for nobloking. */
/* FIXME: does not work for nonblocking. */
static int
imap_list (f_imap_t f_imap)
{
......
......@@ -506,18 +506,30 @@ imap_messages_count (mailbox_t mailbox, size_t *pnum)
case IMAP_SELECT:
status = imap_send (f_imap);
CHECK_EAGAIN (f_imap, status);
if (status != 0)
f_imap->selected = NULL;
{
/* HACK!!!!! Force a reconnect here. */
if (status != EAGAIN && status != EINPROGRESS && status != EINTR)
{
CLEAR_STATE (f_imap);
status = folder_open (f_imap->folder, f_imap->folder->flags);
CHECK_EAGAIN (f_imap, status);
return imap_messages_count (mailbox, pnum);
}
return status;
}
f_imap->state = IMAP_SELECT_ACK;
case IMAP_SELECT_ACK:
status = imap_parse (f_imap);
CHECK_EAGAIN (f_imap, status);
MAILBOX_DEBUG0 (mailbox, MU_DEBUG_PROT, f_imap->buffer);
break;
default:
break;
status = folder_open (f_imap->folder, f_imap->folder->flags);
CHECK_EAGAIN (f_imap, status);
return status;
}
if (pnum)
......@@ -1722,8 +1734,9 @@ message_operation (f_imap_t f_imap, msg_imap_t msg_imap, char *buffer,
case IMAP_FETCH_ACK:
status = imap_parse (f_imap);
CHECK_EAGAIN (f_imap, status);
MAILBOX_DEBUG0 (f_imap->selected->mailbox, MU_DEBUG_PROT,
f_imap->buffer);
if (f_imap->selected)
MAILBOX_DEBUG0 (f_imap->selected->mailbox, MU_DEBUG_PROT,
f_imap->buffer);
default:
break;
......
......@@ -606,9 +606,11 @@ mime_create(mime_t *pmime, message_t msg, int flags)
else if ( ( ret = header_get_value(mime->hdrs, MU_HEADER_CONTENT_TYPE, mime->content_type, size+1, 0) ) == 0 )
_mime_munge_content_header(mime->content_type);
} else {
ret = 0;
if ( ( mime->content_type = strdup("text/plain; charset=us-ascii") ) == NULL ) /* default as per spec. */
ret = ENOMEM;
if (ret == ENOENT) {
ret = 0;
if ( ( mime->content_type = strdup("text/plain; charset=us-ascii") ) == NULL ) /* default as per spec. */
ret = ENOMEM;
}
}
if (ret == 0 ) {
mime->msg = msg;
......