+#if 0
+void ParseREST_URL(void)
+{
+ StrBuf *Buf;
+ StrBuf *pFloor = NULL;
+ wcsession *WCC = WC;
+ long i = 0;
+ const char *pCh = NULL;
+ HashList *Floors;
+ void *vFloor;
+
+ syslog(1, "parsing rest URL: %s", ChrPtr(WCC->Hdr->HR.ReqLine));
+
+ WCC->Directory = NewHash(1, Flathash);
+ WCC->CurrentFloor = NULL;
+
+ Buf = NewStrBuf();
+ while (StrBufExtract_NextToken(Buf, WCC->Hdr->HR.ReqLine, &pCh, '/') >= 0)
+ {
+ if (StrLength(Buf) != 0) {
+ /* ignore empty path segments */
+ StrBufUnescape(Buf, 1);
+ Put(WCC->Directory, IKEY(i), Buf, HFreeStrBuf);
+ if (i==0)
+ pFloor = Buf;
+ Buf = NewStrBuf();
+ }
+ i++;
+ }
+
+ FreeStrBuf(&Buf);
+ if (pFloor != NULL)
+ {
+ Floors = GetFloorListHash(NULL, NULL);
+
+ if (Floors != NULL)
+ {
+ if (GetHash(WCC->FloorsByName, SKEY(pFloor), &vFloor))
+ WCC->CurrentFloor = (Floor*) vFloor;
+ }
+ }
+}
+#endif
+
+int Conditional_REST_DEPTH(StrBuf *Target, WCTemplputParams *TP)
+{
+ long Depth, IsDepth;
+ long offset = 0;
+ wcsession *WCC = WC;
+
+ if (WCC->Hdr->HR.Handler != NULL)
+ offset ++;
+ Depth = GetTemplateTokenNumber(Target, TP, 2, 0);
+ IsDepth = GetCount(WCC->Directory) + offset;
+
+// LogTemplateError(Target, "bla", 1, TP, "REST_DEPTH: %ld : %ld\n", Depth, IsDepth);
+ if (Depth < 0) {
+ Depth = -Depth;
+ return IsDepth > Depth;
+ }
+ else
+ return Depth == IsDepth;
+}
+
+