]> code.citadel.org Git - citadel.git/commitdiff
* serv_imap.c: implemented the RFC 3501 suggestion that the initial
authorArt Cancro <ajc@citadel.org>
Mon, 2 May 2005 16:09:52 +0000 (16:09 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 2 May 2005 16:09:52 +0000 (16:09 +0000)
  greeting, and the response to the LOGIN command, include an output
  of the server's CAPABILITY string.  I find this to be gratuitous but
  the UW IMAP server does it, so we are also doing it in order to better
  interoperate with clients which make assumptions...

citadel/ChangeLog
citadel/serv_imap.c

index c54e25cc6f2ebb7ee39a79030fcef2ceb9909469..4ea879ef788b35482c67112e1ce73fd673cd4525 100644 (file)
@@ -1,4 +1,11 @@
  $Log$
+ Revision 645.17  2005/05/02 16:09:52  ajc
+ * serv_imap.c: implemented the RFC 3501 suggestion that the initial
+   greeting, and the response to the LOGIN command, include an output
+   of the server's CAPABILITY string.  I find this to be gratuitous but
+   the UW IMAP server does it, so we are also doing it in order to better
+   interoperate with clients which make assumptions...
+
  Revision 645.16  2005/04/29 22:02:20  ajc
  * More IMAP tuning
 
@@ -6649,4 +6656,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index e3e1acd0cc2daa66f8363778d5f48e9a37dd83fc..7b9ce5074efa61ce07ef921fda1b842621292f69 100644 (file)
@@ -397,6 +397,29 @@ void imap_cleanup_function(void)
 }
 
 
+/*
+ * Does the actual work of the CAPABILITY command (because we need to
+ * output this stuff in other places as well)
+ */
+void imap_output_capability_string(void) {
+       cprintf("CAPABILITY IMAP4REV1 NAMESPACE AUTH=LOGIN");
+#ifdef HAVE_OPENSSL
+       if (!CC->redirect_ssl) cprintf(" STARTTLS");
+#endif
+}
+
+/*
+ * implements the CAPABILITY command
+ */
+void imap_capability(int num_parms, char *parms[])
+{
+       cprintf("* ");
+       imap_output_capability_string();
+       cprintf("\r\n");
+       cprintf("%s OK CAPABILITY completed\r\n", parms[0]);
+}
+
+
 
 /*
  * Here's where our IMAP session begins its happy day.
@@ -412,8 +435,9 @@ void imap_greeting(void)
        IMAP->cached_rfc822_msgnum = (-1);
        IMAP->cached_rfc822_withbody = 0;
 
-       cprintf("* OK %s Citadel IMAP4rev1 server ready\r\n",
-               config.c_fqdn);
+       cprintf("* OK [");
+       imap_output_capability_string();
+       cprintf("] %s IMAP4rev1 %s ready\r\n", config.c_fqdn, CITADEL);
 }
 
 /*
@@ -439,7 +463,9 @@ void imap_login(int num_parms, char *parms[])
 
        if (CtdlLoginExistingUser(parms[2]) == login_ok) {
                if (CtdlTryPassword(parms[3]) == pass_ok) {
-                       cprintf("%s OK login successful\r\n", parms[0]);
+                       cprintf("%s OK [", parms[0]);
+                       imap_output_capability_string();
+                       cprintf("] Hello, %s\r\n", CC->user.fullname);
                        return;
                }
        }
@@ -508,23 +534,6 @@ void imap_auth_login_pass(char *cmd)
 }
 
 
-/*
- * implements the CAPABILITY command
- */
-void imap_capability(int num_parms, char *parms[])
-{
-       cprintf("* CAPABILITY IMAP4 IMAP4REV1 NAMESPACE AUTH=LOGIN");
-
-#ifdef HAVE_OPENSSL
-       cprintf(" STARTTLS");
-#endif
-
-       cprintf("\r\n");
-       cprintf("%s OK CAPABILITY completed\r\n", parms[0]);
-}
-
-
-
 /*
  * implements the STARTTLS command (Citadel API version)
  */
@@ -628,6 +637,9 @@ void imap_select(int num_parms, char *parms[])
        cprintf("* %d EXISTS\r\n", msgs);
        cprintf("* %d RECENT\r\n", new);
 
+       cprintf("* OK [UIDVALIDITY 0] UID validity status\r\n");
+       cprintf("* OK [UIDNEXT %ld] Predicted next UID\r\n", CitControl.MMhighest + 1);
+
        /* Note that \Deleted is a valid flag, but not a permanent flag,
         * because we don't maintain its state across sessions.  Citadel
         * automatically expunges mailboxes when they are de-selected.
@@ -636,7 +648,6 @@ void imap_select(int num_parms, char *parms[])
        cprintf("* OK [PERMANENTFLAGS (\\Seen \\Answered)] "
                "permanent flags\r\n");
 
-       cprintf("* OK [UIDVALIDITY 0] UIDs valid\r\n");
        cprintf("%s OK [%s] %s completed\r\n",
                parms[0],
                (IMAP->readonly ? "READ-ONLY" : "READ-WRITE"), parms[1]);