]> code.citadel.org Git - citadel.git/blobdiff - webcit/groupdav_main.c
New global variable 'site_prefix' which replaces the often-repeated code which constr...
[citadel.git] / webcit / groupdav_main.c
index fb3f5203c56cb0fc083542b6a06ad77f1dcc29d4..3fc38fb306d1b585f4ef26d8ba873eb97655ffd1 100644 (file)
@@ -1,8 +1,21 @@
 /*
- * $Id$
- *
  * Entry point for GroupDAV functions
  *
+ * Copyright (c) 2005-2010 by the citadel.org team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "webcit.h"
@@ -177,39 +190,20 @@ void groupdav_main(void)
  * Output our host prefix for globally absolute URL's.
  */  
 void groupdav_identify_host(void) {
-       wcsession *WCC = WC;
-
-       if (StrLength(WCC->Hdr->HR.http_host)!=0) {
-               wc_printf("%s://%s",
-                       (is_https ? "https" : "http"),
-                       ChrPtr(WCC->Hdr->HR.http_host));
-       }
+       wc_printf("%s", ChrPtr(site_prefix));
 }
 
 
 void tmplput_GROUPDAV_HOSTNAME(StrBuf *Target, WCTemplputParams *TP) 
 {
-       wcsession *WCC = WC;
-
-       if (StrLength(WCC->Hdr->HR.http_host)!=0) {
-               StrBufAppendPrintf(Target, 
-                                  "%s://%s",
-                                  (is_https ? "https" : "http"),
-                                  ChrPtr(WCC->Hdr->HR.http_host));
-       }
+       StrBufAppendPrintf(Target, "%s", ChrPtr(site_prefix));
 }
 
 /*
  * Output our host prefix for globally absolute URL's.
  */  
 void groupdav_identify_hosthdr(void) {
-       wcsession *WCC = WC;
-
-       if (StrLength(WCC->Hdr->HR.http_host)!=0) {
-               hprintf("%s://%s",
-                       (is_https ? "https" : "http"),
-                       ChrPtr(WCC->Hdr->HR.http_host));
-       }
+       hprintf("%s", ChrPtr(site_prefix));
 }
 
 
@@ -293,12 +287,13 @@ void tmplput_DAV_NAMESPACE(StrBuf *Target, WCTemplputParams *TP)
 
 int GroupdavDispatchREST(RESTDispatchID WhichAction, int IgnoreFloor)
 {
-
+       wcsession *WCC = WC;
+       void *vDir;
+       
        switch(WhichAction){
        case ExistsID:
-               //WCC->Directory
-//nRoomNameParts
-//             return locate_message_by_uid() != -1;
+               GetHash(WCC->Directory, IKEY(WCC->ThisRoom->nRoomNameParts + 1), &vDir);
+               return locate_message_by_uid(ChrPtr((StrBuf*)vDir)) != -1;
                /* TODO: remember euid */
        case PutID:
        case DeleteID: