]> code.citadel.org Git - citadel.git/commitdiff
* Allow anonymous HTTP requests for /freebusy/user%20name.vcf (or .vfb)
authorArt Cancro <ajc@citadel.org>
Thu, 26 Jun 2003 03:37:59 +0000 (03:37 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 26 Jun 2003 03:37:59 +0000 (03:37 +0000)
  This will allow some groupware clients to browse the free/busy times of
  other users on the system.

webcit/ChangeLog
webcit/calendar.c
webcit/context_loop.c
webcit/webcit.c
webcit/webcit.h

index 30036251d738832881eb710ada81ad98f2ef0657..27b1c214ecbbef508511a7091c94bf3f3c01ab13 100644 (file)
@@ -1,4 +1,9 @@
 $Log$
+Revision 500.4  2003/06/26 03:37:58  ajc
+* Allow anonymous HTTP requests for /freebusy/user%20name.vcf (or .vfb)
+  This will allow some groupware clients to browse the free/busy times of
+  other users on the system.
+
 Revision 500.3  2003/06/21 05:17:21  ajc
 * Better alignment of system messages
 * Exterminated display_error() and replaced it with WC->ImportantMessage
@@ -1499,4 +1504,3 @@ 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 751d387f3ad987336e428575206dabf6895d3a44..62b3db45c1785bc88512e20061b835d2992390e9 100644 (file)
@@ -874,4 +874,47 @@ void save_event(void) {
        }
 }
 
+
+
+
+
+/*
+ * freebusy display (for client software)
+ */
+void do_freebusy(char *req) {
+       char who[SIZ];
+       char buf[SIZ];
+       char *fb;
+
+       extract_token(who, req, 1, ' ');
+       if (!strncasecmp(who, "/freebusy/", 10)) {
+               strcpy(who, &who[10]);
+       }
+       unescape_input(who);
+
+       if ( (!strcasecmp(&who[strlen(who)-4], ".vcf"))
+          || (!strcasecmp(&who[strlen(who)-4], ".vcf")) ) {
+               who[strlen(who)-4] = 0;
+       }
+
+       lprintf(9, "freebusy requested for <%s>\n", who);
+       serv_printf("ICAL freebusy|%s", who);
+       serv_gets(buf);
+
+       if (buf[0] != '1') {
+               wprintf("HTTP/1.0 404 %s\n", &buf[4]);
+               output_headers(0);
+               wprintf("Content-Type: text/plain\n");
+               wprintf("\n");
+               wprintf("%s\n", &buf[4]);
+               return;
+       }
+
+       fb = read_server_text();
+       http_transmit_thing(fb, strlen(fb), "text/calendar");
+       free(fb);
+}
+
+
+
 #endif /* WEBCIT_WITH_CALENDAR_SERVICE */
index dffd6eeb8ac7f378c244008b3a9352cbfa680b24..ec6605924284dfd6ffa0b3bf725ec5069eee9f68 100644 (file)
@@ -302,6 +302,7 @@ void context_loop(int sock)
        /* Do the non-root-cookie check now. */
        else if ( (strcmp(buf, "/"))
                && (strncasecmp(buf, "/listsub", 8))
+               && (strncasecmp(buf, "/freebusy", 9))
                && (got_cookie == 0)) {
                strcpy(req->line, "GET /static/nocookies.html"
                                "?force_close_session=yes HTTP/1.0");
index 0335f5802984c41038464d44bf1029cd65533e6f..d8182dba17f83dc394426e3f3ec1800f5f4a8112 100644 (file)
@@ -902,6 +902,12 @@ void session_loop(struct httprequest *req)
                do_listsub();
                goto SKIP_ALL_THIS_CRAP;
        }
+#ifdef WEBCIT_WITH_CALENDAR_SERVICE
+       if (!strcasecmp(action, "freebusy")) {
+               do_freebusy(cmd);
+               goto SKIP_ALL_THIS_CRAP;
+       }
+#endif
 
        check_for_express_messages();
 
index f7a712bce6a3adfc3ba8c78fc18517fa14a4b265..96e76a0debe9dbe1df1ce7c7aa49850a419d59ed 100644 (file)
@@ -418,3 +418,5 @@ char *read_server_text(void);
 int goto_config_room(void);
 long locate_user_vcard(char *username, long usernum);
 void sleeeeeeeeeep(int);
+void http_transmit_thing(char *thing, size_t length, char *content_type);
+void unescape_input(char *buf);