don't use NAMESPACE unless the server supports it

This commit is contained in:
Michael Elkins 2000-12-23 21:57:06 +00:00
parent b3eb5661eb
commit 6f4cd030f8
2 changed files with 10 additions and 9 deletions

18
imap.c
View File

@ -410,6 +410,8 @@ imap_exec (imap_t * imap, const char *fmt, ...)
imap->have_starttls = 1; imap->have_starttls = 1;
else if (!strcmp ("AUTH=CRAM-MD5", arg)) else if (!strcmp ("AUTH=CRAM-MD5", arg))
imap->have_cram = 1; imap->have_cram = 1;
else if (!strcmp ("NAMESPACE", arg))
imap->have_namespace = 1;
} }
#endif #endif
} }
@ -607,18 +609,16 @@ imap_open (config_t * box, unsigned int minuid)
ret = imap_exec (imap, "LOGIN \"%s\" \"%s\"", box->user, box->pass); ret = imap_exec (imap, "LOGIN \"%s\" \"%s\"", box->user, box->pass);
} }
if (!ret) /* get NAMESPACE info */
if (!ret && box->use_namespace && imap->have_namespace &&
!imap_exec (imap, "NAMESPACE"))
{ {
/* get NAMESPACE info */ /* XXX for now assume personal namespace */
if (box->use_namespace && !imap_exec (imap, "NAMESPACE")) if (is_list (imap->ns_personal) &&
{
/* XXX for now assume personal namespace */
if (is_list (imap->ns_personal) &&
is_list (imap->ns_personal->child) && is_list (imap->ns_personal->child) &&
is_atom (imap->ns_personal->child->child)) is_atom (imap->ns_personal->child->child))
{ {
ns_prefix = imap->ns_personal->child->child->val; ns_prefix = imap->ns_personal->child->child->val;
}
} }
} }

View File

@ -130,6 +130,7 @@ typedef struct
list_t *ns_personal; list_t *ns_personal;
list_t *ns_other; list_t *ns_other;
list_t *ns_shared; list_t *ns_shared;
unsigned int have_namespace:1;
#if HAVE_LIBSSL #if HAVE_LIBSSL
unsigned int have_cram:1; unsigned int have_cram:1;
unsigned int have_starttls:1; unsigned int have_starttls:1;