+2003-06-05 Jeffrey Stedfast <fejj@ximian.com>
+
+ Fix for bug #40788.
+
+ * providers/pop3/camel-pop3-engine.c (camel_pop3_engine_new): Now
+ takes a flags argument. Currently there is only 1 flag which can
+ be used to disable Pop3 server extensions.
+ (get_capabilities): Don't check for Pop3 server extensions if the
+ DISABLE_EXTENSIONS flag is set on the engine.
+ (camel_pop3_engine_iterate): If we get a response that is neither
+ +OK nor -ERR, default to treating it like a -ERR.
+
+ * providers/pop3/camel-pop3-store.c (connect_to_server): Check for
+ the disable_extensions param.
+
+ * providers/pop3/camel-pop3-provider.c: Define a checkbox to
+ disable all POP3 extension support.
+
2003-06-11 Jeffrey Stedfast <fejj@ximian.com>
Partial fix for bug #44457.
/**
* camel_pop3_engine_new:
* @source: source stream
+ * @flags: engine flags
*
* Returns a NULL stream. A null stream is always at eof, and
* always returns success for all reads and writes.
* Return value: the stream
**/
CamelPOP3Engine *
-camel_pop3_engine_new(CamelStream *source)
+camel_pop3_engine_new(CamelStream *source, guint32 flags)
{
CamelPOP3Engine *pe;
pe->stream = (CamelPOP3Stream *)camel_pop3_stream_new(source);
pe->state = CAMEL_POP3_ENGINE_AUTH;
-
+ pe->flags = flags;
+
get_capabilities(pe, TRUE);
return pe;
pe->auth = g_list_prepend(pe->auth, &camel_pop3_password_authtype);
}
- pc = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_capa, NULL, "CAPA\r\n");
- while (camel_pop3_engine_iterate(pe, pc) > 0)
- ;
- camel_pop3_engine_command_free(pe, pc);
-
- if (pe->state == CAMEL_POP3_ENGINE_TRANSACTION && !(pe->capa & CAMEL_POP3_CAP_UIDL)) {
- /* check for UIDL support manually */
- pc = camel_pop3_engine_command_new (pe, CAMEL_POP3_COMMAND_SIMPLE, NULL, NULL, "UIDL 1\r\n");
- while (camel_pop3_engine_iterate (pe, pc) > 0)
+ if (!(pe->flags & CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS)) {
+ pc = camel_pop3_engine_command_new(pe, CAMEL_POP3_COMMAND_MULTI, cmd_capa, NULL, "CAPA\r\n");
+ while (camel_pop3_engine_iterate(pe, pc) > 0)
;
+ camel_pop3_engine_command_free(pe, pc);
- if (pc->state == CAMEL_POP3_COMMAND_OK)
- pe->capa |= CAMEL_POP3_CAP_UIDL;
-
- camel_pop3_engine_command_free (pe, pc);
+ if (pe->state == CAMEL_POP3_ENGINE_TRANSACTION && !(pe->capa & CAMEL_POP3_CAP_UIDL)) {
+ /* check for UIDL support manually */
+ pc = camel_pop3_engine_command_new (pe, CAMEL_POP3_COMMAND_SIMPLE, NULL, NULL, "UIDL 1\r\n");
+ while (camel_pop3_engine_iterate (pe, pc) > 0)
+ ;
+
+ if (pc->state == CAMEL_POP3_COMMAND_OK)
+ pe->capa |= CAMEL_POP3_CAP_UIDL;
+
+ camel_pop3_engine_command_free (pe, pc);
+ }
}
}
default:
/* what do we do now? f'knows! */
g_warning("Bad server response: %s\n", p);
- errno = EIO;
- return -1;
+ pc->state = CAMEL_POP3_COMMAND_ERR;
+ break;
}
e_dlist_addtail(&pe->done, (EDListNode *)pc);
/* Set next command */
pe->current = (CamelPOP3Command *)e_dlist_remhead(&pe->active);
-
+
/* check the queue for sending any we can now send also */
pw = (CamelPOP3Command *)pe->queue.head;
pn = pw->next;
CAMEL_POP3_CAP_STLS = 1<<5
};
+/* enable/disable flags for the engine itself */
+enum {
+ CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS = 1<<0,
+};
+
typedef void (*CamelPOP3CommandFunc)(CamelPOP3Engine *pe, CamelPOP3Stream *stream, void *data);
struct _CamelPOP3Command {
struct _CamelPOP3Engine {
CamelObject parent;
-
+
+ guint32 flags;
+
camel_pop3_engine_t state;
GList *auth; /* authtypes supported */
CamelType camel_pop3_engine_get_type (void);
-CamelPOP3Engine *camel_pop3_engine_new (CamelStream *source);
+CamelPOP3Engine *camel_pop3_engine_new (CamelStream *source, guint32 flags);
void camel_pop3_engine_reget_capabilities (CamelPOP3Engine *engine);