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>
31 * Look for URL's embedded in a buffer and make them linkable. We use a
32 * target window in order to keep the BBS session in its own window.
48 for (pos = 0; pos < strlen(buf); ++pos) {
49 if (!strncasecmp(&buf[pos], "http://", 7))
51 if (!strncasecmp(&buf[pos], "ftp://", 6))
58 if ((start > 0) && (buf[start - 1] == '<'))
60 if ((start > 0) && (buf[start - 1] == '['))
62 if ((start > 0) && (buf[start - 1] == '('))
64 if ((start > 0) && (buf[start - 1] == '{'))
67 for (pos = strlen(buf); pos > start; --pos) {
68 if ((buf[pos] == ' ') || (buf[pos] == ench))
72 strncpy(urlbuf, &buf[start], end - start);
73 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);
200 void read_message(long msgnum) {
202 char mime_partnum[SIZ];
203 char mime_filename[SIZ];
204 char mime_content_type[SIZ];
205 char mime_disposition[SIZ];
207 char *mime_http = NULL;
217 char vcard_partnum[SIZ];
218 char *vcard_source = NULL;
223 strcpy(reply_to, "");
224 strcpy(vcard_partnum, "");
226 sprintf(buf, "MSG0 %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), strncasecmp(buf, "text", 4)) {
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");
402 if (format_type == 0) {
405 while (serv_gets(buf), strcmp(buf, "000")) {
406 while ((strlen(buf) > 0) && (isspace(buf[strlen(buf) - 1])))
407 buf[strlen(buf) - 1] = 0;
409 ((!strncmp(buf, ">", 1)) || (!strncmp(buf, " >", 2)) || (!strncmp(buf, " :-)", 4)))) {
410 wprintf("<FONT COLOR=\"000044\"><I>");
412 } else if ((bq == 1) &&
413 (strncmp(buf, ">", 1)) && (strncmp(buf, " >", 2)) && (strncmp(buf, " :-)", 4))) {
414 wprintf("</FONT></I>");
420 wprintf("</TT><BR>\n");
425 if (mime_http != NULL) {
426 wprintf("%s", mime_http);
430 if (strlen(vcard_partnum) > 0) {
431 vcard_source = load_mimepart(msgnum, vcard_partnum);
432 if (vcard_source != NULL) {
434 /* If it's my vCard I can edit it */
435 if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
436 || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
437 wprintf("<A HREF=\"/edit_vcard?"
438 "msgnum=%ld&partnum=%s\">",
439 msgnum, vcard_partnum);
440 wprintf("(edit)</A>");
443 /* In all cases, display the full card */
444 display_vcard(vcard_source, 0, 1);
452 void summarize_message(long msgnum) {
463 memset(&summ, 0, sizeof(summ));
464 strcpy(summ.subj, "(no subject)");
466 sprintf(buf, "MSG0 %ld|1", msgnum); /* ask for headers only */
469 if (buf[0] != '1') return;
471 while (serv_gets(buf), strcmp(buf, "000")) {
472 if (!strncasecmp(buf, "from=", 5)) {
473 strcpy(summ.from, &buf[5]);
475 if (!strncasecmp(buf, "subj=", 5)) {
476 strcpy(summ.subj, &buf[5]);
478 if (!strncasecmp(buf, "rfca=", 5)) {
479 strcat(summ.from, " <");
480 strcat(summ.from, &buf[5]);
481 strcat(summ.from, ">");
484 if (!strncasecmp(buf, "node=", 5)) {
485 if ( ((WC->room_flags & QR_NETWORK)
486 || ((strcasecmp(&buf[5], serv_info.serv_nodename)
487 && (strcasecmp(&buf[5], serv_info.serv_fqdn)))))
489 strcat(summ.from, " @ ");
490 strcat(summ.from, &buf[5]);
494 if (!strncasecmp(buf, "rcpt=", 5)) {
495 strcpy(summ.to, &buf[5]);
498 if (!strncasecmp(buf, "time=", 5)) {
499 fmt_date(summ.date, atol(&buf[5]));
503 wprintf("<TD><A HREF=\"/readfwd?startmsg=%ld"
504 "&maxmsgs=1&summary=0\">",
507 wprintf("</A></TD><TD>");
509 wprintf(" </TD><TD>");
513 "<INPUT TYPE=\"checkbox\" NAME=\"msg_%ld\" VALUE=\"yes\">"
521 void display_addressbook(long msgnum, char alpha) {
523 char mime_partnum[SIZ];
524 char mime_filename[SIZ];
525 char mime_content_type[SIZ];
526 char mime_disposition[SIZ];
528 char vcard_partnum[SIZ];
529 char *vcard_source = NULL;
539 memset(&summ, 0, sizeof(summ));
540 strcpy(summ.subj, "(no subject)");
542 sprintf(buf, "MSG0 %ld|1", msgnum); /* ask for headers only */
545 if (buf[0] != '1') return;
547 while (serv_gets(buf), strcmp(buf, "000")) {
548 if (!strncasecmp(buf, "part=", 5)) {
549 extract(mime_filename, &buf[5], 1);
550 extract(mime_partnum, &buf[5], 2);
551 extract(mime_disposition, &buf[5], 3);
552 extract(mime_content_type, &buf[5], 4);
553 mime_length = extract_int(&buf[5], 5);
555 if (!strcasecmp(mime_content_type, "text/x-vcard")) {
556 strcpy(vcard_partnum, mime_partnum);
562 if (strlen(vcard_partnum) > 0) {
563 vcard_source = load_mimepart(msgnum, vcard_partnum);
564 if (vcard_source != NULL) {
566 /* Display the summary line */
567 display_vcard(vcard_source, alpha, 0);
569 /* If it's my vCard I can edit it */
570 if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
571 || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
572 wprintf("<A HREF=\"/edit_vcard?"
573 "msgnum=%ld&partnum=%s\">",
574 msgnum, vcard_partnum);
575 wprintf("(edit)</A>");
587 * load message pointers from the server
589 int load_msg_ptrs(servcmd)
599 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
602 while (serv_gets(buf), strcmp(buf, "000")) {
603 WC->msgarr[nummsgs] = atol(buf);
611 * command loop for reading messages
613 void readloop(char *oper)
621 int num_displayed = 0;
623 int is_addressbook = 0;
624 int remaining_messages;
626 int lowest_displayed = (-1);
627 int highest_displayed = 0;
628 long pn_previous = 0L;
629 long pn_current = 0L;
634 startmsg = atol(bstr("startmsg"));
635 maxmsgs = atoi(bstr("maxmsgs"));
636 is_summary = atoi(bstr("summary"));
637 if (maxmsgs == 0) maxmsgs = 20;
641 if (!strcmp(oper, "readnew")) {
642 strcpy(cmd, "MSGS NEW");
643 } else if (!strcmp(oper, "readold")) {
644 strcpy(cmd, "MSGS OLD");
646 strcpy(cmd, "MSGS ALL");
649 /* FIXME put in the correct constant #defs */
650 if ((WC->wc_view == 1) && (maxmsgs > 1)) {
652 strcpy(cmd, "MSGS ALL");
655 if ((WC->wc_view == 2) && (maxmsgs > 1)) {
657 strcpy(cmd, "MSGS ALL");
659 if (bstr("alpha") == NULL) {
663 strcpy(buf, bstr("alpha"));
667 for (i='A'; i<='Z'; ++i) {
668 if (i == alpha) wprintf("<FONT SIZE=+2>"
671 wprintf("<A HREF=\"/readfwd?alpha=%c\">"
676 if (!isalpha(alpha)) wprintf("<FONT SIZE=+2>(other)</FONT>\n");
677 else wprintf("<A HREF=\"/readfwd?alpha=1\">(other)</A>\n");
678 wprintf("<HR width=100%%>\n");
681 nummsgs = load_msg_ptrs(cmd);
683 if (!strcmp(oper, "readnew")) {
684 wprintf("<EM>No new messages in this room.</EM>\n");
685 } else if (!strcmp(oper, "readold")) {
686 wprintf("<EM>No old messages in this room.</EM>\n");
688 wprintf("<EM>This room is empty.</EM>\n");
693 if (startmsg == 0L) startmsg = WC->msgarr[0];
694 remaining_messages = 0;
696 for (a = 0; a < nummsgs; ++a) {
697 if (WC->msgarr[a] >= startmsg) {
698 ++remaining_messages;
703 wprintf("<FORM METHOD=\"POST\" ACTION=\"/do_stuff_to_msgs\">\n"
704 "<TABLE border=0 cellspacing=0 "
705 "cellpadding=0 width=100%%>\n"
707 "<TD><I>Subject</I></TD>"
708 "<TD><I>Sender</I></TD>"
709 "<TD><I>Date</I></TD>"
715 if (is_addressbook) {
716 wprintf("<TABLE border=0 cellspacing=0 "
717 "cellpadding=0 width=100%%>\n"
721 for (a = 0; a < nummsgs; ++a) {
722 if ((WC->msgarr[a] >= startmsg) && (num_displayed < maxmsgs)) {
724 /* Learn which msgs "Prev" & "Next" buttons go to */
725 pn_current = WC->msgarr[a];
726 if (a > 0) pn_previous = WC->msgarr[a-1];
727 if (a < (nummsgs-1)) pn_next = WC->msgarr[a+1];
729 /* If a tabular view, set up the line */
730 if ( (is_summary) || (is_addressbook) ) {
732 wprintf("<TR BGCOLOR=%s>",
733 (bg ? "DDDDDD" : "FFFFFF")
737 /* Display the message */
739 summarize_message(WC->msgarr[a]);
741 else if (is_addressbook) {
742 display_addressbook(WC->msgarr[a], alpha);
745 read_message(WC->msgarr[a]);
748 /* If a tabular view, finish the line */
749 if ( (is_summary) || (is_addressbook) ) {
753 if (lowest_displayed < 0) lowest_displayed = a;
754 highest_displayed = a;
757 --remaining_messages;
762 wprintf("</TABLE>\n");
765 if (is_addressbook) {
766 wprintf("</TABLE>\n");
769 /* Bump these because although we're thinking in zero base, the user
770 * is a drooling idiot and is thinking in one base.
775 /* If we're only looking at one message, do a prev/next thing */
776 if (num_displayed == 1) {
779 "<TABLE BORDER=0 WIDTH=100%% BGCOLOR=DDDDDD><TR><TD>"
780 "Reading #%d of %d messages.</TD>\n"
781 "<TD ALIGN=RIGHT><FONT SIZE=+1>",
782 lowest_displayed, nummsgs);
785 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" "
786 "VALUE=\"Delete selected\">\n");
789 if (pn_previous > 0L) {
790 wprintf("<A HREF=\"/%s"
800 wprintf("<A HREF=\"/%s"
809 wprintf("<A HREF=\"/%s?startmsg=%ld"
810 "&maxmsgs=999999&summary=1\">"
816 wprintf("</TD></TR></TABLE></CENTER>\n");
821 * If we're not currently looking at ALL requested
822 * messages, then display the selector bar
824 if (num_displayed > 1) {
826 "<TABLE BORDER=0 WIDTH=100%% BGCOLOR=DDDDDD><TR><TD>"
827 "Reading #%d-%d of %d messages.</TD>\n"
828 "<TD ALIGN=RIGHT><FONT SIZE=+1>",
829 lowest_displayed, highest_displayed, nummsgs);
832 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" "
833 "VALUE=\"Delete selected\">\n");
837 for (b=0; b<nummsgs; b = b + maxmsgs) {
840 if (hi > nummsgs) hi = nummsgs;
841 if (WC->msgarr[b] != startmsg) {
842 wprintf("<A HREF=\"/%s"
854 wprintf("%d-%d \n", lo, hi);
858 wprintf("<A HREF=\"/%s?startmsg=%ld"
859 "&maxmsgs=999999&summary=%d\">"
863 WC->msgarr[0], is_summary);
865 wprintf("<A HREF=\"/%s?startmsg=%ld"
866 "&maxmsgs=999999&summary=1\">"
872 wprintf("</TD></TR></TABLE></CENTER>\n");
874 if (is_summary) wprintf("</FORM>\n");
876 DONE: wDumpContent(1);
883 * Post message (or don't post message)
885 * Note regarding the "dont_post" variable:
886 * A random value (actually, it's just a timestamp) is inserted as a hidden
887 * field called "postseq" when the display_enter page is generated. This
888 * value is checked when posting, using the static variable dont_post. If a
889 * user attempts to post twice using the same dont_post value, the message is
890 * discarded. This prevents the accidental double-saving of the same message
891 * if the user happens to click the browser "back" button.
893 void post_message(void)
896 static long dont_post = (-1L);
900 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\">");
901 strcpy(buf, bstr("sc"));
902 if (strcasecmp(buf, "Save message")) {
903 wprintf("Cancelled. Message was not posted.<BR>\n");
904 } else if (atol(bstr("postseq")) == dont_post) {
905 wprintf("Automatically cancelled because you have already "
906 "saved this message.<BR>\n");
908 sprintf(buf, "ENT0 1|%s|0|0|%s",
914 text_to_server(bstr("msgtext"));
916 wprintf("Message has been posted.<BR>\n");
917 dont_post = atol(bstr("postseq"));
919 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
930 * display the message entry screen
932 void display_enter(void)
940 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\">");
942 sprintf(buf, "ENT0 0|%s|0|0", bstr("recp"));
946 if (!strncmp(buf, "570", 3)) {
947 if (strlen(bstr("recp")) > 0) {
948 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
950 do_template("prompt_for_recipient");
954 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
959 tm = (struct tm *) localtime(&now);
960 strcpy(buf, (char *) asctime(tm));
961 buf[strlen(buf) - 1] = 0;
962 strcpy(&buf[16], &buf[19]);
963 wprintf("</CENTER><FONT COLOR=\"440000\">\n"
964 "<IMG SRC=\"static/enter.gif\" ALIGN=MIDDLE ALT=\" \" "
965 "onLoad=\"document.enterform.msgtext.focus();\" >");
966 wprintf("<B> %s ", &buf[4]);
967 wprintf("from %s ", WC->wc_username);
968 if (strlen(bstr("recp")) > 0)
969 wprintf("to %s ", bstr("recp"));
970 wprintf("in %s> ", WC->wc_roomname);
971 wprintf("</B></FONT><BR><CENTER>\n");
973 wprintf("<FORM METHOD=\"POST\" ACTION=\"/post\" "
974 "NAME=\"enterform\">\n");
975 wprintf("<INPUT TYPE=\"hidden\" NAME=\"recp\" VALUE=\"%s\">\n",
977 wprintf("<INPUT TYPE=\"hidden\" NAME=\"postseq\" VALUE=\"%ld\">\n",
979 wprintf("<FONT SIZE=-1>Subject (optional):</FONT>"
980 "<INPUT TYPE=\"text\" NAME=\"subject\" MAXLENGTH=70>"
982 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save message\">"
983 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
985 wprintf("<TEXTAREA NAME=\"msgtext\" wrap=soft ROWS=30 COLS=80 "
986 "WIDTH=80></TEXTAREA><P>\n");
988 wprintf("</FORM></CENTER>\n");
989 DONE: wDumpContent(1);
1000 void delete_msg(void)
1005 msgid = atol(bstr("msgid"));
1009 sprintf(buf, "DELE %ld", msgid);
1012 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
1021 * Confirm move of a message
1023 void confirm_move_msg(void)
1029 msgid = atol(bstr("msgid"));
1033 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
1034 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1035 wprintf("<B>Confirm move of message</B>\n");
1036 wprintf("</FONT></TD></TR></TABLE>\n");
1038 wprintf("<CENTER>");
1040 wprintf("Please select the room to which you would like this message moved:<BR>\n");
1042 wprintf("<FORM METHOD=\"POST\" ACTION=\"/move_msg\">\n");
1043 wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%s\">\n",
1047 wprintf("<SELECT NAME=\"target_room\" SIZE=5>\n");
1050 if (buf[0] == '1') {
1051 while (serv_gets(buf), strcmp(buf, "000")) {
1052 extract(targ, buf, 0);
1053 wprintf("<OPTION>");
1058 wprintf("</SELECT>\n");
1061 wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Move\">");
1062 wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Cancel\">");
1063 wprintf("</FORM></CENTER>\n");
1065 wprintf("</CENTER>\n");
1076 msgid = atol(bstr("msgid"));
1080 if (!strcasecmp(bstr("yesno"), "Move")) {
1081 sprintf(buf, "MOVE %ld|%s", msgid, bstr("target_room"));
1084 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
1086 wprintf("<EM>Message not moved.</EM><BR>\n");
1094 void do_stuff_to_msgs(void) {
1099 struct stuff_t *next;
1103 struct stuff_t *stuff = NULL;
1104 struct stuff_t *ptr;
1107 serv_puts("MSGS ALL");
1110 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
1111 ptr = malloc(sizeof(struct stuff_t));
1112 ptr->msgnum = atol(buf);
1117 strcpy(sc, bstr("sc"));
1119 while (stuff != NULL) {
1121 sprintf(buf, "msg_%ld", stuff->msgnum);
1122 if (!strcasecmp(bstr(buf), "yes")) {
1124 if (!strcasecmp(sc, "Delete selected")) {
1125 serv_printf("DELE %ld", stuff->msgnum);
1136 readloop("readfwd");