march mode list is loaded and works, now just need to filter it
authorArt Cancro <ajc@citadel.org>
Fri, 26 Apr 2019 03:01:01 +0000 (23:01 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 26 Apr 2019 03:01:01 +0000 (23:01 -0400)
webcit-ng/api.txt
webcit-ng/room_functions.c
webcit-ng/static/css/webcit.css
webcit-ng/static/js/main.js

index 4621f9bec94d1d02263eceb3a64e2efc26de81a4..dc5ebc00d9100152720fa27479b0bfadb505b6ac 100644 (file)
@@ -9,6 +9,6 @@ GET             /ctdl/r/ROOMNAME/               Returns information about the room (name, view, etc.) in
 GET            /ctdl/r/ROOMNAME/msgs.all       JSON array of message list in room
 GET            /ctdl/r/ROOMNAME/msgs.new       JSON array of message list in room (new messages)
 GET            /ctdl/c/info                    Returns a JSON representation of the output of an INFO server command
-POST           /ctdl/a/login
+POST           /ctdl/a/login                   Send it a your credentials and it will log you in
 GET            /ctdl/a/whoami
 GET            /ctdl/u/USERNAME/userpic        Returns an image containing the photo/avatar of the specified user
index 75ef7bcf589edc7720a830b1c1b05fb874238283..4f8b231e28d662fed396bd3ff9261d85ad9d80da 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Room functions
  *
- * Copyright (c) 1996-2018 by the citadel.org team
+ * Copyright (c) 1996-2019 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.
index 6c157d1e7be6e25c7ff188f48ba59e30f7e244f3..f2cc68abc0e99bee66db92f4b1b79734487c5c12 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 1996-2018 by Art Cancro and the citadel.org team.
+/* Copyright (c) 1996-2019 by Art Cancro and 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.
 */
index 5c200b3109c65b3bde37327a1a9e7487efd4fa8d..5f02ec0c3e2a02479eb4a17d8e6cbbfbc26115dd 100644 (file)
@@ -207,9 +207,11 @@ function gotoroom_2(data) {
 
 
 // Goto next room with unread messages
+//
 function gotonext() {
        console.log("march list contains " + march_list.length );
        if (march_list.length == 0) {
+               load_new_march_list();
                march_list = [ 
                        {"rorder":0,"name":"CitaNews","known":true,"hasnewmsgs":true,"floor":0} ,
                        {"rorder":0,"name":"Hot Rodding","known":true,"hasnewmsgs":true,"floor":0} ,
@@ -220,6 +222,23 @@ function gotonext() {
        else {
                next_room = march_list[0].name;
                march_list.splice(0, 1);
+               console.log("going to " + next_room);
                gotoroom(next_room);
        }
 }
+
+
+// Called by gotonext() when the march list is empty.
+//
+function load_new_march_list() {
+       var request = new XMLHttpRequest();
+       request.open("GET", "/ctdl/r/", true);
+       request.onreadystatechange = function() {
+               if ((this.readyState === 4) && ((this.status / 100) == 2)) {
+                       march_list = (JSON.parse(this.responseText));
+                       gotonext();             // yes , we recurse right back  FIXME sort and filter this data
+               }
+       };
+       request.send();
+       request = null;
+}