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];
40 struct march *march = NULL;
43 * load the list of floors
45 void load_floorlist(void)
50 for (a = 0; a < 128; ++a)
56 strcpy(floorlist[0], "Main Floor");
59 while (serv_gets(buf), strcmp(buf, "000")) {
60 extract(floorlist[extract_int(buf, 0)], buf, 1);
66 * remove a room from the march list
68 void remove_march(char *aaa)
70 struct march *mptr, *mptr2;
75 if (!strcasecmp(march->march_name, aaa)) {
82 for (mptr = march; mptr != NULL; mptr = mptr->next) {
83 if (!strcasecmp(mptr->march_name, aaa)) {
84 mptr2->next = mptr->next;
97 void room_tree_list(struct roomlisting *rp)
105 if (rp->lnext != NULL) {
106 room_tree_list(rp->lnext);
108 strcpy(rmname, rp->rlname);
111 wprintf("<A HREF=\"/dotgoto&room=");
116 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
118 else if (f & QR_DIRECTORY)
120 else if (f & QR_NETWORK)
124 wprintf("</A><TT> </TT>\n");
126 if (rp->rnext != NULL) {
127 room_tree_list(rp->rnext);
134 * Room ordering stuff (compare first by floor, then by order)
136 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
138 if ((r1 == NULL) && (r2 == NULL))
144 if (r1->rlfloor < r2->rlfloor)
146 if (r1->rlfloor > r2->rlfloor)
148 if (r1->rlorder < r2->rlorder)
150 if (r1->rlorder > r2->rlorder)
157 * Common code for all room listings
159 void listrms(char *variety)
164 struct roomlisting *rl = NULL;
165 struct roomlisting *rp;
166 struct roomlisting *rs;
169 /* Ask the server for a room list */
176 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) {
211 /* If no rooms were listed, print an nbsp to make the cell
212 * borders show up anyway.
214 if (num_rooms == 0) wprintf(" ");
226 * list all rooms by floor
228 void list_all_rooms_by_floor(void)
235 printf("HTTP/1.0 200 OK\n");
238 wprintf("<TABLE width=100% border><TR><TH>Floor</TH>");
239 wprintf("<TH><FONT FACE=\"Arial,Helvetica,sans-serif\">Rooms with new messages</FONT></TH>");
240 wprintf("<TH><FONT FACE=\"Arial,Helvetica,sans-serif\">Rooms with no new messages</FONT></TH></TR>\n");
242 for (a = 0; a < 128; ++a)
243 if (floorlist[a][0] != 0) {
245 /* Floor name column */
246 wprintf("<TR><TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
248 serv_printf("OIMG _floorpic_|%d", a);
253 wprintf("<IMG SRC=\"/image&name=_floorpic_&parm=%d\" ALT=\"%s\">",
254 a, &floorlist[a][0]);
256 escputs(&floorlist[a][0]);
259 wprintf("</FONT></TD>");
261 /* Rooms with new messages column */
262 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
263 sprintf(buf, "LKRN %d", a);
265 wprintf("</FONT></TD>\n<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
267 /* Rooms with old messages column */
268 sprintf(buf, "LKRO %d", a);
270 wprintf("</FONT></TD></TR>\n");
272 wprintf("</TABLE>\n");
278 * list all forgotten rooms
280 void zapped_list(void)
282 printf("HTTP/1.0 200 OK\n");
284 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
285 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFFFF\"");
286 wprintf("<B>Zapped (forgotten) rooms</B>\n");
287 wprintf("</FONT></TD></TR></TABLE><BR>\n");
289 wprintf("<BR><BR>\n");
290 wprintf("Click on any room to un-zap it and goto that room.\n");
296 * read this room's info file (set v to 1 for verbose mode)
308 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
314 void embed_room_banner(char *got) {
317 static int remember_new_mail = (-1);
319 /* We need to have the information returned by a GOTO server command.
320 * If it isn't supplied, we fake it by issuing our own GOTO.
323 serv_printf("GOTO %s", WC->wc_roomname);
328 /* Check for new mail. */
329 WC->new_mail = extract_int(&got[4], 9);
331 /* Now start spewing HTML. */
332 wprintf("<CENTER><TABLE border=0><TR>");
334 if ((strlen(WC->ugname) > 0) && (strcasecmp(WC->ugname, WC->wc_roomname))) {
335 wprintf("<TD VALIGN=TOP><A HREF=\"/ungoto\">");
336 wprintf("<IMG SRC=\"/static/back.gif\" BORDER=0></A></TD>");
338 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\"><FONT SIZE=+2>%s</FONT><BR>", WC->wc_roomname);
339 wprintf("%d new of %d messages</FONT></TD>\n",
340 extract_int(&got[4], 1),
341 extract_int(&got[4], 2));
343 /* Display room graphic. The server doesn't actually
344 * need the room name, but we supply it in order to
345 * keep the browser from using a cached graphic from
348 serv_puts("OIMG _roompic_");
351 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
352 wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
353 urlescputs(WC->wc_roomname);
354 wprintf("\"></FONT></TD>");
358 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\">");
360 wprintf("</FONT></TD>");
362 /* Let the user know if new mail has arrived */
363 if ( (WC->new_mail > remember_new_mail) && (WC->new_mail>0) ) {
364 wprintf("<TD VALIGN=TOP>"
365 "<IMG SRC=\"/static/mail.gif\" border=0 "
366 "ALT=\"You have new mail\">"
367 "<BR><BLINK>%d</BLINK></TD>", WC->new_mail);
368 remember_new_mail = WC->new_mail;
371 wprintf("<TD VALIGN=TOP><A HREF=\"/gotonext\">");
372 wprintf("<IMG SRC=\"/static/forward.gif\" border=0></A></TD>");
373 wprintf("</TR></TABLE></CENTER>\n");
381 * generic routine to take the session to a new room
383 * display_name values: 0 = goto only
384 * 1 = goto and display
387 void gotoroom(char *gname, int display_name)
390 static long ls = (-1L);
394 printf("HTTP/1.0 200 OK\n");
395 printf("Pragma: no-cache\n");
396 printf("Cache-Control: no-store\n");
399 wprintf("<HTML><HEAD>\n"
400 "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"
402 wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
404 if (display_name != 2) {
405 /* store ungoto information */
406 strcpy(WC->ugname, WC->wc_roomname);
409 /* move to the new room */
410 serv_printf("GOTO %s", gname);
413 serv_puts("GOTO _BASEROOM_");
418 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
423 extract(WC->wc_roomname, &buf[4], 0);
424 WC->room_flags = extract_int(&buf[4], 4);
425 /* highest_msg_read = extract_int(&buf[4],6);
426 maxmsgnum = extract_int(&buf[4],5);
427 is_mail = (char) extract_int(&buf[4],7); */
428 ls = extract_long(&buf[4], 6);
431 WC->is_room_aide = WC->is_aide;
433 WC->is_room_aide = (char) extract_int(&buf[4], 8);
435 remove_march(WC->wc_roomname);
436 if (!strcasecmp(gname, "_BASEROOM_"))
439 /* Display the room banner */
441 embed_room_banner(buf);
444 strcpy(WC->wc_roomname, WC->wc_roomname);
449 * Locate the room on the march list which we most want to go to. Each room
450 * is measured given a "weight" of preference based on various factors.
452 char *pop_march(int desired_floor)
454 static char TheRoom[64];
456 int TheOrder = 32767;
459 struct march *mptr = NULL;
461 strcpy(TheRoom, "_BASEROOM_");
465 for (mptr = march; mptr != NULL; mptr = mptr->next) {
467 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
468 weight = weight + 10000;
469 if (mptr->march_floor == desired_floor)
470 weight = weight + 5000;
472 weight = weight + ((128 - (mptr->march_floor)) * 128);
473 weight = weight + (128 - (mptr->march_order));
475 if (weight > TheWeight) {
477 strcpy(TheRoom, mptr->march_name);
478 TheFloor = mptr->march_floor;
479 TheOrder = mptr->march_order;
487 /* Goto next room having unread messages.
488 * We want to skip over rooms that the user has already been to, and take the
489 * user back to the lobby when done. The room we end up in is placed in
490 * newroom - which is set to 0 (the lobby) initially.
491 * We start the search in the current room rather than the beginning to prevent
492 * two or more concurrent users from dragging each other back to the same room.
497 struct march *mptr, *mptr2;
500 /* First check to see if the march-mode list is already allocated.
501 * If it is, pop the first room off the list and go there.
508 while (serv_gets(buf), strcmp(buf, "000")) {
509 mptr = (struct march *) malloc(sizeof(struct march));
511 extract(mptr->march_name, buf, 0);
512 mptr->march_floor = extract_int(buf, 2);
513 mptr->march_order = extract_int(buf, 3);
518 while (mptr2->next != NULL)
523 /* add _BASEROOM_ to the end of the march list, so the user will end up
524 * in the system base room (usually the Lobby>) at the end of the loop
526 mptr = (struct march *) malloc(sizeof(struct march));
528 strcpy(mptr->march_name, "_BASEROOM_");
533 while (mptr2->next != NULL)
538 * ...and remove the room we're currently in, so a <G>oto doesn't make us
539 * walk around in circles
541 remove_march(WC->wc_roomname);
544 strcpy(next_room, pop_march(-1));
546 strcpy(next_room, "_BASEROOM_");
550 smart_goto(next_room);
554 void smart_goto(char *next_room) {
555 gotoroom(next_room, 0);
562 * mark all messages in current room as having been read
564 void slrp_highest(void)
569 serv_puts("SLRP HIGHEST");
572 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
579 * un-goto the previous room
585 if (!strcmp(WC->ugname, "")) {
586 smart_goto(WC->wc_roomname);
589 serv_printf("GOTO %s", WC->ugname);
592 smart_goto(WC->wc_roomname);
595 if (WC->uglsn >= 0L) {
596 serv_printf("SLRP %ld", WC->uglsn);
599 strcpy(buf, WC->ugname);
600 strcpy(WC->ugname, "");
605 * display the form for editing a room
607 void display_editroom(void)
611 char er_password[10];
613 char er_roomaide[26];
622 display_error(&buf[4]);
625 extract(er_name, &buf[4], 0);
626 extract(er_password, &buf[4], 1);
627 extract(er_dirname, &buf[4], 2);
628 er_flags = extract_int(&buf[4], 3);
629 er_floor = extract_int(&buf[4], 4);
632 printf("HTTP/1.0 200 OK\n");
635 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
636 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
637 wprintf("<B>Room administration</B>\n");
638 wprintf("</FONT></TD></TR></TABLE>\n");
641 "<LI><A HREF=\"/confirm_delete_room\">\n"
642 "Delete this room</A>\n"
643 "<LI><A HREF=\"/display_editroompic\">\n"
644 "Set or change the graphic for this room's banner</A>\n"
645 "<LI><A HREF=\"/display_editinfo\">\n"
646 "Edit this room's Info file</A>\n"
649 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
650 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
651 wprintf("<B>Room editing</B>\n");
652 wprintf("</FONT></TD></TR></TABLE>\n");
654 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
656 wprintf("<UL><LI>Name of room: ");
657 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
659 wprintf("<LI>Resides on floor: ");
661 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
662 for (i = 0; i < 128; ++i)
663 if (strlen(floorlist[i]) > 0) {
666 wprintf("SELECTED ");
667 wprintf("VALUE=\"%d\">", i);
668 escputs(floorlist[i]);
669 wprintf("</OPTION>\n");
671 wprintf("</SELECT>\n");
673 wprintf("<LI>Type of room:<UL>\n");
675 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
676 if ((er_flags & QR_PRIVATE) == 0)
678 wprintf("> Public room\n");
680 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
681 if ((er_flags & QR_PRIVATE) &&
682 (er_flags & QR_GUESSNAME))
684 wprintf("> Private - guess name\n");
686 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
687 if ((er_flags & QR_PRIVATE) &&
688 (er_flags & QR_PASSWORDED))
690 wprintf("> Private - require password:\n");
691 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
693 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
694 if ((er_flags & QR_PRIVATE)
695 && ((er_flags & QR_GUESSNAME) == 0)
696 && ((er_flags & QR_PASSWORDED) == 0))
698 wprintf("> Private - invitation only\n");
700 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
701 wprintf("> If private, cause current users to forget room\n");
705 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
706 if (er_flags & QR_PREFONLY)
708 wprintf("> Preferred users only\n");
710 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
711 if (er_flags & QR_READONLY)
713 wprintf("> Read-only room\n");
715 /* directory stuff */
716 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
717 if (er_flags & QR_DIRECTORY)
719 wprintf("> File directory room\n");
721 wprintf("<UL><LI>Directory name: ");
722 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
724 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
725 if (er_flags & QR_UPLOAD)
727 wprintf("> Uploading allowed\n");
729 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
730 if (er_flags & QR_DOWNLOAD)
732 wprintf("> Downloading allowed\n");
734 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
735 if (er_flags & QR_VISDIR)
737 wprintf("> Visible directory</UL>\n");
739 /* end of directory stuff */
741 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
742 if (er_flags & QR_NETWORK)
744 wprintf("> Network shared room\n");
746 /* start of anon options */
748 wprintf("<LI>Anonymous messages<UL>\n");
750 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
751 if (((er_flags & QR_ANONONLY) == 0)
752 && ((er_flags & QR_ANONOPT) == 0))
754 wprintf("> No anonymous messages\n");
756 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
757 if (er_flags & QR_ANONONLY)
759 wprintf("> All messages are anonymous\n");
761 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
762 if (er_flags & QR_ANONOPT)
764 wprintf("> Prompt user when entering messages</UL>\n");
766 /* end of anon options */
768 wprintf("<LI>Room aide: \n");
772 wprintf("<EM>%s</EM>\n", &buf[4]);
774 extract(er_roomaide, &buf[4], 0);
775 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
778 wprintf("</UL><CENTER>\n");
779 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
780 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
781 wprintf("</CENTER>\n");
788 * save new parameters for a room
794 char er_password[10];
796 char er_roomaide[26];
802 if (strcmp(bstr("sc"), "OK")) {
803 display_error("Cancelled. Changes were not saved.");
810 display_error(&buf[4]);
813 extract(er_name, &buf[4], 0);
814 extract(er_password, &buf[4], 1);
815 extract(er_dirname, &buf[4], 2);
816 er_flags = extract_int(&buf[4], 3);
818 strcpy(er_roomaide, bstr("er_roomaide"));
819 if (strlen(er_roomaide) == 0) {
823 strcpy(er_roomaide, "");
825 extract(er_roomaide, &buf[4], 0);
828 strcpy(buf, bstr("er_name"));
831 strcpy(er_name, buf);
833 strcpy(buf, bstr("er_password"));
836 strcpy(er_password, buf);
838 strcpy(buf, bstr("er_dirname"));
841 strcpy(er_dirname, buf);
843 strcpy(buf, bstr("type"));
844 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
846 if (!strcmp(buf, "invonly")) {
847 er_flags |= (QR_PRIVATE);
849 if (!strcmp(buf, "guessname")) {
850 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
852 if (!strcmp(buf, "passworded")) {
853 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
855 if (!strcmp(bstr("prefonly"), "yes")) {
856 er_flags |= QR_PREFONLY;
858 er_flags &= ~QR_PREFONLY;
861 if (!strcmp(bstr("readonly"), "yes")) {
862 er_flags |= QR_READONLY;
864 er_flags &= ~QR_READONLY;
867 if (!strcmp(bstr("network"), "yes")) {
868 er_flags |= QR_NETWORK;
870 er_flags &= ~QR_NETWORK;
873 if (!strcmp(bstr("directory"), "yes")) {
874 er_flags |= QR_DIRECTORY;
876 er_flags &= ~QR_DIRECTORY;
879 if (!strcmp(bstr("ulallowed"), "yes")) {
880 er_flags |= QR_UPLOAD;
882 er_flags &= ~QR_UPLOAD;
885 if (!strcmp(bstr("dlallowed"), "yes")) {
886 er_flags |= QR_DOWNLOAD;
888 er_flags &= ~QR_DOWNLOAD;
891 if (!strcmp(bstr("visdir"), "yes")) {
892 er_flags |= QR_VISDIR;
894 er_flags &= ~QR_VISDIR;
897 strcpy(buf, bstr("anon"));
899 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
900 if (!strcmp(buf, "anononly"))
901 er_flags |= QR_ANONONLY;
902 if (!strcmp(buf, "anon2"))
903 er_flags |= QR_ANONOPT;
906 if (!strcmp(bstr("bump"), "yes"))
909 er_floor = atoi(bstr("er_floor"));
911 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
912 er_name, er_password, er_dirname, er_flags, bump, er_floor);
916 display_error(&buf[4]);
919 gotoroom(er_name, 0);
921 if (strlen(er_roomaide) > 0) {
922 sprintf(buf, "SETA %s", er_roomaide);
926 display_error(&buf[4]);
936 * display the form for entering a new room
938 void display_entroom(void)
946 display_error(&buf[4]);
949 printf("HTTP/1.0 200 OK\n");
952 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
953 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
954 wprintf("<B>Enter (create) a new room</B>\n");
955 wprintf("</FONT></TD></TR></TABLE>\n");
957 wprintf("<FORM METHOD=\"POST\" ACTION=\"/entroom\">\n");
959 wprintf("<UL><LI>Name of room: ");
960 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"19\">\n");
962 wprintf("<LI>Type of room:<UL>\n");
964 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
965 wprintf("CHECKED > Public room\n");
967 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
968 wprintf("> Private - guess name\n");
970 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
971 wprintf("> Private - require password:\n");
972 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
974 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
975 wprintf("> Private - invitation only\n");
977 wprintf("<CENTER>\n");
978 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
979 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
980 wprintf("</CENTER>\n");
981 wprintf("</FORM>\n");
995 char er_password[10];
998 if (strcmp(bstr("sc"), "OK")) {
999 display_error("Cancelled. No new room was created.");
1002 strcpy(er_name, bstr("er_name"));
1003 strcpy(er_type, bstr("type"));
1004 strcpy(er_password, bstr("er_password"));
1007 if (!strcmp(er_type, "guessname"))
1009 if (!strcmp(er_type, "passworded"))
1011 if (!strcmp(er_type, "invonly"))
1014 sprintf(buf, "CRE8 1|%s|%d|%s", er_name, er_num_type, er_password);
1017 if (buf[0] != '2') {
1018 display_error(&buf[4]);
1021 smart_goto(er_name);
1026 * display the screen to enter a private room
1028 void display_private(char *rname, int req_pass)
1031 printf("HTTP/1.0 200 OK\n");
1034 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1035 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1036 wprintf("<B>Goto a private room</B>\n");
1037 wprintf("</FONT></TD></TR></TABLE>\n");
1039 wprintf("<CENTER>\n");
1040 wprintf("If you know the name of a hidden (guess-name) or\n");
1041 wprintf("passworded room, you can enter that room by typing\n");
1042 wprintf("its name below. Once you gain access to a private\n");
1043 wprintf("room, it will appear in your regular room listings\n");
1044 wprintf("so you don't have to keep returning here.\n");
1045 wprintf("<BR><BR>");
1047 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
1049 wprintf("<TABLE border><TR><TD>");
1050 wprintf("Enter room name:</TD><TD>");
1051 wprintf("<INPUT TYPE=\"text\" NAME=\"gr_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1054 wprintf("</TD></TR><TR><TD>");
1055 wprintf("Enter room password:</TD><TD>");
1056 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1058 wprintf("</TD></TR></TABLE>\n");
1060 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1061 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1062 wprintf("</FORM>\n");
1067 * goto a private room
1069 void goto_private(void)
1074 if (strcasecmp(bstr("sc"), "OK")) {
1075 display_main_menu();
1078 strcpy(hold_rm, WC->wc_roomname);
1079 strcpy(buf, "GOTO ");
1080 strcat(buf, bstr("gr_name"));
1082 strcat(buf, bstr("gr_pass"));
1086 if (buf[0] == '2') {
1087 smart_goto(bstr("gr_name"));
1090 if (!strncmp(buf, "540", 3)) {
1091 display_private(bstr("gr_name"), 1);
1094 printf("HTTP/1.0 200 OK\n");
1096 wprintf("%s\n", &buf[4]);
1103 * display the screen to zap a room
1105 void display_zap(void)
1107 printf("HTTP/1.0 200 OK\n");
1110 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1111 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1112 wprintf("<B>Zap (forget) the current room</B>\n");
1113 wprintf("</FONT></TD></TR></TABLE>\n");
1115 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
1116 wprintf("disappear from your room list. Is this what you wish ");
1117 wprintf("to do?<BR>\n");
1119 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
1120 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1121 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1122 wprintf("</FORM>\n");
1133 char final_destination[256];
1135 /* If the forget-room routine fails for any reason, we fall back
1136 * to the current room; otherwise, we go to the Lobby
1138 strcpy(final_destination, WC->wc_roomname);
1140 if (!strcasecmp(bstr("sc"), "OK")) {
1141 serv_printf("GOTO %s", WC->wc_roomname);
1143 if (buf[0] != '2') {
1144 ExpressMessageCat(&buf[4]);
1148 if (buf[0] != '2') {
1149 ExpressMessageCat(&buf[4]);
1151 strcpy(final_destination, "_BASEROOM_");
1155 smart_goto(final_destination);
1162 * Confirm deletion of the current room
1164 void confirm_delete_room(void)
1168 serv_puts("KILL 0");
1170 if (buf[0] != '2') {
1171 display_error(&buf[4]);
1174 printf("HTTP/1.0 200 OK\n");
1176 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1177 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1178 wprintf("<B>Confirm deletion of room</B>\n");
1179 wprintf("</FONT></TD></TR></TABLE>\n");
1181 wprintf("<CENTER>");
1182 wprintf("<FORM METHOD=\"POST\" ACTION=\"/delete_room\">\n");
1184 wprintf("Are you sure you want to delete <FONT SIZE=+1>");
1185 escputs(WC->wc_roomname);
1186 wprintf("</FONT>?<BR>\n");
1188 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Delete\">");
1189 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1191 wprintf("</FORM></CENTER>\n");
1197 * Delete the current room
1199 void delete_room(void)
1204 strcpy(sc, bstr("sc"));
1206 if (strcasecmp(sc, "Delete")) {
1207 display_error("Cancelled. This room was not deleted.");
1210 serv_puts("KILL 1");
1212 if (buf[0] != '2') {
1213 display_error(&buf[4]);
1215 smart_goto("_BASEROOM_");