From: Art Cancro Date: Wed, 14 Aug 2002 02:57:21 +0000 (+0000) Subject: * List subscription (not finished) X-Git-Tag: v7.86~6299 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=af8f15a281cc146c213da7c2248789415dee393d * List subscription (not finished) --- diff --git a/webcit/Makefile.in b/webcit/Makefile.in index 8d73ab61a..dbe67e248 100644 --- a/webcit/Makefile.in +++ b/webcit/Makefile.in @@ -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 \ diff --git a/webcit/context_loop.c b/webcit/context_loop.c index e979beeb8..ec920745f 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -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 index 000000000..1d9ce3362 --- /dev/null +++ b/webcit/listsub.c @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#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
\n", cmd); + wprintf("room: %s
\n", room); + wprintf("token: %s
\n", token); + wprintf("email: %s
\n", email); + wprintf("subtype: %s
\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(); +} diff --git a/webcit/webcit.c b/webcit/webcit.c index 8b713a7b5..2700a6565 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -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(); diff --git a/webcit/webcit.h b/webcit/webcit.h index 2f9ece12a..001fbafba 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -319,3 +319,4 @@ void display_floorconfig(char *); void delete_floor(void); void create_floor(void); void rename_floor(void); +void do_listsub(void);