Commit fa686270 fa686270cc881e43c7aabcd9fbdb85e1fecb9c46 by Sergey Poznyakoff

(imap4d_capability_add,imap4d_capability_remove,imap4d_capability_init): New functions

1 parent 45896e4a
......@@ -17,12 +17,43 @@
#include "imap4d.h"
char *capa[] = {
static list_t capa_list;
void
imap4d_capability_add (const char *str)
{
if (!capa_list)
list_create (&capa_list);
list_append (capa_list, (void*)str);
}
void
imap4d_capability_remove (const char *str)
{
list_remove (capa_list, (void*)str);
}
void
imap4d_capability_init ()
{
static char *capa[] = {
"IMAP4rev1",
"NAMESPACE",
"X-VERSION",
NULL
};
};
int i;
for (i = 0; capa[i]; i++)
imap4d_capability_add (capa[i]);
}
static int
print_capa (void *item, void *data)
{
util_send (" %s", (char *)item);
return 0;
}
int
imap4d_capability (struct imap4d_command *command, char *arg)
......@@ -32,13 +63,7 @@ imap4d_capability (struct imap4d_command *command, char *arg)
(void) arg;
util_send ("* CAPABILITY");
for (i = 0; capa[i]; i++)
util_send (" %s", capa[i]);
#ifdef WITH_TLS
if (tls_available && !tls_done)
util_send (" STARTTLS");
#endif /* WITH_TLS */
list_do (capa_list, print_capa, NULL);
imap4d_auth_capability ();
util_send ("\r\n");
......
......@@ -153,6 +153,7 @@ extern struct mu_auth_data *auth_data;
#ifdef WITH_TLS
extern int tls_available;
extern int tls_done;
extern int login_disabled;
#endif /* WITH_TLS */
#ifndef HAVE_STRTOK_R
......@@ -218,6 +219,10 @@ extern int namespace_init __P((char *path));
extern char * namespace_getfullpath __P((char *name, const char *delim));
extern char * namespace_checkfullpath __P((char *name, const char *pattern,
const char *delim));
/* Capability functions */
extern void imap4d_capability_add __P((const char *str));
extern void imap4d_capability_remove __P((const char *str));
extern void imap4d_capability_init __P((void));
/* Helper functions. */
extern int util_out __P ((int, const char *, ...));
......