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 safestrncpy(urlbuf, &buf[start], end - start);
73 urlbuf[end - start] = 0;
75 safestrncpy(outbuf, buf, start);
76 sprintf(&outbuf[start], "%cA HREF=%c%s%c TARGET=%c%s%c%c%s%c/A%c",
77 LB, QU, urlbuf, QU, QU, TARGET, QU, RB, urlbuf, LB, RB);
78 strcat(outbuf, &buf[end]);
79 if ( strlen(outbuf) < 250 )
84 /* display_vcard() calls this after parsing the textual vCard into
85 * our 'struct vCard' data object.
87 * Set 'full' to nonzero to display the full card, otherwise it will only
88 * show a summary line.
90 void display_parsed_vcard(struct vCard *v, int full) {
97 name = vcard_get_prop(v, "n", 1, 0, 0);
109 wprintf("<TABLE bgcolor=#888888>");
110 if (v->numprops) for (i=0; i<(v->numprops); ++i) {
111 if (!strcasecmp(v->prop[i].name, "n")) {
112 wprintf("<TR BGCOLOR=#AAAAAA>"
113 "<TD BGCOLOR=#FFFFFF>"
114 "<IMG VALIGN=CENTER SRC=\"/static/vcard.gif\"></TD>"
115 "<TD><FONT SIZE=+1><B>");
116 escputs(v->prop[i].value);
117 wprintf("</B></FONT></TD></TR>\n");
119 else if (!strcasecmp(v->prop[i].name, "email;internet")) {
120 wprintf("<TR><TD>Internet e-mail:</TD>"
121 "<TD><A HREF=\"mailto:");
122 urlescputs(v->prop[i].value);
124 escputs(v->prop[i].value);
125 wprintf("</A></TD></TR>\n");
127 else if (!strcasecmp(v->prop[i].name, "adr")) {
128 wprintf("<TR><TD>Address:</TD><TD>");
129 for (j=0; j<num_tokens(v->prop[i].value, ';'); ++j) {
130 extract_token(buf, v->prop[i].value, j, ';');
131 if (strlen(buf) > 0) {
136 wprintf("</TD></TR>\n");
138 else if (!strncasecmp(v->prop[i].name, "tel;", 4)) {
139 wprintf("<TR><TD>%s telephone:</TD><TD>",
140 &v->prop[i].name[4]);
141 for (j=0; j<num_tokens(v->prop[i].value, ';'); ++j) {
142 extract_token(buf, v->prop[i].value, j, ';');
143 if (strlen(buf) > 0) {
148 wprintf("</TD></TR>\n");
152 escputs(v->prop[i].name);
153 wprintf("</TD><TD>");
154 escputs(v->prop[i].value);
155 wprintf("</TD></TR>\n");
158 wprintf("</TABLE>\n");
164 * Display a textual vCard
165 * (Converts to a vCard object and then calls the actual display function)
166 * Set 'full' to nonzero to display the whole card instead of a one-liner
168 void display_vcard(char *vcard_source, char alpha, int full) {
174 v = vcard_load(vcard_source);
175 if (v == NULL) return;
177 name = vcard_get_prop(v, "n", 1, 0, 0);
184 || ((isalpha(alpha)) && (tolower(alpha) == tolower(this_alpha)) )
185 || ((!isalpha(alpha)) && (!isalpha(this_alpha))) ) {
187 display_parsed_vcard(v, full);
199 void read_message(long msgnum) {
201 char mime_partnum[SIZ];
202 char mime_filename[SIZ];
203 char mime_content_type[SIZ];
204 char mime_disposition[SIZ];
206 char *mime_http = NULL;
216 char vcard_partnum[SIZ];
217 char *vcard_source = NULL;
222 strcpy(reply_to, "");
223 strcpy(vcard_partnum, "");
225 sprintf(buf, "MSG0 %ld", msgnum);
229 wprintf("<STRONG>ERROR:</STRONG> %s<BR>\n", &buf[4]);
233 wprintf("<TABLE WIDTH=100%% BORDER=0 CELLSPACING=0 "
234 "CELLPADDING=1 BGCOLOR=CCCCCC><TR><TD>\n");
238 wprintf("COLOR=\"000000\"> ");
239 strcpy(m_subject, "");
241 while (serv_gets(buf), strncasecmp(buf, "text", 4)) {
242 if (!strncasecmp(buf, "nhdr=yes", 8))
246 if (!strncasecmp(buf, "type=", 5))
247 format_type = atoi(&buf[5]);
248 if (!strncasecmp(buf, "from=", 5)) {
249 strcpy(from, &buf[5]);
250 wprintf("from <A HREF=\"/showuser&who=");
256 if (!strncasecmp(buf, "subj=", 5))
257 strcpy(m_subject, &buf[5]);
258 if ((!strncasecmp(buf, "hnod=", 5))
259 && (strcasecmp(&buf[5], serv_info.serv_humannode)))
260 wprintf("(%s) ", &buf[5]);
261 if ((!strncasecmp(buf, "room=", 5))
262 && (strcasecmp(&buf[5], WC->wc_roomname)))
263 wprintf("in %s> ", &buf[5]);
264 if (!strncasecmp(buf, "rfca=", 5)) {
265 strcpy(rfca, &buf[5]);
271 if (!strncasecmp(buf, "node=", 5)) {
272 if ( ((WC->room_flags & QR_NETWORK)
273 || ((strcasecmp(&buf[5], serv_info.serv_nodename)
274 && (strcasecmp(&buf[5], serv_info.serv_fqdn)))))
277 wprintf("@%s ", &buf[5]);
280 if (!strncasecmp(buf, "rcpt=", 5))
281 wprintf("to %s ", &buf[5]);
282 if (!strncasecmp(buf, "time=", 5)) {
283 fmt_date(now, atol(&buf[5]));
287 if (!strncasecmp(buf, "part=", 5)) {
288 extract(mime_filename, &buf[5], 1);
289 extract(mime_partnum, &buf[5], 2);
290 extract(mime_disposition, &buf[5], 3);
291 extract(mime_content_type, &buf[5], 4);
292 mime_length = extract_int(&buf[5], 5);
294 if (!strcasecmp(mime_disposition, "attachment")) {
295 if (mime_http == NULL) {
296 mime_http = malloc(512);
297 strcpy(mime_http, "");
300 mime_http = realloc(mime_http,
301 strlen(mime_http) + 512);
303 sprintf(&mime_http[strlen(mime_http)],
304 "<A HREF=\"/output_mimepart?"
305 "msgnum=%ld&partnum=%s\" "
306 "TARGET=\"wc.%ld.%s\">"
307 "<IMG SRC=\"/static/attachment.gif\" "
308 "BORDER=0 ALIGN=MIDDLE>\n"
309 "Part %s: %s (%s, %d bytes)</A><BR>\n",
310 msgnum, mime_partnum,
311 msgnum, mime_partnum,
312 mime_partnum, mime_filename,
313 mime_content_type, mime_length);
316 if ((!strcasecmp(mime_disposition, "inline"))
317 && (!strncasecmp(mime_content_type, "image/", 6)) ){
318 if (mime_http == NULL) {
319 mime_http = malloc(512);
320 strcpy(mime_http, "");
323 mime_http = realloc(mime_http,
324 strlen(mime_http) + 512);
326 sprintf(&mime_http[strlen(mime_http)],
327 "<IMG SRC=\"/output_mimepart?"
328 "msgnum=%ld&partnum=%s\">",
329 msgnum, mime_partnum);
332 if (!strcasecmp(mime_content_type, "text/x-vcard")) {
333 strcpy(vcard_partnum, mime_partnum);
341 /* Generate a reply-to address */
342 if (strlen(rfca) > 0) {
343 strcpy(reply_to, rfca);
346 if (strlen(node) > 0) {
347 snprintf(reply_to, sizeof(reply_to), "%s @ %s",
351 snprintf(reply_to, sizeof(reply_to), "%s", from);
359 wprintf("</FONT></TD>");
361 wprintf("<TD ALIGN=RIGHT>\n"
362 "<TABLE BORDER=0><TR>\n");
364 wprintf("<TD BGCOLOR=\"AAAADD\">"
365 "<A HREF=\"/readfwd?startmsg=%ld", msgnum);
366 wprintf("&maxmsgs=1&summary=0\">Read</A>"
369 wprintf("<TD BGCOLOR=\"AAAADD\">"
370 "<A HREF=\"/display_enter?recp=");
371 urlescputs(reply_to);
372 wprintf("\"><FONT SIZE=-1>Reply</FONT></A>"
375 if (WC->is_room_aide) {
376 wprintf("<TD BGCOLOR=\"AAAADD\">"
377 "<A HREF=\"/confirm_move_msg"
379 "\"><FONT SIZE=-1>Move</FONT></A>"
382 wprintf("<TD BGCOLOR=\"AAAADD\">"
383 "<A HREF=\"/delete_msg"
385 "onClick=\"return confirm('Delete this message?');\""
386 "><FONT SIZE=-1>Del</FONT></A>"
390 wprintf("</TR></TABLE>\n"
393 if (strlen(m_subject) > 0) {
394 wprintf("<TR><TD><FONT COLOR=\"0000FF\">"
396 "</TD><TD> </TD></TR>\n", m_subject);
399 wprintf("</TR></TABLE>\n");
401 if (format_type == 0) {
404 while (serv_gets(buf), strcmp(buf, "000")) {
405 while ((strlen(buf) > 0) && (isspace(buf[strlen(buf) - 1])))
406 buf[strlen(buf) - 1] = 0;
408 ((!strncmp(buf, ">", 1)) || (!strncmp(buf, " >", 2)) || (!strncmp(buf, " :-)", 4)))) {
409 wprintf("<FONT COLOR=\"000044\"><I>");
411 } else if ((bq == 1) &&
412 (strncmp(buf, ">", 1)) && (strncmp(buf, " >", 2)) && (strncmp(buf, " :-)", 4))) {
413 wprintf("</FONT></I>");
419 wprintf("</TT><BR>\n");
424 if (mime_http != NULL) {
425 wprintf("%s", mime_http);
429 if (strlen(vcard_partnum) > 0) {
430 vcard_source = load_mimepart(msgnum, vcard_partnum);
431 if (vcard_source != NULL) {
433 /* If it's my vCard I can edit it */
434 if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
435 || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
436 wprintf("<A HREF=\"/edit_vcard?"
437 "msgnum=%ld&partnum=%s\">",
438 msgnum, vcard_partnum);
439 wprintf("(edit)</A>");
442 /* In all cases, display the full card */
443 display_vcard(vcard_source, 0, 1);
451 void summarize_message(long msgnum) {
462 memset(&summ, 0, sizeof(summ));
463 strcpy(summ.subj, "(no subject)");
465 sprintf(buf, "MSG0 %ld|1", msgnum); /* ask for headers only */
468 if (buf[0] != '1') return;
470 while (serv_gets(buf), strcmp(buf, "000")) {
471 if (!strncasecmp(buf, "from=", 5)) {
472 strcpy(summ.from, &buf[5]);
474 if (!strncasecmp(buf, "subj=", 5)) {
475 strcpy(summ.subj, &buf[5]);
477 if (!strncasecmp(buf, "rfca=", 5)) {
478 strcat(summ.from, " <");
479 strcat(summ.from, &buf[5]);
480 strcat(summ.from, ">");
483 if (!strncasecmp(buf, "node=", 5)) {
484 if ( ((WC->room_flags & QR_NETWORK)
485 || ((strcasecmp(&buf[5], serv_info.serv_nodename)
486 && (strcasecmp(&buf[5], serv_info.serv_fqdn)))))
488 strcat(summ.from, " @ ");
489 strcat(summ.from, &buf[5]);
493 if (!strncasecmp(buf, "rcpt=", 5)) {
494 strcpy(summ.to, &buf[5]);
497 if (!strncasecmp(buf, "time=", 5)) {
498 fmt_date(summ.date, atol(&buf[5]));
502 wprintf("<TD><A HREF=\"/readfwd?startmsg=%ld"
503 "&maxmsgs=1&summary=0\">",
506 wprintf("</A></TD><TD>");
508 wprintf(" </TD><TD>");
512 "<INPUT TYPE=\"checkbox\" NAME=\"msg_%ld\" VALUE=\"yes\">"
520 void display_addressbook(long msgnum, char alpha) {
522 char mime_partnum[SIZ];
523 char mime_filename[SIZ];
524 char mime_content_type[SIZ];
525 char mime_disposition[SIZ];
527 char vcard_partnum[SIZ];
528 char *vcard_source = NULL;
538 memset(&summ, 0, sizeof(summ));
539 strcpy(summ.subj, "(no subject)");
541 sprintf(buf, "MSG0 %ld|1", msgnum); /* ask for headers only */
544 if (buf[0] != '1') return;
546 while (serv_gets(buf), strcmp(buf, "000")) {
547 if (!strncasecmp(buf, "part=", 5)) {
548 extract(mime_filename, &buf[5], 1);
549 extract(mime_partnum, &buf[5], 2);
550 extract(mime_disposition, &buf[5], 3);
551 extract(mime_content_type, &buf[5], 4);
552 mime_length = extract_int(&buf[5], 5);
554 if (!strcasecmp(mime_content_type, "text/x-vcard")) {
555 strcpy(vcard_partnum, mime_partnum);
561 if (strlen(vcard_partnum) > 0) {
562 vcard_source = load_mimepart(msgnum, vcard_partnum);
563 if (vcard_source != NULL) {
565 /* Display the summary line */
566 display_vcard(vcard_source, alpha, 0);
568 /* If it's my vCard I can edit it */
569 if ( (!strcasecmp(WC->wc_roomname, USERCONFIGROOM))
570 || (!strcasecmp(&WC->wc_roomname[11], USERCONFIGROOM))) {
571 wprintf("<A HREF=\"/edit_vcard?"
572 "msgnum=%ld&partnum=%s\">",
573 msgnum, vcard_partnum);
574 wprintf("(edit)</A>");
586 * load message pointers from the server
588 int load_msg_ptrs(servcmd)
598 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
601 while (serv_gets(buf), strcmp(buf, "000")) {
602 WC->msgarr[nummsgs] = atol(buf);
610 * command loop for reading messages
612 void readloop(char *oper)
620 int num_displayed = 0;
622 int is_addressbook = 0;
623 int remaining_messages;
625 int lowest_displayed = (-1);
626 int highest_displayed = 0;
627 long pn_previous = 0L;
628 long pn_current = 0L;
633 startmsg = atol(bstr("startmsg"));
634 maxmsgs = atoi(bstr("maxmsgs"));
635 is_summary = atoi(bstr("summary"));
636 if (maxmsgs == 0) maxmsgs = 20;
640 if (!strcmp(oper, "readnew")) {
641 strcpy(cmd, "MSGS NEW");
642 } else if (!strcmp(oper, "readold")) {
643 strcpy(cmd, "MSGS OLD");
645 strcpy(cmd, "MSGS ALL");
648 /* FIXME put in the correct constant #defs */
649 if ((WC->wc_view == 1) && (maxmsgs > 1)) {
651 strcpy(cmd, "MSGS ALL");
654 if ((WC->wc_view == 2) && (maxmsgs > 1)) {
656 strcpy(cmd, "MSGS ALL");
658 if (bstr("alpha") == NULL) {
662 strcpy(buf, bstr("alpha"));
666 for (i='A'; i<='Z'; ++i) {
667 if (i == alpha) wprintf("<FONT SIZE=+2>"
670 wprintf("<A HREF=\"/readfwd?alpha=%c\">"
675 if (!isalpha(alpha)) wprintf("<FONT SIZE=+2>(other)</FONT>\n");
676 else wprintf("<A HREF=\"/readfwd?alpha=1\">(other)</A>\n");
677 wprintf("<HR width=100%%>\n");
680 nummsgs = load_msg_ptrs(cmd);
682 if (!strcmp(oper, "readnew")) {
683 wprintf("<EM>No new messages in this room.</EM>\n");
684 } else if (!strcmp(oper, "readold")) {
685 wprintf("<EM>No old messages in this room.</EM>\n");
687 wprintf("<EM>This room is empty.</EM>\n");
692 if (startmsg == 0L) startmsg = WC->msgarr[0];
693 remaining_messages = 0;
695 for (a = 0; a < nummsgs; ++a) {
696 if (WC->msgarr[a] >= startmsg) {
697 ++remaining_messages;
702 wprintf("<FORM METHOD=\"POST\" ACTION=\"/do_stuff_to_msgs\">\n"
703 "<TABLE border=0 cellspacing=0 "
704 "cellpadding=0 width=100%%>\n"
706 "<TD><I>Subject</I></TD>"
707 "<TD><I>Sender</I></TD>"
708 "<TD><I>Date</I></TD>"
714 if (is_addressbook) {
715 wprintf("<TABLE border=0 cellspacing=0 "
716 "cellpadding=0 width=100%%>\n"
720 for (a = 0; a < nummsgs; ++a) {
721 if ((WC->msgarr[a] >= startmsg) && (num_displayed < maxmsgs)) {
723 /* Learn which msgs "Prev" & "Next" buttons go to */
724 pn_current = WC->msgarr[a];
725 if (a > 0) pn_previous = WC->msgarr[a-1];
726 if (a < (nummsgs-1)) pn_next = WC->msgarr[a+1];
728 /* If a tabular view, set up the line */
729 if ( (is_summary) || (is_addressbook) ) {
731 wprintf("<TR BGCOLOR=%s>",
732 (bg ? "DDDDDD" : "FFFFFF")
736 /* Display the message */
738 summarize_message(WC->msgarr[a]);
740 else if (is_addressbook) {
741 display_addressbook(WC->msgarr[a], alpha);
744 read_message(WC->msgarr[a]);
747 /* If a tabular view, finish the line */
748 if ( (is_summary) || (is_addressbook) ) {
752 if (lowest_displayed < 0) lowest_displayed = a;
753 highest_displayed = a;
756 --remaining_messages;
761 wprintf("</TABLE>\n");
764 if (is_addressbook) {
765 wprintf("</TABLE>\n");
768 /* Bump these because although we're thinking in zero base, the user
769 * is a drooling idiot and is thinking in one base.
774 /* If we're only looking at one message, do a prev/next thing */
775 if (num_displayed == 1) {
778 "<TABLE BORDER=0 WIDTH=100%% BGCOLOR=DDDDDD><TR><TD>"
779 "Reading #%d of %d messages.</TD>\n"
780 "<TD ALIGN=RIGHT><FONT SIZE=+1>",
781 lowest_displayed, nummsgs);
784 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" "
785 "VALUE=\"Delete selected\">\n");
788 if (pn_previous > 0L) {
789 wprintf("<A HREF=\"/%s"
799 wprintf("<A HREF=\"/%s"
808 wprintf("<A HREF=\"/%s?startmsg=%ld"
809 "&maxmsgs=999999&summary=1\">"
815 wprintf("</TD></TR></TABLE></CENTER>\n");
820 * If we're not currently looking at ALL requested
821 * messages, then display the selector bar
823 if (num_displayed > 1) {
825 "<TABLE BORDER=0 WIDTH=100%% BGCOLOR=DDDDDD><TR><TD>"
826 "Reading #%d-%d of %d messages.</TD>\n"
827 "<TD ALIGN=RIGHT><FONT SIZE=+1>",
828 lowest_displayed, highest_displayed, nummsgs);
831 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" "
832 "VALUE=\"Delete selected\">\n");
836 for (b=0; b<nummsgs; b = b + maxmsgs) {
839 if (hi > nummsgs) hi = nummsgs;
840 if (WC->msgarr[b] != startmsg) {
841 wprintf("<A HREF=\"/%s"
853 wprintf("%d-%d \n", lo, hi);
857 wprintf("<A HREF=\"/%s?startmsg=%ld"
858 "&maxmsgs=999999&summary=%d\">"
862 WC->msgarr[0], is_summary);
864 wprintf("<A HREF=\"/%s?startmsg=%ld"
865 "&maxmsgs=999999&summary=1\">"
871 wprintf("</TD></TR></TABLE></CENTER>\n");
873 if (is_summary) wprintf("</FORM>\n");
875 DONE: wDumpContent(1);
882 * Post message (or don't post message)
884 * Note regarding the "dont_post" variable:
885 * A random value (actually, it's just a timestamp) is inserted as a hidden
886 * field called "postseq" when the display_enter page is generated. This
887 * value is checked when posting, using the static variable dont_post. If a
888 * user attempts to post twice using the same dont_post value, the message is
889 * discarded. This prevents the accidental double-saving of the same message
890 * if the user happens to click the browser "back" button.
892 void post_message(void)
895 static long dont_post = (-1L);
899 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\">");
900 strcpy(buf, bstr("sc"));
901 if (strcasecmp(buf, "Save message")) {
902 wprintf("Cancelled. Message was not posted.<BR>\n");
903 } else if (atol(bstr("postseq")) == dont_post) {
904 wprintf("Automatically cancelled because you have already "
905 "saved this message.<BR>\n");
907 sprintf(buf, "ENT0 1|%s|0|0|%s",
913 text_to_server(bstr("msgtext"));
915 wprintf("Message has been posted.<BR>\n");
916 dont_post = atol(bstr("postseq"));
918 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
929 * display the message entry screen
931 void display_enter(void)
939 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\">");
941 sprintf(buf, "ENT0 0|%s|0|0", bstr("recp"));
945 if (!strncmp(buf, "570", 3)) {
946 if (strlen(bstr("recp")) > 0) {
947 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
949 do_template("prompt_for_recipient");
953 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
958 tm = (struct tm *) localtime(&now);
959 strcpy(buf, (char *) asctime(tm));
960 buf[strlen(buf) - 1] = 0;
961 strcpy(&buf[16], &buf[19]);
962 wprintf("</CENTER><FONT COLOR=\"440000\">\n"
963 "<IMG SRC=\"static/enter.gif\" ALIGN=MIDDLE ALT=\" \" "
964 "onLoad=\"document.enterform.msgtext.focus();\" >");
965 wprintf("<B> %s ", &buf[4]);
966 wprintf("from %s ", WC->wc_username);
967 if (strlen(bstr("recp")) > 0)
968 wprintf("to %s ", bstr("recp"));
969 wprintf("in %s> ", WC->wc_roomname);
970 wprintf("</B></FONT><BR><CENTER>\n");
972 wprintf("<FORM METHOD=\"POST\" ACTION=\"/post\" "
973 "NAME=\"enterform\">\n");
974 wprintf("<INPUT TYPE=\"hidden\" NAME=\"recp\" VALUE=\"%s\">\n",
976 wprintf("<INPUT TYPE=\"hidden\" NAME=\"postseq\" VALUE=\"%ld\">\n",
978 wprintf("<FONT SIZE=-1>Subject (optional):</FONT>"
979 "<INPUT TYPE=\"text\" NAME=\"subject\" MAXLENGTH=70>"
981 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Save message\">"
982 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\"><BR>\n");
984 wprintf("<TEXTAREA NAME=\"msgtext\" wrap=soft ROWS=30 COLS=80 "
985 "WIDTH=80></TEXTAREA><P>\n");
987 wprintf("</FORM></CENTER>\n");
988 DONE: wDumpContent(1);
999 void delete_msg(void)
1004 msgid = atol(bstr("msgid"));
1008 sprintf(buf, "DELE %ld", msgid);
1011 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
1020 * Confirm move of a message
1022 void confirm_move_msg(void)
1028 msgid = atol(bstr("msgid"));
1032 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
1033 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1034 wprintf("<B>Confirm move of message</B>\n");
1035 wprintf("</FONT></TD></TR></TABLE>\n");
1037 wprintf("<CENTER>");
1039 wprintf("Please select the room to which you would like this message moved:<BR>\n");
1041 wprintf("<FORM METHOD=\"POST\" ACTION=\"/move_msg\">\n");
1042 wprintf("<INPUT TYPE=\"hidden\" NAME=\"msgid\" VALUE=\"%s\">\n",
1046 wprintf("<SELECT NAME=\"target_room\" SIZE=5>\n");
1049 if (buf[0] == '1') {
1050 while (serv_gets(buf), strcmp(buf, "000")) {
1051 extract(targ, buf, 0);
1052 wprintf("<OPTION>");
1057 wprintf("</SELECT>\n");
1060 wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Move\">");
1061 wprintf("<INPUT TYPE=\"submit\" NAME=\"yesno\" VALUE=\"Cancel\">");
1062 wprintf("</FORM></CENTER>\n");
1064 wprintf("</CENTER>\n");
1075 msgid = atol(bstr("msgid"));
1079 if (!strcasecmp(bstr("yesno"), "Move")) {
1080 sprintf(buf, "MOVE %ld|%s", msgid, bstr("target_room"));
1083 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
1085 wprintf("<EM>Message not moved.</EM><BR>\n");
1093 void do_stuff_to_msgs(void) {
1098 struct stuff_t *next;
1102 struct stuff_t *stuff = NULL;
1103 struct stuff_t *ptr;
1106 serv_puts("MSGS ALL");
1109 if (buf[0] == '1') while (serv_gets(buf), strcmp(buf, "000")) {
1110 ptr = malloc(sizeof(struct stuff_t));
1111 ptr->msgnum = atol(buf);
1116 strcpy(sc, bstr("sc"));
1118 while (stuff != NULL) {
1120 sprintf(buf, "msg_%ld", stuff->msgnum);
1121 if (!strcasecmp(bstr(buf), "yes")) {
1123 if (!strcasecmp(sc, "Delete selected")) {
1124 serv_printf("DELE %ld", stuff->msgnum);
1135 readloop("readfwd");