]> code.citadel.org Git - citadel.git/commitdiff
* Reworked the PROPFIND xml output based on an example transaction
authorArt Cancro <ajc@citadel.org>
Tue, 1 Feb 2005 14:55:12 +0000 (14:55 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 1 Feb 2005 14:55:12 +0000 (14:55 +0000)
  supplied by Reinhold Kainhofer.  Groupware folder enumeration works
  properly in Kontact now.

webcit/ChangeLog
webcit/groupdav_propfind.c

index a3a33e4ce046c1e5c74ea70d7297b48e6e6b6ee0..6795dd1c9a90642128bca63211606b62ceacebbe 100644 (file)
@@ -1,4 +1,9 @@
 $Log$
+Revision 528.31  2005/02/01 14:55:12  ajc
+* Reworked the PROPFIND xml output based on an example transaction
+  supplied by Reinhold Kainhofer.  Groupware folder enumeration works
+  properly in Kontact now.
+
 Revision 528.30  2005/02/01 03:49:09  ajc
 * Completed "folder list" PROPFIND, now listing all rooms set to a
   calendar, tasks, or address view, using the GroupDAV properties.
@@ -2270,3 +2275,4 @@ Sun Dec  6 19:50:55 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
 
 1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
        * webserver.c: warning fix
+
index a44f746cc7057aa7e060e60d675de77f23322f5f..3cf03da5284015745af59613cc6dcbf9f38a9f93 100644 (file)
@@ -90,20 +90,34 @@ void groupdav_folder_list(void) {
 
                extract(roomname, buf, 0);
                view = extract_int(buf, 6);
+
+               /*
+                * For now, only list rooms that we know a GroupDAV client
+                * might be interested in.  In the future we may add
+                * the rest.
+                */
                if ((view == VIEW_CALENDAR) || (view == VIEW_TASKS) || (view == VIEW_ADDRESSBOOK) ) {
 
                        wprintf(" <D:response>\n");
-                       wprintf("   <D:href>http://splorph.xand.com/groupdav/");
-                       urlescputs(                                     roomname);
-                       wprintf(                                                "/</D:href>\n");
-                       wprintf("   <D:propstat>\n");
-                       wprintf("     <D:status>HTTP/1.1 200 OK</D:status>\n");
-                       wprintf("     <D:prop>\n");
-                       wprintf("      <D:displayname>");
-                       urlescputs(                     roomname);
-                       wprintf(                                "</D:displayname>\n");
-                       wprintf("      <resourcetype xmlns=\"DAV:\" xmlns:G=\"http://groupdav.org/\">\n");
-                       wprintf("        <collection />\n");
+
+                       wprintf("  <D:href>");
+                       if (strlen(WC->http_host) > 0) {
+                               wprintf("%s://%s",
+                                       (is_https ? "https" : "http"),
+                                       WC->http_host);
+                       }
+                       wprintf("/groupdav/");
+                       urlescputs(roomname);
+                       wprintf("/</D:href>\n");
+
+                       wprintf("  <D:propstat>\n");
+                       wprintf("   <D:status>HTTP/1.1 200 OK</D:status>\n");
+                       wprintf("   <D:prop>\n");
+                       wprintf("    <D:displayname>");
+                       escputs(                roomname);
+                       wprintf(                        "</D:displayname>\n");
+                       wprintf("    <D:resourcetype><D:collection/>");
+
                        switch(view) {
                                case VIEW_CALENDAR:
                                        wprintf("        <G:vevent-collection />\n");
@@ -115,15 +129,14 @@ void groupdav_folder_list(void) {
                                        wprintf("        <G:vcard-collection />\n");
                                        break;
                        }
-                       wprintf("      <resourcetype>\n");
-                       wprintf("     </D:prop>\n");
-                       wprintf("   </D:propstat>\n");
+
+                       wprintf(                                "</D:resourcetype>\n");
+                       wprintf("   </D:prop>\n");
+                       wprintf("  </D:propstat>\n");
                        wprintf(" </D:response>\n");
                }
        }
-
        wprintf("</D:multistatus>\n");
-
 }