10 #include <sys/types.h>
15 * This struct holds a list of rooms for <G>oto operations.
25 * This struct holds a list of rooms for client display.
29 struct roomlisting *lnext;
30 struct roomlisting *rnext;
38 char floorlist[128][256];
45 struct march *march = NULL;
48 * load the list of floors
50 void load_floorlist(void)
55 for (a = 0; a < 128; ++a)
61 strcpy(floorlist[0], "Main Floor");
64 while (serv_gets(buf), strcmp(buf, "000")) {
65 extract(floorlist[extract_int(buf, 0)], buf, 1);
71 * remove a room from the march list
73 void remove_march(char *aaa)
75 struct march *mptr, *mptr2;
80 if (!strcasecmp(march->march_name, aaa)) {
87 for (mptr = march; mptr != NULL; mptr = mptr->next) {
88 if (!strcasecmp(mptr->march_name, aaa)) {
89 mptr2->next = mptr->next;
102 void room_tree_list(struct roomlisting *rp)
110 if (rp->lnext != NULL) {
111 room_tree_list(rp->lnext);
113 strcpy(rmname, rp->rlname);
116 wprintf("<A HREF=\"/dotgoto&room=");
120 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
122 else if (f & QR_DIRECTORY)
124 else if (f & QR_NETWORK)
128 wprintf("</A><TT> </TT>\n");
130 if (rp->rnext != NULL) {
131 room_tree_list(rp->rnext);
138 * Room ordering stuff (compare first by floor, then by order)
140 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
142 if ((r1 == NULL) && (r2 == NULL))
148 if (r1->rlfloor < r2->rlfloor)
150 if (r1->rlfloor > r2->rlfloor)
152 if (r1->rlorder < r2->rlorder)
154 if (r1->rlorder > r2->rlorder)
161 * Common code for all room listings
163 void listrms(char *variety)
167 struct roomlisting *rl = NULL;
168 struct roomlisting *rp;
169 struct roomlisting *rs;
172 /* Ask the server for a room list */
177 while (serv_gets(buf), strcmp(buf, "000")) {
178 rp = malloc(sizeof(struct roomlisting));
179 extract(rp->rlname, buf, 0);
180 rp->rlflags = extract_int(buf, 1);
181 rp->rlfloor = extract_int(buf, 2);
182 rp->rlorder = extract_int(buf, 3);
191 if (rordercmp(rp, rs) < 0) {
192 if (rs->lnext == NULL) {
199 if (rs->rnext == NULL) {
221 * list all rooms by floor
223 void list_all_rooms_by_floor(void)
230 printf("HTTP/1.0 200 OK\n");
231 output_headers(1, "bottom");
233 wprintf("<TABLE width=100% border><TR><TH>Floor</TH>");
234 wprintf("<TH>Rooms with new messages</TH>");
235 wprintf("<TH>Rooms with no new messages</TH></TR>\n");
237 for (a = 0; a < 128; ++a)
238 if (floorlist[a][0] != 0) {
240 /* Floor name column */
243 serv_printf("OIMG _floorpic_|%d", a);
248 wprintf("<IMG SRC=\"/image&name=_floorpic_&parm=%d\" ALT=\"%s\">",
249 a, &floorlist[a][0]);
251 escputs(&floorlist[a][0]);
256 /* Rooms with new messages column */
258 sprintf(buf, "LKRN %d", a);
260 wprintf("</TD><TD>\n");
262 /* Rooms with old messages column */
263 sprintf(buf, "LKRO %d", a);
265 wprintf("</TD></TR>\n");
267 wprintf("</TABLE>\n");
273 * list all forgotten rooms
275 void zapped_list(void)
277 printf("HTTP/1.0 200 OK\n");
278 output_headers(1, "bottom");
279 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
280 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
281 wprintf("<B>Zapped (forgotten) rooms</B>\n");
282 wprintf("</FONT></TD></TR></TABLE><BR>\n");
284 wprintf("<BR><BR>\n");
285 wprintf("Click on any room to un-zap it and goto that room.\n");
291 * read this room's info file (set v to 1 for verbose mode)
303 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
309 * generic routine to take the session to a new room
311 * display_name values: 0 = goto only
312 * 1 = goto and display
315 void gotoroom(char *gname, int display_name)
318 static long ls = (-1L);
322 printf("HTTP/1.0 200 OK\n");
323 output_headers(0, "top");
324 wprintf("<HTML><HEAD></HEAD>\n<BODY ");
326 /* automatically fire up a read-new-msgs in the bottom frame */
328 wprintf("onload=location=\"/readnew\" ");
330 wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
332 if (display_name != 2) {
333 /* store ungoto information */
334 strcpy(ugname, wc_roomname);
337 /* move to the new room */
338 serv_printf("GOTO %s", gname);
341 serv_puts("GOTO _BASEROOM_");
346 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
351 extract(wc_roomname, &buf[4], 0);
352 room_flags = extract_int(&buf[4], 4);
353 /* highest_msg_read = extract_int(&buf[4],6);
354 maxmsgnum = extract_int(&buf[4],5);
355 is_mail = (char) extract_int(&buf[4],7); */
356 ls = extract_long(&buf[4], 6);
359 is_room_aide = is_aide;
361 is_room_aide = (char) extract_int(&buf[4], 8);
363 remove_march(wc_roomname);
364 if (!strcasecmp(gname, "_BASEROOM_"))
367 /* Display the room banner */
369 wprintf("<CENTER><TABLE border=0><TR>");
371 if ((strlen(ugname) > 0) && (strcasecmp(ugname, wc_roomname))) {
372 wprintf("<TD VALIGN=TOP><A HREF=\"/ungoto\">");
373 wprintf("<IMG SRC=\"/static/back.gif\" BORDER=0></A></TD>");
375 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\"><H1>%s</H1>", wc_roomname);
376 wprintf("%d new of %d messages</FONT></TD>\n",
377 extract_int(&buf[4], 1),
378 extract_int(&buf[4], 2));
380 /* Display room graphic. The server doesn't actually
381 * need the room name, but we supply it in order to
382 * keep the browser from using a cached graphic from
385 serv_puts("OIMG _roompic_");
388 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
389 wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
390 escputs(wc_roomname);
391 wprintf("\"></FONT></TD>");
395 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\">");
397 wprintf("</FONT></TD>");
399 wprintf("<TD VALIGN=TOP><A HREF=\"/gotonext\">");
400 wprintf("<IMG SRC=\"/static/forward.gif\" border=0></A></TD>");
401 wprintf("</TR></TABLE></CENTER>\n");
405 strcpy(wc_roomname, wc_roomname);
410 * Locate the room on the march list which we most want to go to. Each room
411 * is measured given a "weight" of preference based on various factors.
413 char *pop_march(int desired_floor)
415 static char TheRoom[64];
417 int TheOrder = 32767;
420 struct march *mptr = NULL;
422 strcpy(TheRoom, "_BASEROOM_");
426 for (mptr = march; mptr != NULL; mptr = mptr->next) {
428 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
429 weight = weight + 10000;
430 if (mptr->march_floor == desired_floor)
431 weight = weight + 5000;
433 weight = weight + ((128 - (mptr->march_floor)) * 128);
434 weight = weight + (128 - (mptr->march_order));
436 if (weight > TheWeight) {
438 strcpy(TheRoom, mptr->march_name);
439 TheFloor = mptr->march_floor;
440 TheOrder = mptr->march_order;
448 /* Goto next room having unread messages.
449 * We want to skip over rooms that the user has already been to, and take the
450 * user back to the lobby when done. The room we end up in is placed in
451 * newroom - which is set to 0 (the lobby) initially.
452 * We start the search in the current room rather than the beginning to prevent
453 * two or more concurrent users from dragging each other back to the same room.
458 struct march *mptr, *mptr2;
461 /* First check to see if the march-mode list is already allocated.
462 * If it is, pop the first room off the list and go there.
469 while (serv_gets(buf), strcmp(buf, "000")) {
470 mptr = (struct march *) malloc(sizeof(struct march));
472 extract(mptr->march_name, buf, 0);
473 mptr->march_floor = extract_int(buf, 2);
474 mptr->march_order = extract_int(buf, 3);
479 while (mptr2->next != NULL)
484 /* add _BASEROOM_ to the end of the march list, so the user will end up
485 * in the system base room (usually the Lobby>) at the end of the loop
487 mptr = (struct march *) malloc(sizeof(struct march));
489 strcpy(mptr->march_name, "_BASEROOM_");
494 while (mptr2->next != NULL)
499 * ...and remove the room we're currently in, so a <G>oto doesn't make us
500 * walk around in circles
502 remove_march(wc_roomname);
505 strcpy(next_room, pop_march(-1));
507 strcpy(next_room, "_BASEROOM_");
509 gotoroom(next_room, 1);
515 * mark all messages in current room as having been read
517 void slrp_highest(void)
522 serv_puts("SLRP HIGHEST");
525 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
532 * un-goto the previous room
538 if (!strcmp(ugname, "")) {
539 gotoroom(wc_roomname, 1);
542 serv_printf("GOTO %s", ugname);
545 gotoroom(wc_roomname, 1);
549 serv_printf("SLRP %ld", uglsn);
558 * display the form for editing a room
560 void display_editroom(void)
564 char er_password[10];
566 char er_roomaide[26];
575 display_error(&buf[4]);
578 extract(er_name, &buf[4], 0);
579 extract(er_password, &buf[4], 1);
580 extract(er_dirname, &buf[4], 2);
581 er_flags = extract_int(&buf[4], 3);
582 er_floor = extract_int(&buf[4], 4);
585 printf("HTTP/1.0 200 OK\n");
586 output_headers(1, "bottom");
588 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
589 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
590 wprintf("<B>Edit this room</B>\n");
591 wprintf("</FONT></TD></TR></TABLE>\n");
593 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
595 wprintf("<UL><LI>Name of room: ");
596 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
598 wprintf("<LI>Resides on floor: ");
600 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
601 for (i = 0; i < 128; ++i)
602 if (strlen(floorlist[i]) > 0) {
605 wprintf("SELECTED ");
606 wprintf("VALUE=\"%d\">", i);
607 escputs(floorlist[i]);
608 wprintf("</OPTION>\n");
610 wprintf("</SELECT>\n");
612 wprintf("<LI>Type of room:<UL>\n");
614 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
615 if ((er_flags & QR_PRIVATE) == 0)
617 wprintf("> Public room\n");
619 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
620 if ((er_flags & QR_PRIVATE) &&
621 (er_flags & QR_GUESSNAME))
623 wprintf("> Private - guess name\n");
625 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
626 if ((er_flags & QR_PRIVATE) &&
627 (er_flags & QR_PASSWORDED))
629 wprintf("> Private - require password:\n");
630 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
632 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
633 if ((er_flags & QR_PRIVATE)
634 && ((er_flags & QR_GUESSNAME) == 0)
635 && ((er_flags & QR_PASSWORDED) == 0))
637 wprintf("> Private - invitation only\n");
639 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
640 wprintf("> If private, cause current users to forget room\n");
644 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
645 if (er_flags & QR_PREFONLY)
647 wprintf("> Preferred users only\n");
649 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
650 if (er_flags & QR_READONLY)
652 wprintf("> Read-only room\n");
654 /* directory stuff */
655 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
656 if (er_flags & QR_DIRECTORY)
658 wprintf("> File directory room\n");
660 wprintf("<UL><LI>Directory name: ");
661 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
663 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
664 if (er_flags & QR_UPLOAD)
666 wprintf("> Uploading allowed\n");
668 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
669 if (er_flags & QR_DOWNLOAD)
671 wprintf("> Downloading allowed\n");
673 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
674 if (er_flags & QR_VISDIR)
676 wprintf("> Visible directory</UL>\n");
678 /* end of directory stuff */
680 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
681 if (er_flags & QR_NETWORK)
683 wprintf("> Network shared room\n");
685 /* start of anon options */
687 wprintf("<LI>Anonymous messages<UL>\n");
689 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
690 if (((er_flags & QR_ANONONLY) == 0)
691 && ((er_flags & QR_ANONOPT) == 0))
693 wprintf("> No anonymous messages\n");
695 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
696 if (er_flags & QR_ANONONLY)
698 wprintf("> All messages are anonymous\n");
700 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
701 if (er_flags & QR_ANONOPT)
703 wprintf("> Prompt user when entering messages</UL>\n");
705 /* end of anon options */
707 wprintf("<LI>Room aide: \n");
711 wprintf("<EM>%s</EM>\n", &buf[4]);
713 extract(er_roomaide, &buf[4], 0);
714 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
717 wprintf("</UL><CENTER>\n");
718 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
719 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
720 wprintf("</CENTER>\n");
727 * save new parameters for a room
733 char er_password[10];
735 char er_roomaide[26];
741 if (strcmp(bstr("sc"), "OK")) {
742 display_error("Cancelled. Changes were not saved.");
749 display_error(&buf[4]);
752 extract(er_name, &buf[4], 0);
753 extract(er_password, &buf[4], 1);
754 extract(er_dirname, &buf[4], 2);
755 er_flags = extract_int(&buf[4], 3);
757 strcpy(er_roomaide, bstr("er_roomaide"));
758 if (strlen(er_roomaide) == 0) {
762 strcpy(er_roomaide, "");
764 extract(er_roomaide, &buf[4], 0);
767 strcpy(buf, bstr("er_name"));
770 strcpy(er_name, buf);
772 strcpy(buf, bstr("er_password"));
775 strcpy(er_password, buf);
777 strcpy(buf, bstr("er_dirname"));
780 strcpy(er_dirname, buf);
782 strcpy(buf, bstr("type"));
783 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
785 if (!strcmp(buf, "invonly")) {
786 er_flags |= (QR_PRIVATE);
788 if (!strcmp(buf, "guessname")) {
789 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
791 if (!strcmp(buf, "passworded")) {
792 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
794 if (!strcmp(bstr("prefonly"), "yes")) {
795 er_flags |= QR_PREFONLY;
797 er_flags &= ~QR_PREFONLY;
800 if (!strcmp(bstr("readonly"), "yes")) {
801 er_flags |= QR_READONLY;
803 er_flags &= ~QR_READONLY;
806 if (!strcmp(bstr("network"), "yes")) {
807 er_flags |= QR_NETWORK;
809 er_flags &= ~QR_NETWORK;
812 if (!strcmp(bstr("directory"), "yes")) {
813 er_flags |= QR_DIRECTORY;
815 er_flags &= ~QR_DIRECTORY;
818 if (!strcmp(bstr("ulallowed"), "yes")) {
819 er_flags |= QR_UPLOAD;
821 er_flags &= ~QR_UPLOAD;
824 if (!strcmp(bstr("dlallowed"), "yes")) {
825 er_flags |= QR_DOWNLOAD;
827 er_flags &= ~QR_DOWNLOAD;
830 if (!strcmp(bstr("visdir"), "yes")) {
831 er_flags |= QR_VISDIR;
833 er_flags &= ~QR_VISDIR;
836 strcpy(buf, bstr("anon"));
838 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
839 if (!strcmp(buf, "anononly"))
840 er_flags |= QR_ANONONLY;
841 if (!strcmp(buf, "anon2"))
842 er_flags |= QR_ANONOPT;
845 if (!strcmp(bstr("bump"), "yes"))
848 er_floor = atoi(bstr("er_floor"));
850 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
851 er_name, er_password, er_dirname, er_flags, bump, er_floor);
855 display_error(&buf[4]);
858 gotoroom(er_name, 0);
860 if (strlen(er_roomaide) > 0) {
861 sprintf(buf, "SETA %s", er_roomaide);
865 display_error(&buf[4]);
869 gotoroom(er_name, 1);
875 * display the form for entering a new room
877 void display_entroom(void)
885 display_error(&buf[4]);
888 printf("HTTP/1.0 200 OK\n");
889 output_headers(1, "bottom");
891 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
892 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
893 wprintf("<B>Enter (create) a new room</B>\n");
894 wprintf("</FONT></TD></TR></TABLE>\n");
896 wprintf("<FORM METHOD=\"POST\" ACTION=\"/entroom\">\n");
898 wprintf("<UL><LI>Name of room: ");
899 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"19\">\n");
901 wprintf("<LI>Type of room:<UL>\n");
903 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
904 wprintf("CHECKED > Public room\n");
906 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
907 wprintf("> Private - guess name\n");
909 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
910 wprintf("> Private - require password:\n");
911 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
913 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
914 wprintf("> Private - invitation only\n");
916 wprintf("<CENTER>\n");
917 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
918 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
919 wprintf("</CENTER>\n");
920 wprintf("</FORM>\n");
934 char er_password[10];
937 if (strcmp(bstr("sc"), "OK")) {
938 display_error("Cancelled. No new room was created.");
941 strcpy(er_name, bstr("er_name"));
942 strcpy(er_type, bstr("type"));
943 strcpy(er_password, bstr("er_password"));
946 if (!strcmp(er_type, "guessname"))
948 if (!strcmp(er_type, "passworded"))
950 if (!strcmp(er_type, "invonly"))
953 sprintf(buf, "CRE8 1|%s|%d|%s", er_name, er_num_type, er_password);
957 display_error(&buf[4]);
960 gotoroom(er_name, 1);
965 * display the screen to enter a private room
967 void display_private(char *rname, int req_pass)
970 printf("HTTP/1.0 200 OK\n");
971 output_headers(1, "bottom");
973 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
974 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
975 wprintf("<B>Goto a private room</B>\n");
976 wprintf("</FONT></TD></TR></TABLE>\n");
978 wprintf("<CENTER>\n");
979 wprintf("If you know the name of a hidden (guess-name) or\n");
980 wprintf("passworded room, you can enter that room by typing\n");
981 wprintf("its name below. Once you gain access to a private\n");
982 wprintf("room, it will appear in your regular room listings\n");
983 wprintf("so you don't have to keep returning here.\n");
986 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
988 wprintf("<TABLE border><TR><TD>");
989 wprintf("Enter room name:</TD><TD>");
990 wprintf("<INPUT TYPE=\"text\" NAME=\"gr_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
993 wprintf("</TD></TR><TR><TD>");
994 wprintf("Enter room password:</TD><TD>");
995 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
997 wprintf("</TD></TR></TABLE>\n");
999 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1000 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1001 wprintf("</FORM>\n");
1006 * goto a private room
1008 void goto_private(void)
1013 if (strcasecmp(bstr("sc"), "OK")) {
1014 display_main_menu();
1017 strcpy(hold_rm, wc_roomname);
1018 strcpy(buf, "GOTO ");
1019 strcat(buf, bstr("gr_name"));
1021 strcat(buf, bstr("gr_pass"));
1025 if (buf[0] == '2') {
1026 gotoroom(bstr("gr_name"), 1);
1029 if (!strncmp(buf, "540", 3)) {
1030 display_private(bstr("gr_name"), 1);
1033 printf("HTTP/1.0 200 OK\n");
1034 output_headers(1, "bottom");
1035 wprintf("%s\n", &buf[4]);
1042 * display the screen to zap a room
1044 void display_zap(void)
1046 printf("HTTP/1.0 200 OK\n");
1047 output_headers(1, "bottom");
1049 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1050 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1051 wprintf("<B>Zap (forget) the current room</B>\n");
1052 wprintf("</FONT></TD></TR></TABLE>\n");
1054 wprintf("If you select this option, <em>%s</em> will ", wc_roomname);
1055 wprintf("disappear from your room list. Is this what you wish ");
1056 wprintf("to do?<BR>\n");
1058 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
1059 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1060 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1061 wprintf("</FORM>\n");
1073 if (strcmp(bstr("sc"), "OK")) {
1074 display_main_menu();
1077 serv_printf("GOTO %s", wc_roomname);
1079 if (buf[0] != '2') {
1080 display_error(&buf[4]);
1085 if (buf[0] != '2') {
1086 display_error(&buf[4]);
1089 gotoroom(bstr("_BASEROOM_"), 1);
1096 * Confirm deletion of the current room
1098 void confirm_delete_room(void)
1102 serv_puts("KILL 0");
1104 if (buf[0] != '2') {
1105 display_error(&buf[4]);
1108 printf("HTTP/1.0 200 OK\n");
1109 output_headers(1, "bottom");
1110 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1111 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1112 wprintf("<B>Confirm deletion of room</B>\n");
1113 wprintf("</FONT></TD></TR></TABLE>\n");
1115 wprintf("<CENTER>");
1116 wprintf("<FORM METHOD=\"POST\" ACTION=\"/delete_room\">\n");
1118 wprintf("Are you sure you want to delete <FONT SIZE=+1>");
1119 escputs(wc_roomname);
1120 wprintf("</FONT>?<BR>\n");
1122 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Delete\">");
1123 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1125 wprintf("</FORM></CENTER>\n");
1131 * Delete the current room
1133 void delete_room(void)
1138 strcpy(sc, bstr("sc"));
1140 if (strcasecmp(sc, "Delete")) {
1141 display_error("Cancelled. This room was not deleted.");
1144 serv_puts("KILL 1");
1146 if (buf[0] != '2') {
1147 display_error(&buf[4]);
1149 gotoroom("_BASEROOM_", 1);