]> code.citadel.org Git - citadel.git/blobdiff - webcit-ng/room_functions.c
disabled server-side message sequencing code
[citadel.git] / webcit-ng / room_functions.c
index 9db3e7978af4899dd3c07c193dd877fb7b2c133d..12818421cc04e8db6507950ad9b1d653c70e9ffe 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Room functions
  *
- * Copyright (c) 1996-2016 by the citadel.org team
+ * Copyright (c) 1996-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 3.
@@ -131,11 +131,18 @@ void object_in_room(struct http_transaction *h, struct ctdlsession *c)
                return;
        }
 
+#if 0
        if (!strncasecmp(buf, "threads", 5)) {                  // Client is requesting a threaded view (still kind of fuzzy here)
                threaded_view(h, c, &buf[5]);
                return;
        }
 
+       if (!strncasecmp(buf, "flat", 5)) {                     // Client is requesting a flat view (still kind of fuzzy here)
+               flat_view(h, c, &buf[5]);
+               return;
+       }
+#endif
+
        if (    (c->room_default_view == VIEW_CALENDAR)         // room types where objects are referenced by EUID
                || (c->room_default_view == VIEW_TASKS)
                || (c->room_default_view == VIEW_ADDRESSBOOK)
@@ -161,6 +168,11 @@ void object_in_room(struct http_transaction *h, struct ctdlsession *c)
        syslog(LOG_DEBUG, "msgnum is %ld, method is %s", msgnum, h->method);
 
 
+       /*
+        * Does the client want us to render the message for them?
+        */
+       // FIXME put that logic here
+
        /*
         * Was the client actually requesting a specific component within the message?
         */
@@ -358,6 +370,9 @@ void propfind_the_room_itself(struct http_transaction *h, struct ctdlsession *c)
                                StrBufAppendPrintf(Buf, "/");
                                StrBufXMLEscAppend(Buf, NULL, e, strlen(e), 0);
                                StrBufAppendPrintf(Buf, "</D:href>");
+                               StrBufAppendPrintf(Buf, "<D:propstat>");
+                               StrBufAppendPrintf(Buf, "<D:status>HTTP/1.1 200 OK</D:status>");
+                               StrBufAppendPrintf(Buf, "<D:prop>");
 
                                switch(c->room_default_view) {
                                        case VIEW_CALENDAR:
@@ -371,9 +386,6 @@ void propfind_the_room_itself(struct http_transaction *h, struct ctdlsession *c)
                                                break;
                                }
 
-                               StrBufAppendPrintf(Buf, "<D:propstat>");
-                               StrBufAppendPrintf(Buf, "<D:status>HTTP/1.1 200 OK</D:status>");
-                               StrBufAppendPrintf(Buf, "<D:prop>");
                                if (timestamp > 0) {
                                        char *datestring = http_datestring(timestamp);
                                        if (datestring) {
@@ -382,7 +394,7 @@ void propfind_the_room_itself(struct http_transaction *h, struct ctdlsession *c)
                                                StrBufAppendPrintf(Buf, "</D:getlastmodified>");
                                                free(datestring);
                                        }
-                                       if (enumerate_by_euid) {
+                                       if (enumerate_by_euid) {                // FIXME ajc 2017oct30 should this be inside the timestamp conditional?
                                                StrBufAppendPrintf(Buf, "<D:getetag>\"%ld\"</D:getetag>", msglist[i]);
                                        }
                                }
@@ -419,6 +431,7 @@ void get_the_room_itself(struct http_transaction *h, struct ctdlsession *c)
        JsonObjectAppend(j, NewJsonNumber(      HKEY("default_view"),   c->room_default_view    ));
        JsonObjectAppend(j, NewJsonNumber(      HKEY("new_messages"),   c->new_messages         ));
        JsonObjectAppend(j, NewJsonNumber(      HKEY("total_messages"), c->total_messages       ));
+       JsonObjectAppend(j, NewJsonNumber(      HKEY("last_seen"),      c->last_seen            ));
 
        StrBuf *sj = NewStrBuf();
        SerializeJson(sj, j, 1);                        // '1' == free the source array
@@ -548,7 +561,7 @@ void ctdl_r(struct http_transaction *h, struct ctdlsession *c)
                         //     3       (int)info                       Info flag: set to nonzero if the user needs to read this room's info file
                         //     4       (int)CCC->room.QRflags          Various flags associated with this room.
                         //     5       (long)CCC->room.QRhighest       The highest message number present in this room
-                        //     6       (long)vbuf.v_lastseen           The highest message number the user has read in this room
+                        c->last_seen = extract_long(&buf[4], 6);       // The highest message number the user has read in this room
                         //     7       (int)rmailflag                  Boolean flag: 1 if this is a Mail> room, 0 otherwise.
                         //     8       (int)raideflag                  Nonzero if user is either Aide or a Room Aide in this room
                         //     9       (int)newmailcount               The number of new Mail messages the user has