$Log$
+ Revision 591.95 2002/08/21 21:58:00 ajc
+ * Completed self-service list subscription via web.
+ (Still need to implement unsubscribe.)
+
Revision 591.94 2002/08/16 21:04:56 ajc
* Add LPRM command
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
"NEW UPLOAD: '%s'\n %s\n",
CC->upl_file, CC->upl_comment);
quickie_message(CC->curr_user, NULL, CC->quickroom.QRname,
- upload_notice);
+ upload_notice, 0);
} else {
abort_upl(CC);
cprintf("%d File '%s' aborted.\n", CIT_OK, CC->upl_path);
/*
* Convenience function for generating small administrative messages.
*/
-void quickie_message(char *from, char *to, char *room, char *text)
+void quickie_message(char *from, char *to, char *room, char *text,
+ int format_type)
{
struct CtdlMessage *msg;
struct recptypes *recp = NULL;
memset(msg, 0, sizeof(struct CtdlMessage));
msg->cm_magic = CTDLMESSAGE_MAGIC;
msg->cm_anon_type = MES_NORMAL;
- msg->cm_format_type = 0;
+ msg->cm_format_type = format_type;
msg->cm_fields['A'] = strdoop(from);
if (room != NULL) msg->cm_fields['O'] = strdoop(room);
msg->cm_fields['N'] = strdoop(NODENAME);
/* $Id$ */
-#define aide_message(text) quickie_message("Citadel",NULL,AIDEROOM,text)
+#define aide_message(text) quickie_message("Citadel",NULL,AIDEROOM,text,0);
#define MSGS_ALL 0
#define MSGS_OLD 1
long send_message (struct CtdlMessage *, FILE *);
void loadtroom (void);
long CtdlSubmitMsg(struct CtdlMessage *, struct recptypes *, char *);
-void quickie_message (char *, char *, char *, char *);
+void quickie_message (char *, char *, char *, char *, int);
void cmd_ent0 (char *entargs);
void cmd_dele (char *delstr);
void cmd_move (char *args);
* tinfoil-hat secure, it just needs to be reasonably unguessable
* and unique.
*/
- sprintf(sourcebuf, "%d%d%ld",
- ++seq,
- getpid(),
- time(NULL)
+ sprintf(sourcebuf, "%lx",
+ (long) (++seq + getpid() + time(NULL))
);
/* Convert it to base64 so it looks cool */
char filename[SIZ];
char token[SIZ];
char confirmation_request[SIZ];
+ char urlroom[SIZ];
if (getroom(&qrbuf, room) != 0) {
cprintf("%d There is no list called '%s'\n", ERROR, room);
/* Generate and send the confirmation request */
+ urlesc(urlroom, qrbuf.QRname);
+
snprintf(confirmation_request, sizeof confirmation_request,
+ "Content-type: text/html\n\n"
+ "<HTML><BODY>"
"Someone (probably you) has submitted a request to subscribe\n"
- "<%s> to the '%s' mailing list.\n\n"
- "In order to confirm this subscription request, please\n"
- "point your web browser at the following location:\n\n"
- "http://%s?room=%s&token=%s\n\n"
+ "<%s> to the <B>%s</B> mailing list.<BR><BR>\n"
+ "<A HREF=\"http://%s?room=%s&token=%s&cmd=confirm\">"
+ "Please click here to confirm this request.</A><BR><BR>\n"
"If this request has been submitted in error and you do not\n"
"wish to receive the '%s' mailing list, simply do nothing,\n"
- "and you will not receive any further mailings.\n",
+ "and you will not receive any further mailings.\n"
+ "</BODY></HTML>\n",
- email, qrbuf.QRname, webpage, qrbuf.QRname, token, qrbuf.QRname
+ email, qrbuf.QRname, webpage, urlroom, token, qrbuf.QRname
);
- quickie_message(
+ quickie_message( /* This delivers the message */
"Citadel",
email,
- qrbuf.QRname,
- confirmation_request
+ NULL,
+ confirmation_request,
+ FMT_RFC822
);
cprintf("%d Subscription entered; confirmation request sent\n", CIT_OK);
-
}
return ret;
}
+
+/*
+ * Escape a string for feeding out as a URL.
+ * Output buffer must be big enough to handle escape expansion!
+ */
+void urlesc(char *outbuf, char *strbuf)
+{
+ int a, b, c;
+ char *ec = " #&;`'|*?-~<>^()[]{}$\\";
+
+ strcpy(outbuf, "");
+
+ for (a = 0; a < strlen(strbuf); ++a) {
+ c = 0;
+ for (b = 0; b < strlen(ec); ++b) {
+ if (strbuf[a] == ec[b])
+ c = 1;
+ }
+ b = strlen(outbuf);
+ if (c == 1)
+ sprintf(&outbuf[b], "%%%02x", strbuf[a]);
+ else
+ sprintf(&outbuf[b], "%c", strbuf[a]);
+ }
+}
+
+
void stripallbut(char *str, char leftboundary, char rightboundary);
char *myfgets(char *s, int size, FILE *stream);
+void urlesc(char *outbuf, char *strbuf);
$Log$
+Revision 323.60 2002/08/21 21:58:37 ajc
+* Completed self-service list subscription via web.
+ (Still need to implement unsubscribe.)
+
Revision 323.59 2002/08/16 22:06:51 ajc
* self-service
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
-
goto FORM;
}
}
-
+
+ /*
+ * Confirm command
+ */
+ else if (!strcasecmp(cmd, "confirm")) {
+ serv_printf("SUBS confirm|%s|%s",
+ room,
+ token
+ );
+ serv_gets(buf);
+ if (buf[0] == '2') {
+ wprintf("<CENTER><H1>Confirmation successful!</H1>");
+ }
+ else {
+ wprintf("<CENTER><H1>Confirmation failed.</H1>");
+ }
+ wprintf("%s</CENTER><BR>\n", &buf[4]);
+ }
+
/*
* Any other (invalid) command causes the form to be displayed
*/
self = extract_int(buf, 4) & QR2_SELFLIST ;
if (self) {
wprintf("<OPTION VALUE=\"");
- urlescputs(sroom);
+ escputs(sroom);
wprintf("\">");
escputs(sroom);
wprintf("</OPTION>\n");
" <A HREF=\"/toggle_self_service?newval=0&"
"tab=listserv\">"
"Click to disable.</A><BR>\n"
+ "The URL for subscribe/unsubscribe is: "
+ "<TT>http://%s/listsub</TT><BR>\n",
+ WC->http_host
);
}
else {