* DAV-Message-list: expect timestamp next to the EUID
int GroupdavDispatchREST(RESTDispatchID WhichAction, int IgnoreFloor)
{
int GroupdavDispatchREST(RESTDispatchID WhichAction, int IgnoreFloor)
{
+ wcsession *WCC = WC;
+ void *vDir;
+
switch(WhichAction){
case ExistsID:
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:
/* TODO: remember euid */
case PutID:
case DeleteID:
/* Room has more parts than the URL, it might be a sub-room? */
else if (iRoom <ThisFolder->nRoomNameParts)
{//// TODO: ThisFolder->nRoomNameParts == urlp - IgnoreFloor???
/* Room has more parts than the URL, it might be a sub-room? */
else if (iRoom <ThisFolder->nRoomNameParts)
{//// TODO: ThisFolder->nRoomNameParts == urlp - IgnoreFloor???
- Put(Subfolders, SKEY(ThisFolder->name), ThisFolder, reference_free_handler);
+ Put(Subfolders, SKEY(ThisFolder->name),
+ /* Cast away const, its a reference. */
+ (void*)ThisFolder, reference_free_handler);
+long GotoRestRoom(HashList *SubRooms)
{
int IgnoreFloor = 0; /* deprecated... */
wcsession *WCC = WC;
long Count;
long State;
const folder *ThisFolder;
{
int IgnoreFloor = 0; /* deprecated... */
wcsession *WCC = WC;
long Count;
long State;
const folder *ThisFolder;
- HashList *SubRooms = NULL;
{
IgnoreFloor = 0;
State |= REST_IN_FLOOR;
{
IgnoreFloor = 0;
State |= REST_IN_FLOOR;
- SubRooms = NewHash(1, Flathash);
ThisFolder = GetRESTFolder(IgnoreFloor, SubRooms);
if (ThisFolder != NULL)
{
if (WCC->ThisRoom != NULL)
ThisFolder = GetRESTFolder(IgnoreFloor, SubRooms);
if (ThisFolder != NULL)
{
if (WCC->ThisRoom != NULL)
- if (CompareRooms(WCC->ThisRoom, ThisFolder))
+ if (CompareRooms(WCC->ThisRoom, ThisFolder) != 0)
gotoroom(ThisFolder->name);
State |= REST_IN_ROOM;
gotoroom(ThisFolder->name);
State |= REST_IN_ROOM;
+ if (GetCount(SubRooms) > 0)
+ State |= REST_HAVE_SUB_ROOMS;
}
if ((WCC->ThisRoom != NULL) &&
(Count + IgnoreFloor > 3))
{
}
if ((WCC->ThisRoom != NULL) &&
(Count + IgnoreFloor > 3))
{
- if (WCC->Hdr->HR.Handler.RID(ExistsID, IgnoreFloor))
+ if (WCC->Hdr->HR.Handler->RID(ExistsID, IgnoreFloor))
- State |= REST_GOT_EUID;
- }/////TODO
+ State |= REST_GOT_LOCAL_PART;
+ }
else {
/// WHOOPS, not there???
else {
/// WHOOPS, not there???
+ State |= REST_NONEXIST;
- /// TODO: ID detection
- /// TODO: File detection
-
-
*/
void groupdav_propfind(void)
{
*/
void groupdav_propfind(void)
{
+ HashList *SubRooms = NULL;
wcsession *WCC = WC;
StrBuf *dav_roomname;
StrBuf *dav_uid;
wcsession *WCC = WC;
StrBuf *dav_roomname;
StrBuf *dav_uid;
* If the room name is blank, the client is requesting a
* folder list.
*/
* If the room name is blank, the client is requesting a
* folder list.
*/
- State = GotoRestRoom();
+ SubRooms = NewHash(1, Flathash);
+ State = GotoRestRoom(SubRooms);
if (((State & REST_IN_ROOM) == 0) ||
if (((State & REST_IN_ROOM) == 0) ||
- (((State & (REST_GOT_EUID|REST_GOT_ID|REST_GOT_FILENAME)) == 0) &&
+ (((State & (REST_GOT_LOCAL_PART)) == 0) &&
(WCC->Hdr->HR.dav_depth == 0)))
{
now = time(NULL);
(WCC->Hdr->HR.dav_depth == 0)))
{
now = time(NULL);
end_burst();
FreeStrBuf(&dav_roomname);
FreeStrBuf(&dav_uid);
end_burst();
FreeStrBuf(&dav_roomname);
FreeStrBuf(&dav_uid);
+ FreeHashList(&SubRooms);
- if ((State & (REST_GOT_EUID|REST_GOT_ID|REST_GOT_FILENAME)) == 0) {
+ if ((State & (REST_GOT_LOCAL_PART)) == 0) {
readloop(headers, eReadEUIDS);
readloop(headers, eReadEUIDS);
+ FreeHashList(&SubRooms);
+
+
+
+ FreeHashList(&SubRooms);
+
{
Msg->euid = NewStrBuf();
StrBufExtract_NextToken(Msg->euid, Line, pos, '|');
{
Msg->euid = NewStrBuf();
StrBufExtract_NextToken(Msg->euid, Line, pos, '|');
+ Msg->date = StrBufExtractNext_long(Line, pos, '|');
+
return StrLength(Msg->euid) > 0;
}
return StrLength(Msg->euid) > 0;
}
#define REST_IN_NAMESPACE (1<<0)
#define REST_IN_FLOOR (1<<1)
#define REST_IN_ROOM (1<<2)
#define REST_IN_NAMESPACE (1<<0)
#define REST_IN_FLOOR (1<<1)
#define REST_IN_ROOM (1<<2)
-#define REST_GOT_EUID (1<<3)
-#define REST_GOT_ID (1<<4)
-#define REST_GOT_FILENAME (1<<5)
+#define REST_HAVE_SUB_ROOMS (1<<3)
+#define REST_GOT_LOCAL_PART (1<<4)
+#define REST_NONEXIST (1<<5)