4 * Functions which deal with the fetching and displaying of messages.
14 #include <sys/types.h>
16 #include <sys/socket.h>
18 #include <netinet/in.h>
28 #include "webserver.h"
32 * Look for URL's embedded in a buffer and make them linkable. We use a
33 * target window in order to keep the BBS session in its own window.
49 for (pos = 0; pos < strlen(buf); ++pos) {
50 if (!strncasecmp(&buf[pos], "http://", 7))
52 if (!strncasecmp(&buf[pos], "ftp://", 6))
59 if ((start > 0) && (buf[start - 1] == '<'))
61 if ((start > 0) && (buf[start - 1] == '['))
63 if ((start > 0) && (buf[start - 1] == '('))
65 if ((start > 0) && (buf[start - 1] == '{'))
68 for (pos = strlen(buf); pos > start; --pos) {
69 if ((buf[pos] == ' ') || (buf[pos] == ench))
73 strncpy(urlbuf, &buf[start], end - start);
74 urlbuf[end - start] = 0;
76 strncpy(outbuf, buf, start);
77 sprintf(&outbuf[start], "%cA HREF=%c%s%c TARGET=%c%s%c%c%s%c/A%c",
78 LB, QU, urlbuf, QU, QU, TARGET, QU, RB, urlbuf, LB, RB);
79 strcat(outbuf, &buf[end]);
80 if ( strlen(outbuf) < 250 )
85 /* display_vcard() calls this after parsing the textual vCard into
86 * our 'struct vCard' data object.
88 * Set 'full' to nonzero to display the full card, otherwise it will only
89 * show a summary line.
91 void display_parsed_vcard(struct vCard *v, int full) {
98 name = vcard_get_prop(v, "n", 1, 0, 0);
110 wprintf("<TABLE bgcolor=#888888>");
111 if (v->numprops) for (i=0; i<(v->numprops); ++i) {
112 if (!strcasecmp(v->prop[i].name, "n")) {
113 wprintf("<TR BGCOLOR=#AAAAAA>"
114 "<TD BGCOLOR=#FFFFFF>"
115 "<IMG VALIGN=CENTER SRC=\"/static/vcard.gif\"></TD>"
116 "<TD><FONT SIZE=+1><B>");
117 escputs(v->prop[i].value);
118 wprintf("</B></FONT></TD></TR>\n");
120 else if (!strcasecmp(v->prop[i].name, "email;internet")) {
121 wprintf("<TR><TD>Internet e-mail:</TD>"
122 "<TD><A HREF=\"mailto:");
123 urlescputs(v->prop[i].value);
125 escputs(v->prop[i].value);
126 wprintf("</A></TD></TR>\n");
128 else if (!strcasecmp(v->prop[i].name, "adr")) {
129 wprintf("<TR><TD>Address:</TD><TD>");
130 for (j=0; j<num_tokens(v->prop[i].value, ';'); ++j) {
131 extract_token(buf, v->prop[i].value, j, ';');
132 if (strlen(buf) > 0) {
137 wprintf("</TD></TR>\n");
139 else if (!strncasecmp(v->prop[i].name, "tel;", 4)) {
140 wprintf("<TR><TD>%s telephone:</TD><TD>",
141 &v->prop[i].name[4]);
142 for (j=0; j<num_tokens(v->prop[i].value, ';'); ++j) {
143 extract_token(buf, v->prop[i].value, j, ';');
144 if (strlen(buf) > 0) {
149 wprintf("</TD></TR>\n");
153 escputs(v->prop[i].name);
154 wprintf("</TD><TD>");
155 escputs(v->prop[i].value);
156 wprintf("</TD></TR>\n");
159 wprintf("</TABLE>\n");
165 * Display a textual vCard
166 * (Converts to a vCard object and then calls the actual display function)
167 * Set 'full' to nonzero to display the whole card instead of a one-liner
169 void display_vcard(char *vcard_source, char alpha, int full) {
175 v = vcard_load(vcard_source);
176 if (v == NULL) return;
178 name = vcard_get_prop(v, "n", 1, 0, 0);
185 || ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha)) )
186 || ((!isalpha(alpha)) && (!isalpha(this_alpha))) ) {
188 display_parsed_vcard(v, full);
199 * I wanna SEE that message!
201 void read_message(long msgnum) {
203 char mime_partnum[SIZ];
204 char mime_filename[SIZ];
205 char mime_content_type[SIZ];
206 char mime_disposition[SIZ];
208 char *mime_http = NULL;
218 char vcard_partnum[SIZ];
219 char *vcard_source = NULL;
224 strcpy(reply_to, "");
225 strcpy(vcard_partnum, "");
227 serv_printf("MSG4 %ld", msgnum);
230 wprintf("<STRONG>ERROR:</STRONG> %s<BR>\n", &buf[4]);
234 wprintf("<TABLE WIDTH=100%% BORDER=0 CELLSPACING=0 "
235 "CELLPADDING=1 BGCOLOR=CCCCCC><TR><TD>\n");
239 wprintf("COLOR=\"000000\"> ");
240 strcpy(m_subject, "");
242 while (serv_gets(buf), strcasecmp(buf, "text")) {
243 if (!strncasecmp(buf, "nhdr=yes", 8))
247 if (!strncasecmp(buf, "type=", 5))
248 format_type = atoi(&buf[5]);
249 if (!strncasecmp(buf, "from=", 5)) {
250 strcpy(from, &buf[5]);
251 wprintf("from <A HREF=\"/showuser&who=");
257 if (!strncasecmp(buf, "subj=", 5))
258 strcpy(m_subject, &buf[5]);
259 if ((!strncasecmp(buf, "hnod=", 5))
260 && (strcasecmp(&buf[5], serv_info.serv_humannode)))
261 wprintf("(%s) ", &buf[5]);
262 if ((!strncasecmp(buf, "room=", 5))
263 && (strcasecmp(&buf[5], WC->wc_roomname)))
264 wprintf("in %s> ", &buf[5]);
265 if (!strncasecmp(buf, "rfca=", 5)) {
266 strcpy(rfca, &buf[5]);
272 if (!strncasecmp(buf, "node=", 5)) {
273 if ( ((WC->room_flags & QR_NETWORK)
274 || ((strcasecmp(&buf[5], serv_info.serv_nodename)
275 && (strcasecmp(&buf[5], serv_info.serv_fqdn)))))
278 wprintf("@%s ", &buf[5]);
281 if (!strncasecmp(buf, "rcpt=", 5))
282 wprintf("to %s ", &buf[5]);
283 if (!strncasecmp(buf, "time=", 5)) {
284 fmt_date(now, atol(&buf[5]));
288 if (!strncasecmp(buf, "part=", 5)) {
289 extract(mime_filename, &buf[5], 1);
290 extract(mime_partnum, &buf[5], 2);
291 extract(mime_disposition, &buf[5], 3);
292 extract(mime_content_type, &buf[5], 4);
293 mime_length = extract_int(&buf[5], 5);
295 if (!strcasecmp(mime_disposition, "attachment")) {
296 if (mime_http == NULL) {
297 mime_http = malloc(512);
298 strcpy(mime_http, "");
301 mime_http = realloc(mime_http,
302 strlen(mime_http) + 512);
304 sprintf(&mime_http[strlen(mime_http)],
305 "<A HREF=\"/output_mimepart?"
306 "msgnum=%ld&partnum=%s\" "
307 "TARGET=\"wc.%ld.%s\">"
308 "<IMG SRC=\"/static/attachment.gif\" "
309 "BORDER=0 ALIGN=MIDDLE>\n"
310 "Part %s: %s (%s, %d bytes)</A><BR>\n",
311 msgnum, mime_partnum,
312 msgnum, mime_partnum,
313 mime_partnum, mime_filename,
314 mime_content_type, mime_length);
317 if ((!strcasecmp(mime_disposition, "inline"))
318 && (!strncasecmp(mime_content_type, "image/", 6)) ){
319 if (mime_http == NULL) {
320 mime_http = malloc(512);
321 strcpy(mime_http, "");
324 mime_http = realloc(mime_http,
325 strlen(mime_http) + 512);
327 sprintf(&mime_http[strlen(mime_http)],
328 "<IMG SRC=\"/output_mimepart?"
329 "msgnum=%ld&partnum=%s\">",
330 msgnum, mime_partnum);
333 if (!strcasecmp(mime_content_type, "text/x-vcard")) {
334 strcpy(vcard_partnum, mime_partnum);
342 /* Generate a reply-to address */
343 if (strlen(rfca) > 0) {
344 strcpy(reply_to, rfca);
347 if (strlen(node) > 0) {
348 snprintf(reply_to, sizeof(reply_to), "%s @ %s",
352 snprintf(reply_to, sizeof(reply_to), "%s", from);
360 wprintf("</FONT></TD>");
362 wprintf("<TD ALIGN=RIGHT>\n"
363 "<TABLE BORDER=0><TR>\n");
365 wprintf("<TD BGCOLOR=\"AAAADD\">"
366 "<A HREF=\"/readfwd?startmsg=%ld", msgnum);
367 wprintf("&maxmsgs=1&summary=0\">Read</A>"
370 wprintf("<TD BGCOLOR=\"AAAADD\">"
371 "<A HREF=\"/display_enter?recp=");
372 urlescputs(reply_to);
373 wprintf("\"><FONT SIZE=-1>Reply</FONT></A>"
376 if (WC->is_room_aide) {
377 wprintf("<TD BGCOLOR=\"AAAADD\">"
378 "<A HREF=\"/confirm_move_msg"
380 "\"><FONT SIZE=-1>Move</FONT></A>"
383 wprintf("<TD BGCOLOR=\"AAAADD\">"
384 "<A HREF=\"/delete_msg"
386 "onClick=\"return confirm('Delete this message?');\""
387 "><FONT SIZE=-1>Del</FONT></A>"
391 wprintf("</TR></TABLE>\n"
394 if (strlen(m_subject) > 0) {
395 wprintf("<TR><TD><FONT COLOR=\"0000FF\">"
397 "</TD><TD> </TD></TR>\n", m_subject);
400 wprintf("</TR></TABLE>\n");
403 * Learn the content type
405 strcpy(mime_content_type, "text/plain");
406 while (serv_gets(buf), (strlen(buf) > 0)) {
407 if (!strncasecmp(buf, "Content-type: ", 14)) {
408 safestrncpy(mime_content_type, &buf[14],
409 sizeof(mime_content_type));
413 /* Messages in legacy Citadel variformat get handled thusly... */
414 if (!strcasecmp(mime_content_type, "text/x-citadel-variformat")) {
418 /* Boring old 80-column fixed format text gets handled this way... */
419 else if (!strcasecmp(mime_content_type, "text/plain")) {
420 while (serv_gets(buf), strcmp(buf, "000")) {
421 while ((strlen(buf) > 0) && (isspace(buf[strlen(buf) - 1])))
422 buf[strlen(buf) - 1] = 0;
424 ((!strncmp(buf, ">", 1)) || (!strncmp(buf, " >", 2)) || (!strncmp(buf, " :-)", 4)))) {
425 wprintf("<FONT COLOR=\"000044\"><I>");
427 } else if ((bq == 1) &&
428 (strncmp(buf, ">", 1)) && (strncmp(buf, " >", 2)) && (strncmp(buf, " :-)", 4))) {
429 wprintf("</FONT></I>");
435 wprintf("</TT><BR>\n");
440 else /* HTML is fun, but we've got to strip it first */
441 if (!strcasecmp(mime_content_type, "text/html")) {
445 /* Unknown weirdness */
447 wprintf("I don't know how to display %s<BR>\n",
449 while (serv_gets(buf), strcmp(buf, "000")) { }
453 /* Afterwards, offer links to download attachments 'n' such */
454 if (mime_http != NULL) {
455 wprintf("%s", mime_http);
459 if (strlen(vcard_partnum) > 0) {
460 vcard_source = load_mimepart(msgnum, vcard_partnum);
461 if (vcard_source != NULL) {
463 /* If it's my vCard I can edit it */
464 if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
465 || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
466 wprintf("<A HREF=\"/edit_vcard?"
467 "msgnum=%ld&partnum=%s\">",
468 msgnum, vcard_partnum);
469 wprintf("(edit)</A>");
472 /* In all cases, display the full card */
473 display_vcard(vcard_source, 0, 1);
481 void summarize_message(long msgnum) {
492 memset(&summ, 0, sizeof(summ));
493 strcpy(summ.subj, "(no subject)");
495 sprintf(buf, "MSG0 %ld|1", msgnum); /* ask for headers only */
498 if (buf[0] != '1') return;
500 while (serv_gets(buf), strcmp(buf, "000")) {
501 if (!strncasecmp(buf, "from=", 5)) {
502 strcpy(summ.from, &buf[5]);
504 if (!strncasecmp(buf, "subj=", 5)) {
505 strcpy(summ.subj, &buf[5]);
507 if (!strncasecmp(buf, "rfca=", 5)) {
508 strcat(summ.from, " <");
509 strcat(summ.from, &buf[5]);
510 strcat(summ.from, ">");
513 if (!strncasecmp(buf, "node=", 5)) {
514 if ( ((WC->room_flags & QR_NETWORK)
515 || ((strcasecmp(&buf[5], serv_info.serv_nodename)
516 && (strcasecmp(&buf[5], serv_info.serv_fqdn)))))
518 strcat(summ.from, " @ ");
519 strcat(summ.from, &buf[5]);
523 if (!strncasecmp(buf, "rcpt=", 5)) {
524 strcpy(summ.to, &buf[5]);
527 if (!strncasecmp(buf, "time=", 5)) {
528 fmt_date(summ.date, atol(&buf[5]));
532 wprintf("<TD><A HREF=\"/readfwd?startmsg=%ld"
533 "&maxmsgs=1&summary=0\">",
536 wprintf("</A></TD><TD>");
538 wprintf(" </TD><TD>");
542 "<INPUT TYPE=\"checkbox\" NAME=\"msg_%ld\" VALUE=\"yes\">"
550 void display_addressbook(long msgnum, char alpha) {
552 char mime_partnum[SIZ];
553 char mime_filename[SIZ];
554 char mime_content_type[SIZ];
555 char mime_disposition[SIZ];
557 char vcard_partnum[SIZ];
558 char *vcard_source = NULL;
568 memset(&summ, 0, sizeof(summ));
569 strcpy(summ.subj, "(no subject)");
571 sprintf(buf, "MSG0 %ld|1", msgnum); /* ask for headers only */
574 if (buf[0] != '1') return;
576 while (serv_gets(buf), strcmp(buf, "000")) {
577 if (!strncasecmp(buf, "part=", 5)) {
578 extract(mime_filename, &buf[5], 1);
579 extract(mime_partnum, &buf[5], 2);
580 extract(mime_disposition, &buf[5], 3);
581 extract(mime_content_type, &buf[5], 4);
582 mime_length = extract_int(&buf[5], 5);
584 if (!strcasecmp(mime_content_type, "text/x-vcard")) {
585 strcpy(vcard_partnum, mime_partnum);
591 if (strlen(vcard_partnum) > 0) {
592 vcard_source = load_mimepart(msgnum, vcard_partnum);
593 if (vcard_source != NULL) {
595 /* Display the summary line */
596 display_vcard(vcard_source, alpha, 0);
598 /* If it's my vCard I can edit it */
599 if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
600 || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
601 wprintf("<A HREF=\"/edit_vcard?"
602 "msgnum=%ld&partnum=%s\">",
603 msgnum, vcard_partnum);
604 wprintf("(edit)</A>");
616 * load message pointers from the server
618 int load_msg_ptrs(servcmd)
628 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
631 while (serv_gets(buf), strcmp(buf, "000")) {
632 WC->msgarr[nummsgs] = atol(buf);
640 * command loop for reading messages
642 void readloop(char *oper)
650 int num_displayed = 0;
652 int is_addressbook = 0;
653 int remaining_messages;
655 int lowest_displayed = (-1);
656 int highest_displayed = 0;
657 long pn_previous = 0L;
658 long pn_current = 0L;
663 startmsg = atol(bstr("startmsg"));
664 maxmsgs = atoi(bstr("maxmsgs"));
665 is_summary = atoi(bstr("summary"));
666 if (maxmsgs == 0) maxmsgs = 20;
670 if (!strcmp(oper, "readnew")) {
671 strcpy(cmd, "MSGS NEW");
672 } else if (!strcmp(oper, "readold")) {
673 strcpy(cmd, "MSGS OLD");
675 strcpy(cmd, "MSGS ALL");
678 /* FIXME put in the correct constant #defs */
679 if ((WC->wc_view == 1) && (maxmsgs > 1)) {
681 strcpy(cmd, "MSGS ALL");
684 if ((WC->wc_view == 2) && (maxmsgs > 1)) {
686 strcpy(cmd, "MSGS ALL");
688 if (bstr("alpha") == NULL) {
692 strcpy(buf, bstr("alpha"));
696 for (i='A'; i<='Z'; ++i) {
697 if (i == alpha) wprintf("<FONT SIZE=+2>"
700 wprintf("<A HREF=\"/readfwd?alpha=%c\">"
705 if (!isalpha(alpha)) wprintf("<FONT SIZE=+2>(other)</FONT>\n");
706 else wprintf("<A HREF=\"/readfwd?alpha=1\">(other)</A>\n");
707 wprintf("<HR width=100%%>\n");
710 nummsgs = load_msg_ptrs(cmd);
712 if (!strcmp(oper, "readnew")) {
713 wprintf("<EM>No new messages in this room.</EM>\n");
714 } else if (!strcmp(oper, "readold")) {
715 wprintf("<EM>No old messages in this room.</EM>\n");
717 wprintf("<EM>This room is empty.</EM>\n");
722 if (startmsg == 0L) startmsg = WC->msgarr[0];
723 remaining_messages = 0;
725 for (a = 0; a < nummsgs; ++a) {
726 if (WC->msgarr[a] >= startmsg) {
727 ++remaining_messages;
732 wprintf("<FORM METHOD=\"POST\" ACTION=\"/do_stuff_to_msgs\">\n"
733 "<TABLE border=0 cellspacing=0 "
734 "cellpadding=0 width=100%%>\n"
736 "<TD><I>Subject</I></TD>"
737 "<TD><I>Sender</I></TD>"
738 "<TD><I>Date</I></TD>"
744 if (is_addressbook) {
745 wprintf("<TABLE border=0 cellspacing=0 "
746 "cellpadding=0 width=100%%>\n"
750 for (a = 0; a < nummsgs; ++a) {
751 if ((WC->msgarr[a] >= startmsg) && (num_displayed < maxmsgs)) {
753 /* Learn which msgs "Prev" & "Next" buttons go to */
754 pn_current = WC->msgarr[a];
755 if (a > 0) pn_previous = WC->msgarr[a-1];
756 if (a < (nummsgs-1)) pn_next = WC->msgarr[a+1];
758 /* If a tabular view, set up the line */
759 if ( (is_summary) || (is_addressbook) ) {
761 wprintf("<TR BGCOLOR=%s>",
762 (bg ? "DDDDDD" : "FFFFFF")
766 /* Display the message */
768 summarize_message(WC->msgarr[a]);
770 else if (is_addressbook) {
771 display_addressbook(WC->msgarr[a], alpha);
774 read_message(WC->msgarr[a]);
777 /* If a tabular view, finish the line */
778 if ( (is_summary) || (is_addressbook) ) {
782 if (lowest_displayed < 0) lowest_displayed = a;
783 highest_displayed = a;
786 --remaining_messages;
791 wprintf("</TABLE>\n");
794 if (is_addressbook) {
795 wprintf("</TABLE>\n");
798 /* Bump these because although we're thinking in zero base, the user
799 * is a drooling idiot and is thinking in one base.
804 /* If we're only looking at one message, do a prev/next thing */
805 if (num_displayed == 1) {
808 "<TABLE BORDER=0 WIDTH=100%% BGCOLOR=DDDDDD><TR><TD>"
809 "Reading #%d of %d messages.</TD>\n"
810 "<TD ALIGN=RIGHT><FONT SIZE=+1>",
811 lowest_displayed, nummsgs);
814 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" "
815 "VALUE=\"Delete selected\">\n");
818 if (pn_previous > 0L) {
819 wprintf("<A HREF=\"/%s"
829 wprintf("<A HREF=\"/%s"
838 wprintf("<A HREF=\"/%s?startmsg=%ld"
839 "&maxmsgs=999999&summary=1\">"
845 wprintf("</TD></TR></TABLE></CENTER>\n");
850 * If we're not currently looking at ALL requested
851 * messages, then display the selector bar
853 if (num_displayed > 1) {
855 "<TABLE BORDER=0 WIDTH=100%% BGCOLOR=DDDDDD><TR><TD>"
856 "Reading #%d-%d of %d messages.</TD>\n"
857 "<TD ALIGN=RIGHT><FONT SIZE=+1>",
858 lowest_displayed, highest_displayed, nummsgs);
861 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" "
862 "VALUE=\"Delete selected\">\n");
866 for (b=0; b<nummsgs; b = b + maxmsgs) {
869 if (hi > nummsgs) hi = nummsgs;
870 if (WC->msgarr[b] != startmsg) {
871 wprintf("<A HREF=\"/%s"
883 wprintf("%d-%d \n", lo, hi);
887 wprintf("<A HREF=\"/%s?startmsg=%ld"
888 "&maxmsgs=999999&summary=%d\">"
892 WC->msgarr[0], is_summary);
894 wprintf("<A HREF=\"/%s?startmsg=%ld"
895 "&maxmsgs=999999&summary=1\">"
901 wprintf("</TD></TR></TABLE></CENTER>\n");
903 if (is_summary) wprintf("</FORM>\n");
905 DONE: wDumpContent(1);
912 * Post message (or don't post message)
914 * Note regarding the "dont_post" variable:
915 * A random value (actually, it's just a timestamp) is inserted as a hidden
916 * field called "postseq" when the display_enter page is generated. This
917 * value is checked when posting, using the static variable dont_post. If a
918 * user attempts to post twice using the same dont_post value, the message is
919 * discarded. This prevents the accidental double-saving of the same message
920 * if the user happens to click the browser "back" button.
922 void post_message(void)
925 static long dont_post = (-1L);
929 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\">");
930 strcpy(buf, bstr("sc"));
931 if (strcasecmp(buf, "Save message")) {
932 wprintf("Cancelled. Message was not posted.<BR>\n");
933 } else if (atol(bstr("postseq")) == dont_post) {
934 wprintf("Automatically cancelled because you have already "
935 "saved this message.<BR>\n");
937 sprintf(buf, "ENT0 1|%s|0|4|%s",
943 serv_puts("Content-type: text/html");
945 text_to_server(bstr("msgtext"), 1);
947 wprintf("Message has been posted.<BR>\n");
948 dont_post = atol(bstr("postseq"));
950 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
961 * display the message entry screen
963 void display_enter(void)
971 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\">");
973 sprintf(buf, "ENT0 0|%s|0|0", bstr("recp"));
977 if (!strncmp(buf, "570", 3)) {
978 if (strlen(bstr("recp")) > 0) {
979 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
981 do_template("prompt_for_recipient");
985 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
990 tm = (struct tm *) localtime(&now);
991 strcpy(buf, (char *) asctime(tm));
992 buf[strlen(buf) - 1] = 0;
993 strcpy(&buf[16], &buf[19]);
994 wprintf("</CENTER><FONT COLOR=\"440000\">\n"
995 "<IMG SRC=\"static/enter.gif\" ALIGN=MIDDLE ALT=\" \" "
996 "onLoad=\"document.enterform.msgtext.focus();\" >");
997 wprintf("<B> %s ", &buf[4]);
998 wprintf("from %s ", WC->wc_username);
999 if (strlen(bstr("recp")) > 0)
1000 wprintf("to %s ", bstr("recp"));
1001 wprintf("in %s> ", WC->wc_roomname);
1002 wprintf("</B></FONT><BR><CENTER>\n");
1004 wprintf("<FORM METHOD=\"POST\" ACTION=\"/post\" "
1005 "NAME=\"enterform\">\n");
1006 wprintf("<INPUT TYPE=\"hidden\" NAME=\"recp\" VALUE=\"%s\">\n",
1008 wprintf("<INPUT TYPE=\"hidden\" NAME=\"postseq\" VALUE=\"%ld\">\n",
1010 wprintf("<FONT SIZE=-1>Subject (optional):</FONT>"
1011 "<INPUT TYPE=\"text\" NAME=\"subject\" MAXLENGTH=70>"
1012 " "
1013 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save message\">"
1014 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
1016 wprintf("<TEXTAREA NAME=\"msgtext\" wrap=soft ROWS=30 COLS=80 "
1017 "WIDTH=80></TEXTAREA><P>\n");
1019 wprintf("</FORM></CENTER>\n");
1020 DONE: wDumpContent(1);
1031 void delete_msg(void)
1036 msgid = atol(bstr("msgid"));
1040 sprintf(buf, "DELE %ld", msgid);
1043 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
1052 * Confirm move of a message
1054 void confirm_move_msg(void)
1060 msgid = atol(bstr("msgid"));
1064 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
1065 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1066 wprintf("<B>Confirm move of message</B>\n");
1067 wprintf("</FONT></TD></TR></TABLE>\n");
1069 wprintf("<CENTER>");
1071 wprintf("Please select the room to which you would like this message moved:<BR>\n");
1073 wprintf("<FORM METHOD=\"POST\" ACTION=\"/move_msg\">\n");
1074 wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%s\">\n",
1078 wprintf("<SELECT NAME=\"target_room\" SIZE=5>\n");
1081 if (buf[0] == '1') {
1082 while (serv_gets(buf), strcmp(buf, "000")) {
1083 extract(targ, buf, 0);
1084 wprintf("<OPTION>");
1089 wprintf("</SELECT>\n");
1092 wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Move\">");
1093 wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Cancel\">");
1094 wprintf("</FORM></CENTER>\n");
1096 wprintf("</CENTER>\n");
1107 msgid = atol(bstr("msgid"));
1111 if (!strcasecmp(bstr("yesno"), "Move")) {
1112 sprintf(buf, "MOVE %ld|%s", msgid, bstr("target_room"));
1115 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
1117 wprintf("<EM>Message not moved.</EM><BR>\n");
1125 void do_stuff_to_msgs(void) {
1130 struct stuff_t *next;
1134 struct stuff_t *stuff = NULL;
1135 struct stuff_t *ptr;
1138 serv_puts("MSGS ALL");
1141 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
1142 ptr = malloc(sizeof(struct stuff_t));
1143 ptr->msgnum = atol(buf);
1148 strcpy(sc, bstr("sc"));
1150 while (stuff != NULL) {
1152 sprintf(buf, "msg_%ld", stuff->msgnum);
1153 if (!strcasecmp(bstr(buf), "yes")) {
1155 if (!strcasecmp(sc, "Delete selected")) {
1156 serv_printf("DELE %ld", stuff->msgnum);
1167 readloop("readfwd");