* WebDAV PROPFIND method now offers the <getlastmodified> property on individual...
authorArt Cancro <ajc@citadel.org>
Tue, 23 Dec 2008 05:08:05 +0000 (05:08 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 23 Dec 2008 05:08:05 +0000 (05:08 +0000)
webcit/groupdav_propfind.c

index 6da1f0e851585a1ddd0905b95098ccc1223ac4af..017dc91a91b53bb434d2640cb9d38a22ade6ec5f 100644 (file)
@@ -318,7 +318,12 @@ void groupdav_propfind(const char *dav_pathname, int dav_depth, StrBuf *dav_cont
                wprintf("</href>");
                wprintf("<propstat>");
                wprintf("<status>HTTP/1.1 200 OK</status>");
-               wprintf("<prop><getetag>\"%ld\"</getetag></prop>", dav_msgnum);
+               wprintf("<prop>");
+               wprintf("<getetag>\"%ld\"</getetag>", dav_msgnum);
+               wprintf("<getlastmodified>");
+               escputs(datestring);
+               wprintf("</getlastmodified>");
+               wprintf("</prop>");
                wprintf("</propstat>");
 
                wprintf("</response>\n");
@@ -400,12 +405,16 @@ void groupdav_propfind(const char *dav_pathname, int dav_depth, StrBuf *dav_cont
        if (num_msgs > 0) for (i=0; i<num_msgs; ++i) {
 
                strcpy(uid, "");
+               now = (-1);
                serv_printf("MSG0 %ld|3", msgs[i]);
                serv_getln(buf, sizeof buf);
                if (buf[0] == '1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
                        if (!strncasecmp(buf, "exti=", 5)) {
                                strcpy(uid, &buf[5]);
                        }
+                       else if (!strncasecmp(buf, "time=", 5)) {
+                               now = atol(&buf[5]);
+                       }
                }
 
                if (!IsEmptyStr(uid)) {
@@ -432,6 +441,12 @@ void groupdav_propfind(const char *dav_pathname, int dav_depth, StrBuf *dav_cont
                                        wprintf("<status>HTTP/1.1 200 OK</status>");
                                        wprintf("<prop>");
                                                wprintf("<getetag>\"%ld\"</getetag>", msgs[i]);
+                                       if (now > 0L) {
+                                               http_datestring(datestring, sizeof datestring, now);
+                                               wprintf("<getlastmodified>");
+                                               escputs(datestring);
+                                               wprintf("</getlastmodified>");
+                                       }
                                        wprintf("</prop>");
                                wprintf("</propstat>");
                        wprintf("</response>");