* List subscription (not finished)
authorArt Cancro <ajc@citadel.org>
Wed, 14 Aug 2002 02:57:21 +0000 (02:57 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 14 Aug 2002 02:57:21 +0000 (02:57 +0000)
webcit/Makefile.in
webcit/context_loop.c
webcit/listsub.c [new file with mode: 0644]
webcit/webcit.c
webcit/webcit.h

index 8d73ab61ac727df5d6b76207a12560155fc8668c..dbe67e24838c02c6a6ac5ff9a4a3d3cec657f0dc 100644 (file)
@@ -26,10 +26,10 @@ webserver: webserver.o context_loop.o tools.o \
        cookie_conversion.o locate_host.o floors.o \
        webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \
        roomops.o messages.o userlist.o paging.o sysmsgs.o useredit.o \
-       vcard.o vcard_edit.o preferences.o html2html.o \
+       vcard.o vcard_edit.o preferences.o html2html.o listsub.o \
        mime_parser.o graphics.o netconf.o siteconfig.o subst.o $(LIBOBJS)
        $(CC) webserver.o context_loop.o tools.o cookie_conversion.o \
-       webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o \
+       webcit.o auth.o tcp_sockets.o mainmenu.o serv_func.o who.o listsub.o \
        roomops.o messages.o userlist.o paging.o sysmsgs.o useredit.o \
        locate_host.o siteconfig.o subst.o vcard.o vcard_edit.o floors.o \
        mime_parser.o graphics.o netconf.o preferences.o html2html.o \
index e979beeb8b17a9fe911df0f8b86b4183c19a06c9..ec920745fb6fd2f70c0f5d3fb174e07b78422342 100644 (file)
@@ -280,7 +280,9 @@ void context_loop(int sock)
        }
 
        /* Do the non-root-cookie check now. */
-       else if ( (strcmp(buf, "/")) && (got_cookie == 0)) {
+       else if ( (strcmp(buf, "/"))
+               && (strncasecmp(buf, "/listsub", 8))
+               && (got_cookie == 0)) {
                strcpy(req->line, "GET /static/nocookies.html"
                                "?force_close_session=yes HTTP/1.0");
        }
@@ -317,14 +319,11 @@ void context_loop(int sock)
                pthread_mutex_unlock(&SessionListMutex);
        }
 
-
        /*
-        *
-        * FIX ... check session integrity here before continuing
-        *
+        * A future improvement might be to check the session integrity
+        * at this point before continuing.
         */
 
-
        /*
         * Bind to the session and perform the transaction
         */
diff --git a/webcit/listsub.c b/webcit/listsub.c
new file mode 100644 (file)
index 0000000..1d9ce33
--- /dev/null
@@ -0,0 +1,59 @@
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <limits.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <string.h>
+#include <pwd.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <pthread.h>
+#include <signal.h>
+#include "webcit.h"
+
+
+
+/*
+ * List subscription handling
+ */
+void do_listsub(void)
+{
+       char cmd[SIZ];
+       char room[SIZ];
+       char token[SIZ];
+       char email[SIZ];
+       char subtype[SIZ];
+
+       strcpy(WC->wc_username, "");
+       strcpy(WC->wc_password, "");
+       strcpy(WC->wc_roomname, "");
+
+       output_headers(2);      /* note "2" causes cookies to be unset */
+
+       strcpy(cmd, bstr("cmd"));
+       strcpy(room, bstr("room"));
+       strcpy(token, bstr("token"));
+       strcpy(email, bstr("email"));
+       strcpy(subtype, bstr("subtype"));
+
+       wprintf("cmd: %s<BR>\n", cmd);
+       wprintf("room: %s<BR>\n", room);
+       wprintf("token: %s<BR>\n", token);
+       wprintf("email: %s<BR>\n", email);
+       wprintf("subtype: %s<BR>\n", subtype);
+
+       /*
+        * Since this isn't part of a normal Citadel session, we bail right
+        * out without maintaining any state.
+        */
+       wDumpContent(2);
+       end_webcit_session();
+}
index 8b713a7b52a4bc94b06322df882606eed8acdfb5..2700a6565a41a4859ff0fb35d422e695a55d0fcd 100644 (file)
@@ -912,6 +912,14 @@ void session_loop(struct httprequest *req)
                }
        }
 
+       /*
+        * Functions which can be performed without logging in
+        */
+       if (!strcasecmp(action, "listsub")) {
+               do_listsub();
+               goto SKIP_ALL_THIS_CRAP;
+       }
+
        check_for_express_messages();
 
        /*
@@ -948,12 +956,20 @@ void session_loop(struct httprequest *req)
                output_static(buf);
        } else if (!strcasecmp(action, "image")) {
                output_image();
+
+       /*
+        * All functions handled below this point ... make sure we log in
+        * before doing anything else!
+        */
        } else if ((!WC->logged_in) && (!strcasecmp(action, "login"))) {
                do_login();
        } else if (!WC->logged_in) {
                display_login(NULL);
        }
-       /* Various commands... */
+
+       /*
+        * Various commands...
+        */
 
        else if (!strcasecmp(action, "do_welcome")) {
                do_welcome();
index 2f9ece12ab417a1813f882275efc308e5d834de3..001fbafbad54020fe6db3c61dcc0a1bff9b7c496 100644 (file)
@@ -319,3 +319,4 @@ void display_floorconfig(char *);
 void delete_floor(void);
 void create_floor(void);
 void rename_floor(void);
+void do_listsub(void);