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=");
119 if (!noframes) wprintf("TARGET=\"top\"");
122 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
124 else if (f & QR_DIRECTORY)
126 else if (f & QR_NETWORK)
130 wprintf("</A><TT> </TT>\n");
132 if (rp->rnext != NULL) {
133 room_tree_list(rp->rnext);
140 * Room ordering stuff (compare first by floor, then by order)
142 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
144 if ((r1 == NULL) && (r2 == NULL))
150 if (r1->rlfloor < r2->rlfloor)
152 if (r1->rlfloor > r2->rlfloor)
154 if (r1->rlorder < r2->rlorder)
156 if (r1->rlorder > r2->rlorder)
163 * Common code for all room listings
165 void listrms(char *variety)
170 struct roomlisting *rl = NULL;
171 struct roomlisting *rp;
172 struct roomlisting *rs;
175 /* Ask the server for a room list */
182 while (serv_gets(buf), strcmp(buf, "000")) {
184 rp = malloc(sizeof(struct roomlisting));
185 extract(rp->rlname, buf, 0);
186 rp->rlflags = extract_int(buf, 1);
187 rp->rlfloor = extract_int(buf, 2);
188 rp->rlorder = extract_int(buf, 3);
197 if (rordercmp(rp, rs) < 0) {
198 if (rs->lnext == NULL) {
205 if (rs->rnext == NULL) {
217 /* If no rooms were listed, print an nbsp to make the cell
218 * borders show up anyway.
220 if (num_rooms == 0) wprintf(" ");
232 * list all rooms by floor
234 void list_all_rooms_by_floor(void)
241 printf("HTTP/1.0 200 OK\n");
244 wprintf("<TABLE width=100% border><TR><TH>Floor</TH>");
245 wprintf("<TH><FONT FACE=\"Arial,Helvetica,sans-serif\">Rooms with new messages</FONT></TH>");
246 wprintf("<TH><FONT FACE=\"Arial,Helvetica,sans-serif\">Rooms with no new messages</FONT></TH></TR>\n");
248 for (a = 0; a < 128; ++a)
249 if (floorlist[a][0] != 0) {
251 /* Floor name column */
252 wprintf("<TR><TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
254 serv_printf("OIMG _floorpic_|%d", a);
259 wprintf("<IMG SRC=\"/image&name=_floorpic_&parm=%d\" ALT=\"%s\">",
260 a, &floorlist[a][0]);
262 escputs(&floorlist[a][0]);
265 wprintf("</FONT></TD>");
267 /* Rooms with new messages column */
268 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
269 sprintf(buf, "LKRN %d", a);
271 wprintf("</FONT></TD>\n<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
273 /* Rooms with old messages column */
274 sprintf(buf, "LKRO %d", a);
276 wprintf("</FONT></TD></TR>\n");
278 wprintf("</TABLE>\n");
284 * list all forgotten rooms
286 void zapped_list(void)
288 printf("HTTP/1.0 200 OK\n");
290 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
291 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFFFF\"");
292 wprintf("<B>Zapped (forgotten) rooms</B>\n");
293 wprintf("</FONT></TD></TR></TABLE><BR>\n");
295 wprintf("<BR><BR>\n");
296 wprintf("Click on any room to un-zap it and goto that room.\n");
302 * read this room's info file (set v to 1 for verbose mode)
314 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
320 void embed_room_banner(char *got) {
323 static int remember_new_mail = (-1);
325 /* We need to have the information returned by a GOTO server command.
326 * If it isn't supplied, we fake it by issuing our own GOTO.
329 serv_printf("GOTO %s", wc_roomname);
334 /* Check for new mail. */
335 new_mail = extract_int(&got[4], 9);
337 /* Now start spewing HTML. */
338 wprintf("<CENTER><TABLE border=0><TR>");
340 if ((strlen(ugname) > 0) && (strcasecmp(ugname, wc_roomname))) {
341 wprintf("<TD VALIGN=TOP><A HREF=\"/ungoto\">");
342 wprintf("<IMG SRC=\"/static/back.gif\" BORDER=0></A></TD>");
344 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\"><FONT SIZE=+2>%s</FONT><BR>", wc_roomname);
345 wprintf("%d new of %d messages</FONT></TD>\n",
346 extract_int(&got[4], 1),
347 extract_int(&got[4], 2));
349 /* Display room graphic. The server doesn't actually
350 * need the room name, but we supply it in order to
351 * keep the browser from using a cached graphic from
354 serv_puts("OIMG _roompic_");
357 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
358 wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
359 escputs(wc_roomname);
360 wprintf("\"></FONT></TD>");
364 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\">");
366 wprintf("</FONT></TD>");
368 /* Let the user know if new mail has arrived */
369 if (new_mail > remember_new_mail) {
370 wprintf("<TD VALIGN=TOP>"
371 "<IMG SRC=\"/static/mail.gif\" border=0 "
372 "ALT=\"You have new mail\">"
373 "<BR><BLINK>%d</BLINK></TD>", new_mail);
374 remember_new_mail = new_mail;
377 wprintf("<TD VALIGN=TOP><A HREF=\"/gotonext\">");
378 wprintf("<IMG SRC=\"/static/forward.gif\" border=0></A></TD>");
379 wprintf("</TR></TABLE></CENTER>\n");
387 * generic routine to take the session to a new room
389 * display_name values: 0 = goto only
390 * 1 = goto and display
393 void gotoroom(char *gname, int display_name)
396 static long ls = (-1L);
400 printf("HTTP/1.0 200 OK\n");
401 printf("Pragma: no-cache\n");
402 printf("Cache-Control: no-store\n");
405 wprintf("<HTML><HEAD></HEAD>\n<BODY ");
407 /* automatically fire up a read-new-msgs in the bottom frame */
409 wprintf("onload=parent.frames.bottom.location=\"/readnew\" ");
411 wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
413 if (display_name != 2) {
414 /* store ungoto information */
415 strcpy(ugname, wc_roomname);
418 /* move to the new room */
419 serv_printf("GOTO %s", gname);
422 serv_puts("GOTO _BASEROOM_");
427 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
432 extract(wc_roomname, &buf[4], 0);
433 room_flags = extract_int(&buf[4], 4);
434 /* highest_msg_read = extract_int(&buf[4],6);
435 maxmsgnum = extract_int(&buf[4],5);
436 is_mail = (char) extract_int(&buf[4],7); */
437 ls = extract_long(&buf[4], 6);
440 is_room_aide = is_aide;
442 is_room_aide = (char) extract_int(&buf[4], 8);
444 remove_march(wc_roomname);
445 if (!strcasecmp(gname, "_BASEROOM_"))
448 /* Display the room banner */
450 embed_room_banner(buf);
453 strcpy(wc_roomname, wc_roomname);
458 * Locate the room on the march list which we most want to go to. Each room
459 * is measured given a "weight" of preference based on various factors.
461 char *pop_march(int desired_floor)
463 static char TheRoom[64];
465 int TheOrder = 32767;
468 struct march *mptr = NULL;
470 strcpy(TheRoom, "_BASEROOM_");
474 for (mptr = march; mptr != NULL; mptr = mptr->next) {
476 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
477 weight = weight + 10000;
478 if (mptr->march_floor == desired_floor)
479 weight = weight + 5000;
481 weight = weight + ((128 - (mptr->march_floor)) * 128);
482 weight = weight + (128 - (mptr->march_order));
484 if (weight > TheWeight) {
486 strcpy(TheRoom, mptr->march_name);
487 TheFloor = mptr->march_floor;
488 TheOrder = mptr->march_order;
496 /* Goto next room having unread messages.
497 * We want to skip over rooms that the user has already been to, and take the
498 * user back to the lobby when done. The room we end up in is placed in
499 * newroom - which is set to 0 (the lobby) initially.
500 * We start the search in the current room rather than the beginning to prevent
501 * two or more concurrent users from dragging each other back to the same room.
506 struct march *mptr, *mptr2;
509 /* First check to see if the march-mode list is already allocated.
510 * If it is, pop the first room off the list and go there.
517 while (serv_gets(buf), strcmp(buf, "000")) {
518 mptr = (struct march *) malloc(sizeof(struct march));
520 extract(mptr->march_name, buf, 0);
521 mptr->march_floor = extract_int(buf, 2);
522 mptr->march_order = extract_int(buf, 3);
527 while (mptr2->next != NULL)
532 /* add _BASEROOM_ to the end of the march list, so the user will end up
533 * in the system base room (usually the Lobby>) at the end of the loop
535 mptr = (struct march *) malloc(sizeof(struct march));
537 strcpy(mptr->march_name, "_BASEROOM_");
542 while (mptr2->next != NULL)
547 * ...and remove the room we're currently in, so a <G>oto doesn't make us
548 * walk around in circles
550 remove_march(wc_roomname);
553 strcpy(next_room, pop_march(-1));
555 strcpy(next_room, "_BASEROOM_");
559 smart_goto(next_room);
563 void smart_goto(char *next_room) {
564 /* In noframes mode, we goto the room silently, then do a
565 * read-new-messages which causes the banner to show up anyway.
568 gotoroom(next_room, 0);
571 /* In frames mode, we let gotoroom() bring up the banner, which then
572 * uses JavaScript to bring up the new-messages display in the
575 gotoroom(next_room, 1);
582 * mark all messages in current room as having been read
584 void slrp_highest(void)
589 serv_puts("SLRP HIGHEST");
592 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
599 * un-goto the previous room
605 if (!strcmp(ugname, "")) {
606 smart_goto(wc_roomname);
609 serv_printf("GOTO %s", ugname);
612 smart_goto(wc_roomname);
616 serv_printf("SLRP %ld", uglsn);
625 * display the form for editing a room
627 void display_editroom(void)
631 char er_password[10];
633 char er_roomaide[26];
642 display_error(&buf[4]);
645 extract(er_name, &buf[4], 0);
646 extract(er_password, &buf[4], 1);
647 extract(er_dirname, &buf[4], 2);
648 er_flags = extract_int(&buf[4], 3);
649 er_floor = extract_int(&buf[4], 4);
652 printf("HTTP/1.0 200 OK\n");
655 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
656 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
657 wprintf("<B>Edit this room</B>\n");
658 wprintf("</FONT></TD></TR></TABLE>\n");
660 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
662 wprintf("<UL><LI>Name of room: ");
663 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
665 wprintf("<LI>Resides on floor: ");
667 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
668 for (i = 0; i < 128; ++i)
669 if (strlen(floorlist[i]) > 0) {
672 wprintf("SELECTED ");
673 wprintf("VALUE=\"%d\">", i);
674 escputs(floorlist[i]);
675 wprintf("</OPTION>\n");
677 wprintf("</SELECT>\n");
679 wprintf("<LI>Type of room:<UL>\n");
681 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
682 if ((er_flags & QR_PRIVATE) == 0)
684 wprintf("> Public room\n");
686 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
687 if ((er_flags & QR_PRIVATE) &&
688 (er_flags & QR_GUESSNAME))
690 wprintf("> Private - guess name\n");
692 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
693 if ((er_flags & QR_PRIVATE) &&
694 (er_flags & QR_PASSWORDED))
696 wprintf("> Private - require password:\n");
697 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
699 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
700 if ((er_flags & QR_PRIVATE)
701 && ((er_flags & QR_GUESSNAME) == 0)
702 && ((er_flags & QR_PASSWORDED) == 0))
704 wprintf("> Private - invitation only\n");
706 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
707 wprintf("> If private, cause current users to forget room\n");
711 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
712 if (er_flags & QR_PREFONLY)
714 wprintf("> Preferred users only\n");
716 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
717 if (er_flags & QR_READONLY)
719 wprintf("> Read-only room\n");
721 /* directory stuff */
722 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
723 if (er_flags & QR_DIRECTORY)
725 wprintf("> File directory room\n");
727 wprintf("<UL><LI>Directory name: ");
728 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
730 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
731 if (er_flags & QR_UPLOAD)
733 wprintf("> Uploading allowed\n");
735 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
736 if (er_flags & QR_DOWNLOAD)
738 wprintf("> Downloading allowed\n");
740 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
741 if (er_flags & QR_VISDIR)
743 wprintf("> Visible directory</UL>\n");
745 /* end of directory stuff */
747 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
748 if (er_flags & QR_NETWORK)
750 wprintf("> Network shared room\n");
752 /* start of anon options */
754 wprintf("<LI>Anonymous messages<UL>\n");
756 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
757 if (((er_flags & QR_ANONONLY) == 0)
758 && ((er_flags & QR_ANONOPT) == 0))
760 wprintf("> No anonymous messages\n");
762 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
763 if (er_flags & QR_ANONONLY)
765 wprintf("> All messages are anonymous\n");
767 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
768 if (er_flags & QR_ANONOPT)
770 wprintf("> Prompt user when entering messages</UL>\n");
772 /* end of anon options */
774 wprintf("<LI>Room aide: \n");
778 wprintf("<EM>%s</EM>\n", &buf[4]);
780 extract(er_roomaide, &buf[4], 0);
781 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
784 wprintf("</UL><CENTER>\n");
785 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
786 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
787 wprintf("</CENTER>\n");
794 * save new parameters for a room
800 char er_password[10];
802 char er_roomaide[26];
808 if (strcmp(bstr("sc"), "OK")) {
809 display_error("Cancelled. Changes were not saved.");
816 display_error(&buf[4]);
819 extract(er_name, &buf[4], 0);
820 extract(er_password, &buf[4], 1);
821 extract(er_dirname, &buf[4], 2);
822 er_flags = extract_int(&buf[4], 3);
824 strcpy(er_roomaide, bstr("er_roomaide"));
825 if (strlen(er_roomaide) == 0) {
829 strcpy(er_roomaide, "");
831 extract(er_roomaide, &buf[4], 0);
834 strcpy(buf, bstr("er_name"));
837 strcpy(er_name, buf);
839 strcpy(buf, bstr("er_password"));
842 strcpy(er_password, buf);
844 strcpy(buf, bstr("er_dirname"));
847 strcpy(er_dirname, buf);
849 strcpy(buf, bstr("type"));
850 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
852 if (!strcmp(buf, "invonly")) {
853 er_flags |= (QR_PRIVATE);
855 if (!strcmp(buf, "guessname")) {
856 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
858 if (!strcmp(buf, "passworded")) {
859 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
861 if (!strcmp(bstr("prefonly"), "yes")) {
862 er_flags |= QR_PREFONLY;
864 er_flags &= ~QR_PREFONLY;
867 if (!strcmp(bstr("readonly"), "yes")) {
868 er_flags |= QR_READONLY;
870 er_flags &= ~QR_READONLY;
873 if (!strcmp(bstr("network"), "yes")) {
874 er_flags |= QR_NETWORK;
876 er_flags &= ~QR_NETWORK;
879 if (!strcmp(bstr("directory"), "yes")) {
880 er_flags |= QR_DIRECTORY;
882 er_flags &= ~QR_DIRECTORY;
885 if (!strcmp(bstr("ulallowed"), "yes")) {
886 er_flags |= QR_UPLOAD;
888 er_flags &= ~QR_UPLOAD;
891 if (!strcmp(bstr("dlallowed"), "yes")) {
892 er_flags |= QR_DOWNLOAD;
894 er_flags &= ~QR_DOWNLOAD;
897 if (!strcmp(bstr("visdir"), "yes")) {
898 er_flags |= QR_VISDIR;
900 er_flags &= ~QR_VISDIR;
903 strcpy(buf, bstr("anon"));
905 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
906 if (!strcmp(buf, "anononly"))
907 er_flags |= QR_ANONONLY;
908 if (!strcmp(buf, "anon2"))
909 er_flags |= QR_ANONOPT;
912 if (!strcmp(bstr("bump"), "yes"))
915 er_floor = atoi(bstr("er_floor"));
917 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
918 er_name, er_password, er_dirname, er_flags, bump, er_floor);
922 display_error(&buf[4]);
925 gotoroom(er_name, 0);
927 if (strlen(er_roomaide) > 0) {
928 sprintf(buf, "SETA %s", er_roomaide);
932 display_error(&buf[4]);
942 * display the form for entering a new room
944 void display_entroom(void)
952 display_error(&buf[4]);
955 printf("HTTP/1.0 200 OK\n");
958 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
959 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
960 wprintf("<B>Enter (create) a new room</B>\n");
961 wprintf("</FONT></TD></TR></TABLE>\n");
963 wprintf("<FORM METHOD=\"POST\" ACTION=\"/entroom\">\n");
965 wprintf("<UL><LI>Name of room: ");
966 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"19\">\n");
968 wprintf("<LI>Type of room:<UL>\n");
970 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
971 wprintf("CHECKED > Public room\n");
973 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
974 wprintf("> Private - guess name\n");
976 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
977 wprintf("> Private - require password:\n");
978 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
980 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
981 wprintf("> Private - invitation only\n");
983 wprintf("<CENTER>\n");
984 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
985 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
986 wprintf("</CENTER>\n");
987 wprintf("</FORM>\n");
1001 char er_password[10];
1004 if (strcmp(bstr("sc"), "OK")) {
1005 display_error("Cancelled. No new room was created.");
1008 strcpy(er_name, bstr("er_name"));
1009 strcpy(er_type, bstr("type"));
1010 strcpy(er_password, bstr("er_password"));
1013 if (!strcmp(er_type, "guessname"))
1015 if (!strcmp(er_type, "passworded"))
1017 if (!strcmp(er_type, "invonly"))
1020 sprintf(buf, "CRE8 1|%s|%d|%s", er_name, er_num_type, er_password);
1023 if (buf[0] != '2') {
1024 display_error(&buf[4]);
1027 smart_goto(er_name);
1032 * display the screen to enter a private room
1034 void display_private(char *rname, int req_pass)
1037 printf("HTTP/1.0 200 OK\n");
1040 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1041 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1042 wprintf("<B>Goto a private room</B>\n");
1043 wprintf("</FONT></TD></TR></TABLE>\n");
1045 wprintf("<CENTER>\n");
1046 wprintf("If you know the name of a hidden (guess-name) or\n");
1047 wprintf("passworded room, you can enter that room by typing\n");
1048 wprintf("its name below. Once you gain access to a private\n");
1049 wprintf("room, it will appear in your regular room listings\n");
1050 wprintf("so you don't have to keep returning here.\n");
1051 wprintf("<BR><BR>");
1053 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
1055 wprintf("<TABLE border><TR><TD>");
1056 wprintf("Enter room name:</TD><TD>");
1057 wprintf("<INPUT TYPE=\"text\" NAME=\"gr_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1060 wprintf("</TD></TR><TR><TD>");
1061 wprintf("Enter room password:</TD><TD>");
1062 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1064 wprintf("</TD></TR></TABLE>\n");
1066 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1067 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1068 wprintf("</FORM>\n");
1073 * goto a private room
1075 void goto_private(void)
1080 if (strcasecmp(bstr("sc"), "OK")) {
1081 display_main_menu();
1084 strcpy(hold_rm, wc_roomname);
1085 strcpy(buf, "GOTO ");
1086 strcat(buf, bstr("gr_name"));
1088 strcat(buf, bstr("gr_pass"));
1092 if (buf[0] == '2') {
1093 smart_goto(bstr("gr_name"));
1096 if (!strncmp(buf, "540", 3)) {
1097 display_private(bstr("gr_name"), 1);
1100 printf("HTTP/1.0 200 OK\n");
1102 wprintf("%s\n", &buf[4]);
1109 * display the screen to zap a room
1111 void display_zap(void)
1113 printf("HTTP/1.0 200 OK\n");
1116 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1117 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1118 wprintf("<B>Zap (forget) the current room</B>\n");
1119 wprintf("</FONT></TD></TR></TABLE>\n");
1121 wprintf("If you select this option, <em>%s</em> will ", wc_roomname);
1122 wprintf("disappear from your room list. Is this what you wish ");
1123 wprintf("to do?<BR>\n");
1125 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\"");
1126 if (!noframes) wprintf(" TARGET=top");
1127 wprintf(">\n<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1128 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1129 wprintf("</FORM>\n");
1140 char final_destination[256];
1142 /* If the forget-room routine fails for any reason, we fall back
1143 * to the current room; otherwise, we go to the Lobby
1145 strcpy(final_destination, wc_roomname);
1147 if (!strcasecmp(bstr("sc"), "OK")) {
1148 serv_printf("GOTO %s", wc_roomname);
1150 if (buf[0] != '2') {
1151 ExpressMessageCat(&buf[4]);
1155 if (buf[0] != '2') {
1156 ExpressMessageCat(&buf[4]);
1158 strcpy(final_destination, "_BASEROOM_");
1162 smart_goto(final_destination);
1169 * Confirm deletion of the current room
1171 void confirm_delete_room(void)
1175 serv_puts("KILL 0");
1177 if (buf[0] != '2') {
1178 display_error(&buf[4]);
1181 printf("HTTP/1.0 200 OK\n");
1183 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1184 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1185 wprintf("<B>Confirm deletion of room</B>\n");
1186 wprintf("</FONT></TD></TR></TABLE>\n");
1188 wprintf("<CENTER>");
1189 wprintf("<FORM METHOD=\"POST\" ACTION=\"/delete_room\">\n");
1191 wprintf("Are you sure you want to delete <FONT SIZE=+1>");
1192 escputs(wc_roomname);
1193 wprintf("</FONT>?<BR>\n");
1195 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Delete\">");
1196 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1198 wprintf("</FORM></CENTER>\n");
1204 * Delete the current room
1206 void delete_room(void)
1211 strcpy(sc, bstr("sc"));
1213 if (strcasecmp(sc, "Delete")) {
1214 display_error("Cancelled. This room was not deleted.");
1217 serv_puts("KILL 1");
1219 if (buf[0] != '2') {
1220 display_error(&buf[4]);
1222 smart_goto("_BASEROOM_");