<<< Date Index >>>     <<< Thread Index >>>

IMAP ID (RFC 2971) support



Hi.

I wanted to make a few changes to the mutt IMAP code. The first of those
changes is to add ID support.

ID is a command that the client can send to the server, saying "I am so
and so software". The server responds likewise, and the two continue as
before. It's logfile fodder, really. As a server implementor, it would
be very useful to know what client I'm dealing with when dissecting a
bug report.

I have attached a(n entirely trivial) patch to implement this (against
the latest nightly snapshot, since I still can't clone the repository
via Hg).

Comments?

-- ams
diff --git a/imap/imap_private.h b/imap/imap_private.h
index 618d8c5..c0ffc96 100644
--- a/imap/imap_private.h
+++ b/imap/imap_private.h
@@ -111,6 +111,7 @@ enum
   LOGINDISABLED,               /*           LOGINDISABLED */
   IDLE,                         /* RFC 2177: IDLE */
   SASL_IR,                      /* SASL initial response draft */
+  ID,                           /* RFC 2971: IMAP4 ID extension */
 
   CAPMAX
 };

diff --git a/imap/command.c b/imap/command.c
index 304ae6e..28ef438 100644
--- a/imap/command.c
+++ b/imap/command.c
@@ -66,6 +66,7 @@ static char *Capabilities[] = {
   "LOGINDISABLED",
   "IDLE",
   "SASL-IR",
+  "ID",
 
   NULL
 };

diff --git a/imap/imap.c b/imap/imap.c
index f7a207a..86804c2 100644
--- a/imap/imap.c
+++ b/imap/imap.c
@@ -474,6 +474,13 @@ int imap_open_connection (IMAP_DATA* idata)
     goto bail;
   }
 
+  if (mutt_bit_isset (idata->capabilities, ID)) {
+    if (imap_exec (idata, "ID (\"name\" \"mutt\" "
+                   "\"support-url\" \"http://www.mutt.org\"; "
+                   "\"version\" \"" VERSION "\")", 0))
+      goto bail;
+  }
+
   return 0;
 
 #if defined(USE_SSL)