10 #include <sys/types.h>
12 #include <sys/socket.h>
15 #include <netinet/in.h>
33 * This struct holds a list of rooms for <G>oto operations.
43 * This struct holds a list of rooms for client display.
47 struct roomlisting *lnext;
48 struct roomlisting *rnext;
56 char floorlist[128][256];
58 struct march *march = NULL;
61 * load the list of floors
63 void load_floorlist(void)
68 for (a = 0; a < 128; ++a)
74 strcpy(floorlist[0], "Main Floor");
77 while (serv_gets(buf), strcmp(buf, "000")) {
78 extract(floorlist[extract_int(buf, 0)], buf, 1);
84 * remove a room from the march list
86 void remove_march(char *aaa)
88 struct march *mptr, *mptr2;
93 if (!strcasecmp(march->march_name, aaa)) {
100 for (mptr = march; mptr != NULL; mptr = mptr->next) {
101 if (!strcasecmp(mptr->march_name, aaa)) {
102 mptr2->next = mptr->next;
115 void room_tree_list(struct roomlisting *rp)
123 if (rp->lnext != NULL) {
124 room_tree_list(rp->lnext);
126 strcpy(rmname, rp->rlname);
129 wprintf("<A HREF=\"/dotgoto&room=");
134 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
136 else if (f & QR_DIRECTORY)
138 else if (f & QR_NETWORK)
142 wprintf("</A><TT> </TT>\n");
144 if (rp->rnext != NULL) {
145 room_tree_list(rp->rnext);
152 * Room ordering stuff (compare first by floor, then by order)
154 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
156 if ((r1 == NULL) && (r2 == NULL))
162 if (r1->rlfloor < r2->rlfloor)
164 if (r1->rlfloor > r2->rlfloor)
166 if (r1->rlorder < r2->rlorder)
168 if (r1->rlorder > r2->rlorder)
175 * Common code for all room listings
177 void listrms(char *variety)
182 struct roomlisting *rl = NULL;
183 struct roomlisting *rp;
184 struct roomlisting *rs;
187 /* Ask the server for a room list */
194 while (serv_gets(buf), strcmp(buf, "000")) {
196 rp = malloc(sizeof(struct roomlisting));
197 extract(rp->rlname, buf, 0);
198 rp->rlflags = extract_int(buf, 1);
199 rp->rlfloor = extract_int(buf, 2);
200 rp->rlorder = extract_int(buf, 3);
209 if (rordercmp(rp, rs) < 0) {
210 if (rs->lnext == NULL) {
217 if (rs->rnext == NULL) {
229 /* If no rooms were listed, print an nbsp to make the cell
230 * borders show up anyway.
232 if (num_rooms == 0) wprintf(" ");
244 * list all rooms by floor
246 void list_all_rooms_by_floor(void)
253 wprintf("HTTP/1.0 200 OK\n");
256 wprintf("<TABLE width=100% border><TR><TH>Floor</TH>");
257 wprintf("<TH><FONT FACE=\"Arial,Helvetica,sans-serif\">Rooms with new messages</FONT></TH>");
258 wprintf("<TH><FONT FACE=\"Arial,Helvetica,sans-serif\">Rooms with no new messages</FONT></TH></TR>\n");
260 for (a = 0; a < 128; ++a)
261 if (floorlist[a][0] != 0) {
263 /* Floor name column */
264 wprintf("<TR><TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
266 serv_printf("OIMG _floorpic_|%d", a);
271 wprintf("<IMG SRC=\"/image&name=_floorpic_&parm=%d\" ALT=\"%s\">",
272 a, &floorlist[a][0]);
274 escputs(&floorlist[a][0]);
277 wprintf("</FONT></TD>");
279 /* Rooms with new messages column */
280 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
281 sprintf(buf, "LKRN %d", a);
283 wprintf("</FONT></TD>\n<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
285 /* Rooms with old messages column */
286 sprintf(buf, "LKRO %d", a);
288 wprintf("</FONT></TD></TR>\n");
290 wprintf("</TABLE>\n");
296 * list all forgotten rooms
298 void zapped_list(void)
300 wprintf("HTTP/1.0 200 OK\n");
302 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
303 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFFFF\"");
304 wprintf("<B>Zapped (forgotten) rooms</B>\n");
305 wprintf("</FONT></TD></TR></TABLE><BR>\n");
307 wprintf("<BR><BR>\n");
308 wprintf("Click on any room to un-zap it and goto that room.\n");
314 * read this room's info file (set v to 1 for verbose mode)
326 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
332 void embed_room_banner(char *got) {
335 static int remember_new_mail = (-1);
337 /* We need to have the information returned by a GOTO server command.
338 * If it isn't supplied, we fake it by issuing our own GOTO.
341 serv_printf("GOTO %s", WC->wc_roomname);
346 /* Check for new mail. */
347 WC->new_mail = extract_int(&got[4], 9);
349 /* Now start spewing HTML. */
350 wprintf("<CENTER><TABLE border=0><TR>");
352 if ((strlen(WC->ugname) > 0) && (strcasecmp(WC->ugname, WC->wc_roomname))) {
353 wprintf("<TD VALIGN=TOP><A HREF=\"/ungoto\">");
354 wprintf("<IMG SRC=\"/static/back.gif\" BORDER=0></A></TD>");
356 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\"><FONT SIZE=+2>%s</FONT><BR>", WC->wc_roomname);
357 wprintf("%d new of %d messages</FONT></TD>\n",
358 extract_int(&got[4], 1),
359 extract_int(&got[4], 2));
361 /* Display room graphic. The server doesn't actually
362 * need the room name, but we supply it in order to
363 * keep the browser from using a cached graphic from
366 serv_puts("OIMG _roompic_");
369 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
370 wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
371 urlescputs(WC->wc_roomname);
372 wprintf("\"></FONT></TD>");
376 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\">");
378 wprintf("</FONT></TD>");
380 /* Let the user know if new mail has arrived */
381 if ( (WC->new_mail > remember_new_mail) && (WC->new_mail>0) ) {
382 wprintf("<TD VALIGN=TOP>"
383 "<IMG SRC=\"/static/mail.gif\" border=0 "
384 "ALT=\"You have new mail\">"
385 "<BR><BLINK>%d</BLINK></TD>", WC->new_mail);
386 remember_new_mail = WC->new_mail;
389 wprintf("<TD VALIGN=TOP><A HREF=\"/gotonext\">");
390 wprintf("<IMG SRC=\"/static/forward.gif\" border=0></A></TD>");
391 wprintf("</TR></TABLE></CENTER>\n");
399 * generic routine to take the session to a new room
401 * display_name values: 0 = goto only
402 * 1 = goto and display
405 void gotoroom(char *gname, int display_name)
408 static long ls = (-1L);
412 wprintf("HTTP/1.0 200 OK\n");
413 printf("Pragma: no-cache\n");
414 printf("Cache-Control: no-store\n");
417 wprintf("<HTML><HEAD>\n"
418 "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"
420 wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
422 if (display_name != 2) {
423 /* store ungoto information */
424 strcpy(WC->ugname, WC->wc_roomname);
427 /* move to the new room */
428 serv_printf("GOTO %s", gname);
431 serv_puts("GOTO _BASEROOM_");
436 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
441 extract(WC->wc_roomname, &buf[4], 0);
442 WC->room_flags = extract_int(&buf[4], 4);
443 /* highest_msg_read = extract_int(&buf[4],6);
444 maxmsgnum = extract_int(&buf[4],5);
445 is_mail = (char) extract_int(&buf[4],7); */
446 ls = extract_long(&buf[4], 6);
449 WC->is_room_aide = WC->is_aide;
451 WC->is_room_aide = (char) extract_int(&buf[4], 8);
453 remove_march(WC->wc_roomname);
454 if (!strcasecmp(gname, "_BASEROOM_"))
457 /* Display the room banner */
459 embed_room_banner(buf);
462 strcpy(WC->wc_roomname, WC->wc_roomname);
467 * Locate the room on the march list which we most want to go to. Each room
468 * is measured given a "weight" of preference based on various factors.
470 char *pop_march(int desired_floor)
472 static char TheRoom[64];
474 int TheOrder = 32767;
477 struct march *mptr = NULL;
479 strcpy(TheRoom, "_BASEROOM_");
483 for (mptr = march; mptr != NULL; mptr = mptr->next) {
485 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
486 weight = weight + 10000;
487 if (mptr->march_floor == desired_floor)
488 weight = weight + 5000;
490 weight = weight + ((128 - (mptr->march_floor)) * 128);
491 weight = weight + (128 - (mptr->march_order));
493 if (weight > TheWeight) {
495 strcpy(TheRoom, mptr->march_name);
496 TheFloor = mptr->march_floor;
497 TheOrder = mptr->march_order;
505 /* Goto next room having unread messages.
506 * We want to skip over rooms that the user has already been to, and take the
507 * user back to the lobby when done. The room we end up in is placed in
508 * newroom - which is set to 0 (the lobby) initially.
509 * We start the search in the current room rather than the beginning to prevent
510 * two or more concurrent users from dragging each other back to the same room.
515 struct march *mptr, *mptr2;
518 /* First check to see if the march-mode list is already allocated.
519 * If it is, pop the first room off the list and go there.
526 while (serv_gets(buf), strcmp(buf, "000")) {
527 mptr = (struct march *) malloc(sizeof(struct march));
529 extract(mptr->march_name, buf, 0);
530 mptr->march_floor = extract_int(buf, 2);
531 mptr->march_order = extract_int(buf, 3);
536 while (mptr2->next != NULL)
541 /* add _BASEROOM_ to the end of the march list, so the user will end up
542 * in the system base room (usually the Lobby>) at the end of the loop
544 mptr = (struct march *) malloc(sizeof(struct march));
546 strcpy(mptr->march_name, "_BASEROOM_");
551 while (mptr2->next != NULL)
556 * ...and remove the room we're currently in, so a <G>oto doesn't make us
557 * walk around in circles
559 remove_march(WC->wc_roomname);
562 strcpy(next_room, pop_march(-1));
564 strcpy(next_room, "_BASEROOM_");
568 smart_goto(next_room);
572 void smart_goto(char *next_room) {
573 gotoroom(next_room, 0);
580 * mark all messages in current room as having been read
582 void slrp_highest(void)
587 serv_puts("SLRP HIGHEST");
590 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
597 * un-goto the previous room
603 if (!strcmp(WC->ugname, "")) {
604 smart_goto(WC->wc_roomname);
607 serv_printf("GOTO %s", WC->ugname);
610 smart_goto(WC->wc_roomname);
613 if (WC->uglsn >= 0L) {
614 serv_printf("SLRP %ld", WC->uglsn);
617 strcpy(buf, WC->ugname);
618 strcpy(WC->ugname, "");
623 * display the form for editing a room
625 void display_editroom(void)
629 char er_password[10];
631 char er_roomaide[26];
640 display_error(&buf[4]);
643 extract(er_name, &buf[4], 0);
644 extract(er_password, &buf[4], 1);
645 extract(er_dirname, &buf[4], 2);
646 er_flags = extract_int(&buf[4], 3);
647 er_floor = extract_int(&buf[4], 4);
650 wprintf("HTTP/1.0 200 OK\n");
653 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
654 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
655 wprintf("<B>Room administration</B>\n");
656 wprintf("</FONT></TD></TR></TABLE>\n");
659 "<LI><A HREF=\"/confirm_delete_room\">\n"
660 "Delete this room</A>\n"
661 "<LI><A HREF=\"/display_editroompic\">\n"
662 "Set or change the graphic for this room's banner</A>\n"
663 "<LI><A HREF=\"/display_editinfo\">\n"
664 "Edit this room's Info file</A>\n"
667 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
668 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
669 wprintf("<B>Room editing</B>\n");
670 wprintf("</FONT></TD></TR></TABLE>\n");
672 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
674 wprintf("<UL><LI>Name of room: ");
675 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
677 wprintf("<LI>Resides on floor: ");
679 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
680 for (i = 0; i < 128; ++i)
681 if (strlen(floorlist[i]) > 0) {
684 wprintf("SELECTED ");
685 wprintf("VALUE=\"%d\">", i);
686 escputs(floorlist[i]);
687 wprintf("</OPTION>\n");
689 wprintf("</SELECT>\n");
691 wprintf("<LI>Type of room:<UL>\n");
693 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
694 if ((er_flags & QR_PRIVATE) == 0)
696 wprintf("> Public room\n");
698 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
699 if ((er_flags & QR_PRIVATE) &&
700 (er_flags & QR_GUESSNAME))
702 wprintf("> Private - guess name\n");
704 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
705 if ((er_flags & QR_PRIVATE) &&
706 (er_flags & QR_PASSWORDED))
708 wprintf("> Private - require password:\n");
709 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
711 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
712 if ((er_flags & QR_PRIVATE)
713 && ((er_flags & QR_GUESSNAME) == 0)
714 && ((er_flags & QR_PASSWORDED) == 0))
716 wprintf("> Private - invitation only\n");
718 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
719 wprintf("> If private, cause current users to forget room\n");
723 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
724 if (er_flags & QR_PREFONLY)
726 wprintf("> Preferred users only\n");
728 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
729 if (er_flags & QR_READONLY)
731 wprintf("> Read-only room\n");
733 /* directory stuff */
734 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
735 if (er_flags & QR_DIRECTORY)
737 wprintf("> File directory room\n");
739 wprintf("<UL><LI>Directory name: ");
740 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
742 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
743 if (er_flags & QR_UPLOAD)
745 wprintf("> Uploading allowed\n");
747 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
748 if (er_flags & QR_DOWNLOAD)
750 wprintf("> Downloading allowed\n");
752 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
753 if (er_flags & QR_VISDIR)
755 wprintf("> Visible directory</UL>\n");
757 /* end of directory stuff */
759 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
760 if (er_flags & QR_NETWORK)
762 wprintf("> Network shared room\n");
764 /* start of anon options */
766 wprintf("<LI>Anonymous messages<UL>\n");
768 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
769 if (((er_flags & QR_ANONONLY) == 0)
770 && ((er_flags & QR_ANONOPT) == 0))
772 wprintf("> No anonymous messages\n");
774 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
775 if (er_flags & QR_ANONONLY)
777 wprintf("> All messages are anonymous\n");
779 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
780 if (er_flags & QR_ANONOPT)
782 wprintf("> Prompt user when entering messages</UL>\n");
784 /* end of anon options */
786 wprintf("<LI>Room aide: \n");
790 wprintf("<EM>%s</EM>\n", &buf[4]);
792 extract(er_roomaide, &buf[4], 0);
793 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
796 wprintf("</UL><CENTER>\n");
797 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
798 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
799 wprintf("</CENTER>\n");
806 * save new parameters for a room
812 char er_password[10];
814 char er_roomaide[26];
820 if (strcmp(bstr("sc"), "OK")) {
821 display_error("Cancelled. Changes were not saved.");
828 display_error(&buf[4]);
831 extract(er_name, &buf[4], 0);
832 extract(er_password, &buf[4], 1);
833 extract(er_dirname, &buf[4], 2);
834 er_flags = extract_int(&buf[4], 3);
836 strcpy(er_roomaide, bstr("er_roomaide"));
837 if (strlen(er_roomaide) == 0) {
841 strcpy(er_roomaide, "");
843 extract(er_roomaide, &buf[4], 0);
846 strcpy(buf, bstr("er_name"));
849 strcpy(er_name, buf);
851 strcpy(buf, bstr("er_password"));
854 strcpy(er_password, buf);
856 strcpy(buf, bstr("er_dirname"));
859 strcpy(er_dirname, buf);
861 strcpy(buf, bstr("type"));
862 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
864 if (!strcmp(buf, "invonly")) {
865 er_flags |= (QR_PRIVATE);
867 if (!strcmp(buf, "guessname")) {
868 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
870 if (!strcmp(buf, "passworded")) {
871 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
873 if (!strcmp(bstr("prefonly"), "yes")) {
874 er_flags |= QR_PREFONLY;
876 er_flags &= ~QR_PREFONLY;
879 if (!strcmp(bstr("readonly"), "yes")) {
880 er_flags |= QR_READONLY;
882 er_flags &= ~QR_READONLY;
885 if (!strcmp(bstr("network"), "yes")) {
886 er_flags |= QR_NETWORK;
888 er_flags &= ~QR_NETWORK;
891 if (!strcmp(bstr("directory"), "yes")) {
892 er_flags |= QR_DIRECTORY;
894 er_flags &= ~QR_DIRECTORY;
897 if (!strcmp(bstr("ulallowed"), "yes")) {
898 er_flags |= QR_UPLOAD;
900 er_flags &= ~QR_UPLOAD;
903 if (!strcmp(bstr("dlallowed"), "yes")) {
904 er_flags |= QR_DOWNLOAD;
906 er_flags &= ~QR_DOWNLOAD;
909 if (!strcmp(bstr("visdir"), "yes")) {
910 er_flags |= QR_VISDIR;
912 er_flags &= ~QR_VISDIR;
915 strcpy(buf, bstr("anon"));
917 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
918 if (!strcmp(buf, "anononly"))
919 er_flags |= QR_ANONONLY;
920 if (!strcmp(buf, "anon2"))
921 er_flags |= QR_ANONOPT;
924 if (!strcmp(bstr("bump"), "yes"))
927 er_floor = atoi(bstr("er_floor"));
929 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
930 er_name, er_password, er_dirname, er_flags, bump, er_floor);
934 display_error(&buf[4]);
937 gotoroom(er_name, 0);
939 if (strlen(er_roomaide) > 0) {
940 sprintf(buf, "SETA %s", er_roomaide);
944 display_error(&buf[4]);
954 * display the form for entering a new room
956 void display_entroom(void)
964 display_error(&buf[4]);
967 wprintf("HTTP/1.0 200 OK\n");
970 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
971 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
972 wprintf("<B>Enter (create) a new room</B>\n");
973 wprintf("</FONT></TD></TR></TABLE>\n");
975 wprintf("<FORM METHOD=\"POST\" ACTION=\"/entroom\">\n");
977 wprintf("<UL><LI>Name of room: ");
978 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"19\">\n");
980 wprintf("<LI>Type of room:<UL>\n");
982 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
983 wprintf("CHECKED > Public room\n");
985 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
986 wprintf("> Private - guess name\n");
988 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
989 wprintf("> Private - require password:\n");
990 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
992 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
993 wprintf("> Private - invitation only\n");
995 wprintf("<CENTER>\n");
996 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
997 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
998 wprintf("</CENTER>\n");
999 wprintf("</FORM>\n");
1013 char er_password[10];
1016 if (strcmp(bstr("sc"), "OK")) {
1017 display_error("Cancelled. No new room was created.");
1020 strcpy(er_name, bstr("er_name"));
1021 strcpy(er_type, bstr("type"));
1022 strcpy(er_password, bstr("er_password"));
1025 if (!strcmp(er_type, "guessname"))
1027 if (!strcmp(er_type, "passworded"))
1029 if (!strcmp(er_type, "invonly"))
1032 sprintf(buf, "CRE8 1|%s|%d|%s", er_name, er_num_type, er_password);
1035 if (buf[0] != '2') {
1036 display_error(&buf[4]);
1039 smart_goto(er_name);
1044 * display the screen to enter a private room
1046 void display_private(char *rname, int req_pass)
1049 wprintf("HTTP/1.0 200 OK\n");
1052 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1053 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1054 wprintf("<B>Goto a private room</B>\n");
1055 wprintf("</FONT></TD></TR></TABLE>\n");
1057 wprintf("<CENTER>\n");
1058 wprintf("If you know the name of a hidden (guess-name) or\n");
1059 wprintf("passworded room, you can enter that room by typing\n");
1060 wprintf("its name below. Once you gain access to a private\n");
1061 wprintf("room, it will appear in your regular room listings\n");
1062 wprintf("so you don't have to keep returning here.\n");
1063 wprintf("<BR><BR>");
1065 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
1067 wprintf("<TABLE border><TR><TD>");
1068 wprintf("Enter room name:</TD><TD>");
1069 wprintf("<INPUT TYPE=\"text\" NAME=\"gr_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1072 wprintf("</TD></TR><TR><TD>");
1073 wprintf("Enter room password:</TD><TD>");
1074 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1076 wprintf("</TD></TR></TABLE>\n");
1078 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1079 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1080 wprintf("</FORM>\n");
1085 * goto a private room
1087 void goto_private(void)
1092 if (strcasecmp(bstr("sc"), "OK")) {
1093 display_main_menu();
1096 strcpy(hold_rm, WC->wc_roomname);
1097 strcpy(buf, "GOTO ");
1098 strcat(buf, bstr("gr_name"));
1100 strcat(buf, bstr("gr_pass"));
1104 if (buf[0] == '2') {
1105 smart_goto(bstr("gr_name"));
1108 if (!strncmp(buf, "540", 3)) {
1109 display_private(bstr("gr_name"), 1);
1112 wprintf("HTTP/1.0 200 OK\n");
1114 wprintf("%s\n", &buf[4]);
1121 * display the screen to zap a room
1123 void display_zap(void)
1125 wprintf("HTTP/1.0 200 OK\n");
1128 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1129 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1130 wprintf("<B>Zap (forget) the current room</B>\n");
1131 wprintf("</FONT></TD></TR></TABLE>\n");
1133 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
1134 wprintf("disappear from your room list. Is this what you wish ");
1135 wprintf("to do?<BR>\n");
1137 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
1138 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1139 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1140 wprintf("</FORM>\n");
1151 char final_destination[256];
1153 /* If the forget-room routine fails for any reason, we fall back
1154 * to the current room; otherwise, we go to the Lobby
1156 strcpy(final_destination, WC->wc_roomname);
1158 if (!strcasecmp(bstr("sc"), "OK")) {
1159 serv_printf("GOTO %s", WC->wc_roomname);
1161 if (buf[0] != '2') {
1162 ExpressMessageCat(&buf[4]);
1166 if (buf[0] != '2') {
1167 ExpressMessageCat(&buf[4]);
1169 strcpy(final_destination, "_BASEROOM_");
1173 smart_goto(final_destination);
1180 * Confirm deletion of the current room
1182 void confirm_delete_room(void)
1186 serv_puts("KILL 0");
1188 if (buf[0] != '2') {
1189 display_error(&buf[4]);
1192 wprintf("HTTP/1.0 200 OK\n");
1194 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1195 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1196 wprintf("<B>Confirm deletion of room</B>\n");
1197 wprintf("</FONT></TD></TR></TABLE>\n");
1199 wprintf("<CENTER>");
1200 wprintf("<FORM METHOD=\"POST\" ACTION=\"/delete_room\">\n");
1202 wprintf("Are you sure you want to delete <FONT SIZE=+1>");
1203 escputs(WC->wc_roomname);
1204 wprintf("</FONT>?<BR>\n");
1206 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Delete\">");
1207 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1209 wprintf("</FORM></CENTER>\n");
1215 * Delete the current room
1217 void delete_room(void)
1222 strcpy(sc, bstr("sc"));
1224 if (strcasecmp(sc, "Delete")) {
1225 display_error("Cancelled. This room was not deleted.");
1228 serv_puts("KILL 1");
1230 if (buf[0] != '2') {
1231 display_error(&buf[4]);
1233 smart_goto("_BASEROOM_");