* Created IsEmptyStr define to be used rather then using some weird strlen constructs
[citadel.git] / webcit / groupdav_delete.c
index 56ce1bd7b75332ae7f3ccf02295df4167b7ff951..f731daa5a7cf6878f9b0d4c323a64c0557cab4a4 100644 (file)
@@ -1,20 +1,17 @@
 /*
  * $Id$
- */
-/**
- * \defgroup GroupdavDel Handle GroupDAV DELETE requests.
+ *
+ * Handles GroupDAV DELETE requests.
  *
  */
-/*@{*/
+
 #include "webcit.h"
 #include "webserver.h"
 #include "groupdav.h"
 
 
-/**
- * \brief The pathname is always going to be /groupdav/room_name/euid
- * \param dav_pathname the groupdav pathname
- * \param dav_ifmatch item to delete ????
+/*
+ * The pathname is always going to be /groupdav/room_name/euid
  */
 void groupdav_delete(char *dav_pathname, char *dav_ifmatch) {
        char dav_roomname[SIZ];
@@ -22,23 +19,25 @@ void groupdav_delete(char *dav_pathname, char *dav_ifmatch) {
        long dav_msgnum = (-1);
        char buf[SIZ];
        int n = 0;
+       int len;
 
-       /** First, break off the "/groupdav/" prefix */
+       /* First, break off the "/groupdav/" prefix */
        remove_token(dav_pathname, 0, '/');
        remove_token(dav_pathname, 0, '/');
 
-       /** Now extract the message euid */
+       /* Now extract the message euid */
        n = num_tokens(dav_pathname, '/');
        extract_token(dav_uid, dav_pathname, n-1, '/', sizeof dav_uid);
        remove_token(dav_pathname, n-1, '/');
 
-       /** What's left is the room name.  Remove trailing slashes. */
-       if (dav_pathname[strlen(dav_pathname)-1] == '/') {
-               dav_pathname[strlen(dav_pathname)-1] = 0;
+       /* What's left is the room name.  Remove trailing slashes. */
+       len = strlen(dav_pathname);
+       if (dav_pathname[len-1] == '/') {
+               dav_pathname[len-1] = 0;
        }
        strcpy(dav_roomname, dav_pathname);
 
-       /** Go to the correct room. */
+       /* Go to the correct room. */
        if (strcasecmp(WC->wc_roomname, dav_roomname)) {
                gotoroom(dav_roomname);
        }
@@ -51,7 +50,7 @@ void groupdav_delete(char *dav_pathname, char *dav_ifmatch) {
 
        dav_msgnum = locate_message_by_uid(dav_uid);
 
-       /**
+       /*
         * If no item exists with the requested uid ... simple error.
         */
        if (dav_msgnum < 0L) {
@@ -61,11 +60,11 @@ void groupdav_delete(char *dav_pathname, char *dav_ifmatch) {
                return;
        }
 
-       /**
+       /*
         * It's there ... check the ETag and make sure it matches
         * the message number.
         */
-       if (strlen(dav_ifmatch) > 0) {
+       if (!IsEmptyStr(dav_ifmatch)) {
                if (atol(dav_ifmatch) != dav_msgnum) {
                        wprintf("HTTP/1.1 412 Precondition Failed\r\n");
                        groupdav_common_headers();
@@ -74,7 +73,7 @@ void groupdav_delete(char *dav_pathname, char *dav_ifmatch) {
                }
        }
 
-       /**
+       /*
         * Ok, attempt to delete the item.
         */
        serv_printf("DELE %ld", dav_msgnum);
@@ -91,6 +90,3 @@ void groupdav_delete(char *dav_pathname, char *dav_ifmatch) {
        }
        return;
 }
-
-
-/*@}*/