Commit fa686270 fa686270cc881e43c7aabcd9fbdb85e1fecb9c46 by Sergey Poznyakoff

(imap4d_capability_add,imap4d_capability_remove,imap4d_capability_init): New functions

1 parent 45896e4a
...@@ -17,12 +17,43 @@ ...@@ -17,12 +17,43 @@
17 17
18 #include "imap4d.h" 18 #include "imap4d.h"
19 19
20 char *capa[] = { 20 static list_t capa_list;
21 "IMAP4rev1", 21
22 "NAMESPACE", 22 void
23 "X-VERSION", 23 imap4d_capability_add (const char *str)
24 NULL 24 {
25 }; 25 if (!capa_list)
26 list_create (&capa_list);
27 list_append (capa_list, (void*)str);
28 }
29
30 void
31 imap4d_capability_remove (const char *str)
32 {
33 list_remove (capa_list, (void*)str);
34 }
35
36 void
37 imap4d_capability_init ()
38 {
39 static char *capa[] = {
40 "IMAP4rev1",
41 "NAMESPACE",
42 "X-VERSION",
43 NULL
44 };
45 int i;
46
47 for (i = 0; capa[i]; i++)
48 imap4d_capability_add (capa[i]);
49 }
50
51 static int
52 print_capa (void *item, void *data)
53 {
54 util_send (" %s", (char *)item);
55 return 0;
56 }
26 57
27 int 58 int
28 imap4d_capability (struct imap4d_command *command, char *arg) 59 imap4d_capability (struct imap4d_command *command, char *arg)
...@@ -32,14 +63,8 @@ imap4d_capability (struct imap4d_command *command, char *arg) ...@@ -32,14 +63,8 @@ imap4d_capability (struct imap4d_command *command, char *arg)
32 (void) arg; 63 (void) arg;
33 util_send ("* CAPABILITY"); 64 util_send ("* CAPABILITY");
34 65
35 for (i = 0; capa[i]; i++) 66 list_do (capa_list, print_capa, NULL);
36 util_send (" %s", capa[i]); 67
37
38 #ifdef WITH_TLS
39 if (tls_available && !tls_done)
40 util_send (" STARTTLS");
41 #endif /* WITH_TLS */
42
43 imap4d_auth_capability (); 68 imap4d_auth_capability ();
44 util_send ("\r\n"); 69 util_send ("\r\n");
45 70
......
...@@ -153,6 +153,7 @@ extern struct mu_auth_data *auth_data; ...@@ -153,6 +153,7 @@ extern struct mu_auth_data *auth_data;
153 #ifdef WITH_TLS 153 #ifdef WITH_TLS
154 extern int tls_available; 154 extern int tls_available;
155 extern int tls_done; 155 extern int tls_done;
156 extern int login_disabled;
156 #endif /* WITH_TLS */ 157 #endif /* WITH_TLS */
157 158
158 #ifndef HAVE_STRTOK_R 159 #ifndef HAVE_STRTOK_R
...@@ -218,6 +219,10 @@ extern int namespace_init __P((char *path)); ...@@ -218,6 +219,10 @@ extern int namespace_init __P((char *path));
218 extern char * namespace_getfullpath __P((char *name, const char *delim)); 219 extern char * namespace_getfullpath __P((char *name, const char *delim));
219 extern char * namespace_checkfullpath __P((char *name, const char *pattern, 220 extern char * namespace_checkfullpath __P((char *name, const char *pattern,
220 const char *delim)); 221 const char *delim));
222 /* Capability functions */
223 extern void imap4d_capability_add __P((const char *str));
224 extern void imap4d_capability_remove __P((const char *str));
225 extern void imap4d_capability_init __P((void));
221 226
222 /* Helper functions. */ 227 /* Helper functions. */
223 extern int util_out __P ((int, const char *, ...)); 228 extern int util_out __P ((int, const char *, ...));
......