10 #include <sys/types.h>
12 #include <sys/socket.h>
15 #include <netinet/in.h>
31 char floorlist[128][256];
35 * load the list of floors
37 void load_floorlist(void)
42 for (a = 0; a < 128; ++a)
48 strcpy(floorlist[0], "Main Floor");
51 while (serv_gets(buf), strcmp(buf, "000")) {
52 extract(floorlist[extract_int(buf, 0)], buf, 1);
58 * remove a room from the march list
60 void remove_march(char *aaa)
62 struct march *mptr, *mptr2;
64 if (WC->march == NULL)
67 if (!strcasecmp(WC->march->march_name, aaa)) {
68 mptr = WC->march->next;
74 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
75 if (!strcasecmp(mptr->march_name, aaa)) {
76 mptr2->next = mptr->next;
89 void room_tree_list(struct roomlisting *rp)
97 if (rp->lnext != NULL) {
98 room_tree_list(rp->lnext);
100 strcpy(rmname, rp->rlname);
103 wprintf("<A HREF=\"/dotgoto&room=");
108 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
110 else if (f & QR_DIRECTORY)
112 else if (f & QR_NETWORK)
116 wprintf("</A><TT> </TT>\n");
118 if (rp->rnext != NULL) {
119 room_tree_list(rp->rnext);
126 * Room ordering stuff (compare first by floor, then by order)
128 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
130 if ((r1 == NULL) && (r2 == NULL))
136 if (r1->rlfloor < r2->rlfloor)
138 if (r1->rlfloor > r2->rlfloor)
140 if (r1->rlorder < r2->rlorder)
142 if (r1->rlorder > r2->rlorder)
149 * Common code for all room listings
151 void listrms(char *variety)
156 struct roomlisting *rl = NULL;
157 struct roomlisting *rp;
158 struct roomlisting *rs;
161 /* Ask the server for a room list */
168 while (serv_gets(buf), strcmp(buf, "000")) {
170 rp = malloc(sizeof(struct roomlisting));
171 extract(rp->rlname, buf, 0);
172 rp->rlflags = extract_int(buf, 1);
173 rp->rlfloor = extract_int(buf, 2);
174 rp->rlorder = extract_int(buf, 3);
183 if (rordercmp(rp, rs) < 0) {
184 if (rs->lnext == NULL) {
191 if (rs->rnext == NULL) {
203 /* If no rooms were listed, print an nbsp to make the cell
204 * borders show up anyway.
206 if (num_rooms == 0) wprintf(" ");
218 * list all rooms by floor
220 void list_all_rooms_by_floor(void)
229 wprintf("<TABLE width=100%% border><TR><TH>Floor</TH>");
230 wprintf("<TH>Rooms with new messages</TH>");
231 wprintf("<TH>Rooms with no new messages</TH></TR>\n");
233 for (a = 0; a < 128; ++a)
234 if (floorlist[a][0] != 0) {
236 /* Floor name column */
239 serv_printf("OIMG _floorpic_|%d", a);
244 wprintf("<IMG SRC=\"/image&name=_floorpic_&parm=%d\" ALT=\"%s\">",
245 a, &floorlist[a][0]);
247 escputs(&floorlist[a][0]);
252 /* Rooms with new messages column */
254 sprintf(buf, "LKRN %d", a);
256 wprintf("</TD>\n<TD>");
258 /* Rooms with old messages column */
259 sprintf(buf, "LKRO %d", a);
261 wprintf("</TD></TR>\n");
263 wprintf("</TABLE>\n");
269 * list all forgotten rooms
271 void zapped_list(void)
274 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
275 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
276 wprintf("<B>Zapped (forgotten) rooms</B>\n");
277 wprintf("</TD></TR></TABLE><BR>\n");
279 wprintf("<BR><BR>\n");
280 wprintf("Click on any room to un-zap it and goto that room.\n");
286 * read this room's info file (set v to 1 for verbose mode)
295 wprintf("<FONT SIZE=-1>");
304 /* Display room graphic. The server doesn't actually
305 * need the room name, but we supply it in order to
306 * keep the browser from using a cached graphic from
309 void embed_room_graphic(void) {
312 serv_puts("OIMG _roompic_");
316 wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
317 urlescputs(WC->wc_roomname);
326 /* Let the user know if new mail has arrived
328 void embed_newmail_button(void) {
329 if ( (WC->new_mail > WC->remember_new_mail) && (WC->new_mail>0) ) {
330 wprintf("<TD VALIGN=TOP>"
331 "<IMG SRC=\"/static/mail.gif\" border=0 "
332 "ALT=\"You have new mail\">"
333 "<BR><BLINK>%d</BLINK>", WC->new_mail);
334 wprintf("<FONT SIZE=-2> new mail messages</FONT></TD>");
335 WC->remember_new_mail = WC->new_mail;
341 void embed_room_banner(char *got) {
344 /* We need to have the information returned by a GOTO server command.
345 * If it isn't supplied, we fake it by issuing our own GOTO.
348 serv_printf("GOTO %s", WC->wc_roomname);
353 /* Check for new mail. */
354 WC->new_mail = extract_int(&got[4], 9);
356 svprintf("ROOMNAME", WCS_STRING, "%s", WC->wc_roomname);
357 svprintf("NEWMSGS", WCS_STRING, "%d", extract_int(&got[4], 1));
358 svprintf("TOTALMSGS", WCS_STRING, "%d", extract_int(&got[4], 2));
359 svcallback("ROOMPIC", embed_room_graphic);
360 svcallback("ROOMINFO", readinfo);
361 svcallback("YOUHAVEMAIL", embed_newmail_button);
363 do_template("roombanner.html");
364 clear_local_substs();
372 * generic routine to take the session to a new room
374 * display_name values: 0 = goto only
375 * 1 = goto and display
378 void gotoroom(char *gname, int display_name)
381 static long ls = (-1L);
386 wprintf("Pragma: no-cache\n");
387 wprintf("Cache-Control: no-store\n");
389 wprintf("<HTML><HEAD>\n"
390 "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"
392 do_template("background.html");
394 if (display_name != 2) {
395 /* store ungoto information */
396 strcpy(WC->ugname, WC->wc_roomname);
399 /* move to the new room */
400 serv_printf("GOTO %s", gname);
403 serv_puts("GOTO _BASEROOM_");
408 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
413 extract(WC->wc_roomname, &buf[4], 0);
414 WC->room_flags = extract_int(&buf[4], 4);
415 /* highest_msg_read = extract_int(&buf[4],6);
416 maxmsgnum = extract_int(&buf[4],5);
417 is_mail = (char) extract_int(&buf[4],7); */
418 ls = extract_long(&buf[4], 6);
421 WC->is_room_aide = WC->is_aide;
423 WC->is_room_aide = (char) extract_int(&buf[4], 8);
425 remove_march(WC->wc_roomname);
426 if (!strcasecmp(gname, "_BASEROOM_"))
429 /* Display the room banner */
431 embed_room_banner(buf);
434 strcpy(WC->wc_roomname, WC->wc_roomname);
439 * Locate the room on the march list which we most want to go to. Each room
440 * is measured given a "weight" of preference based on various factors.
442 char *pop_march(int desired_floor)
444 static char TheRoom[64];
446 int TheOrder = 32767;
449 struct march *mptr = NULL;
451 strcpy(TheRoom, "_BASEROOM_");
452 if (WC->march == NULL)
455 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
457 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
458 weight = weight + 10000;
459 if (mptr->march_floor == desired_floor)
460 weight = weight + 5000;
462 weight = weight + ((128 - (mptr->march_floor)) * 128);
463 weight = weight + (128 - (mptr->march_order));
465 if (weight > TheWeight) {
467 strcpy(TheRoom, mptr->march_name);
468 TheFloor = mptr->march_floor;
469 TheOrder = mptr->march_order;
477 /* Goto next room having unread messages.
478 * We want to skip over rooms that the user has already been to, and take the
479 * user back to the lobby when done. The room we end up in is placed in
480 * newroom - which is set to 0 (the lobby) initially.
481 * We start the search in the current room rather than the beginning to prevent
482 * two or more concurrent users from dragging each other back to the same room.
487 struct march *mptr, *mptr2;
490 /* First check to see if the march-mode list is already allocated.
491 * If it is, pop the first room off the list and go there.
494 if (WC->march == NULL) {
498 while (serv_gets(buf), strcmp(buf, "000")) {
499 mptr = (struct march *) malloc(sizeof(struct march));
501 extract(mptr->march_name, buf, 0);
502 mptr->march_floor = extract_int(buf, 2);
503 mptr->march_order = extract_int(buf, 3);
504 if (WC->march == NULL) {
508 while (mptr2->next != NULL)
513 /* add _BASEROOM_ to the end of the march list, so the user will end up
514 * in the system base room (usually the Lobby>) at the end of the loop
516 mptr = (struct march *) malloc(sizeof(struct march));
518 strcpy(mptr->march_name, "_BASEROOM_");
519 if (WC->march == NULL) {
523 while (mptr2->next != NULL)
528 * ...and remove the room we're currently in, so a <G>oto doesn't make us
529 * walk around in circles
531 remove_march(WC->wc_roomname);
533 if (WC->march != NULL) {
534 strcpy(next_room, pop_march(-1));
536 strcpy(next_room, "_BASEROOM_");
540 smart_goto(next_room);
544 void smart_goto(char *next_room) {
545 gotoroom(next_room, 0);
552 * mark all messages in current room as having been read
554 void slrp_highest(void)
559 serv_puts("SLRP HIGHEST");
562 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
569 * un-goto the previous room
575 if (!strcmp(WC->ugname, "")) {
576 smart_goto(WC->wc_roomname);
579 serv_printf("GOTO %s", WC->ugname);
582 smart_goto(WC->wc_roomname);
585 if (WC->uglsn >= 0L) {
586 serv_printf("SLRP %ld", WC->uglsn);
589 strcpy(buf, WC->ugname);
590 strcpy(WC->ugname, "");
595 * display the form for editing a room
597 void display_editroom(void)
601 char er_password[10];
603 char er_roomaide[26];
612 display_error(&buf[4]);
615 extract(er_name, &buf[4], 0);
616 extract(er_password, &buf[4], 1);
617 extract(er_dirname, &buf[4], 2);
618 er_flags = extract_int(&buf[4], 3);
619 er_floor = extract_int(&buf[4], 4);
624 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
625 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
626 wprintf("<B>Room administration</B>\n");
627 wprintf("</FONT></TD></TR></TABLE>\n");
630 "<LI><A HREF=\"/confirm_delete_room\">\n"
631 "Delete this room</A>\n"
632 "<LI><A HREF=\"/display_editroompic\">\n"
633 "Set or change the graphic for this room's banner</A>\n"
634 "<LI><A HREF=\"/display_editinfo\">\n"
635 "Edit this room's Info file</A>\n"
638 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
639 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
640 wprintf("<B>Room editing</B>\n");
641 wprintf("</FONT></TD></TR></TABLE>\n");
643 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
645 wprintf("<UL><LI>Name of room: ");
646 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
648 wprintf("<LI>Resides on floor: ");
650 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
651 for (i = 0; i < 128; ++i)
652 if (strlen(floorlist[i]) > 0) {
655 wprintf("SELECTED ");
656 wprintf("VALUE=\"%d\">", i);
657 escputs(floorlist[i]);
658 wprintf("</OPTION>\n");
660 wprintf("</SELECT>\n");
662 wprintf("<LI>Type of room:<UL>\n");
664 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
665 if ((er_flags & QR_PRIVATE) == 0)
667 wprintf("> Public room\n");
669 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
670 if ((er_flags & QR_PRIVATE) &&
671 (er_flags & QR_GUESSNAME))
673 wprintf("> Private - guess name\n");
675 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
676 if ((er_flags & QR_PRIVATE) &&
677 (er_flags & QR_PASSWORDED))
679 wprintf("> Private - require password:\n");
680 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
682 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
683 if ((er_flags & QR_PRIVATE)
684 && ((er_flags & QR_GUESSNAME) == 0)
685 && ((er_flags & QR_PASSWORDED) == 0))
687 wprintf("> Private - invitation only\n");
689 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
690 wprintf("> If private, cause current users to forget room\n");
694 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
695 if (er_flags & QR_PREFONLY)
697 wprintf("> Preferred users only\n");
699 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
700 if (er_flags & QR_READONLY)
702 wprintf("> Read-only room\n");
704 /* directory stuff */
705 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
706 if (er_flags & QR_DIRECTORY)
708 wprintf("> File directory room\n");
710 wprintf("<UL><LI>Directory name: ");
711 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
713 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
714 if (er_flags & QR_UPLOAD)
716 wprintf("> Uploading allowed\n");
718 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
719 if (er_flags & QR_DOWNLOAD)
721 wprintf("> Downloading allowed\n");
723 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
724 if (er_flags & QR_VISDIR)
726 wprintf("> Visible directory</UL>\n");
728 /* end of directory stuff */
730 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
731 if (er_flags & QR_NETWORK)
733 wprintf("> Network shared room\n");
735 /* start of anon options */
737 wprintf("<LI>Anonymous messages<UL>\n");
739 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
740 if (((er_flags & QR_ANONONLY) == 0)
741 && ((er_flags & QR_ANONOPT) == 0))
743 wprintf("> No anonymous messages\n");
745 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
746 if (er_flags & QR_ANONONLY)
748 wprintf("> All messages are anonymous\n");
750 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
751 if (er_flags & QR_ANONOPT)
753 wprintf("> Prompt user when entering messages</UL>\n");
755 /* end of anon options */
757 wprintf("<LI>Room aide: \n");
761 wprintf("<EM>%s</EM>\n", &buf[4]);
763 extract(er_roomaide, &buf[4], 0);
764 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
767 wprintf("</UL><CENTER>\n");
768 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
769 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
770 wprintf("</CENTER>\n");
777 * save new parameters for a room
783 char er_password[10];
785 char er_roomaide[26];
791 if (strcmp(bstr("sc"), "OK")) {
792 display_error("Cancelled. Changes were not saved.");
799 display_error(&buf[4]);
802 extract(er_name, &buf[4], 0);
803 extract(er_password, &buf[4], 1);
804 extract(er_dirname, &buf[4], 2);
805 er_flags = extract_int(&buf[4], 3);
807 strcpy(er_roomaide, bstr("er_roomaide"));
808 if (strlen(er_roomaide) == 0) {
812 strcpy(er_roomaide, "");
814 extract(er_roomaide, &buf[4], 0);
817 strcpy(buf, bstr("er_name"));
820 strcpy(er_name, buf);
822 strcpy(buf, bstr("er_password"));
825 strcpy(er_password, buf);
827 strcpy(buf, bstr("er_dirname"));
830 strcpy(er_dirname, buf);
832 strcpy(buf, bstr("type"));
833 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
835 if (!strcmp(buf, "invonly")) {
836 er_flags |= (QR_PRIVATE);
838 if (!strcmp(buf, "guessname")) {
839 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
841 if (!strcmp(buf, "passworded")) {
842 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
844 if (!strcmp(bstr("prefonly"), "yes")) {
845 er_flags |= QR_PREFONLY;
847 er_flags &= ~QR_PREFONLY;
850 if (!strcmp(bstr("readonly"), "yes")) {
851 er_flags |= QR_READONLY;
853 er_flags &= ~QR_READONLY;
856 if (!strcmp(bstr("network"), "yes")) {
857 er_flags |= QR_NETWORK;
859 er_flags &= ~QR_NETWORK;
862 if (!strcmp(bstr("directory"), "yes")) {
863 er_flags |= QR_DIRECTORY;
865 er_flags &= ~QR_DIRECTORY;
868 if (!strcmp(bstr("ulallowed"), "yes")) {
869 er_flags |= QR_UPLOAD;
871 er_flags &= ~QR_UPLOAD;
874 if (!strcmp(bstr("dlallowed"), "yes")) {
875 er_flags |= QR_DOWNLOAD;
877 er_flags &= ~QR_DOWNLOAD;
880 if (!strcmp(bstr("visdir"), "yes")) {
881 er_flags |= QR_VISDIR;
883 er_flags &= ~QR_VISDIR;
886 strcpy(buf, bstr("anon"));
888 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
889 if (!strcmp(buf, "anononly"))
890 er_flags |= QR_ANONONLY;
891 if (!strcmp(buf, "anon2"))
892 er_flags |= QR_ANONOPT;
895 if (!strcmp(bstr("bump"), "yes"))
898 er_floor = atoi(bstr("er_floor"));
900 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
901 er_name, er_password, er_dirname, er_flags, bump, er_floor);
905 display_error(&buf[4]);
908 gotoroom(er_name, 0);
910 if (strlen(er_roomaide) > 0) {
911 sprintf(buf, "SETA %s", er_roomaide);
915 display_error(&buf[4]);
923 * Invite, Kick, and show Who Knows a room
925 void display_whok(void)
927 char buf[256], room[256], username[256];
933 display_error(&buf[4]);
936 extract(room, &buf[4], 0);
938 strcpy(username, bstr("username"));
942 if(!strcmp(bstr("sc"), "Kick")) {
943 sprintf(buf, "KICK %s", username);
948 display_error(&buf[4]);
951 wprintf("User %s kicked out of room %s.\n",
954 } else if(!strcmp(bstr("sc"), "Invite")) {
955 sprintf(buf, "INVT %s", username);
960 display_error(&buf[4]);
963 wprintf("User %s invited to room %s.\n",
969 wprintf("<FORM METHOD=\"POST\" ACTION=\"/display_whok\">\n");
970 wprintf("<SELECT NAME=\"username\" SIZE=10>\n");
974 while (serv_gets(buf), strcmp(buf, "000")) {
975 extract(username, buf, 0);
981 wprintf("</SELECT>\n");
983 wprintf("<CENTER>\n");
984 wprintf("<input type=submit name=sc value=\"Kick\">");
985 wprintf("</CENTER>\n");
986 wprintf("</FORM>\n");
987 wprintf("<FORM METHOD=\"POST\" ACTION=\"/display_whok\">\n");
989 wprintf("<input type=text name=username>\n");
990 wprintf("<input type=hidden name=sc value=\"Invite\">");
991 wprintf("<input type=submit value=\"Invite\">");
998 * display the form for entering a new room
1000 void display_entroom(void)
1005 serv_puts("CRE8 0");
1008 if (buf[0] != '2') {
1009 display_error(&buf[4]);
1014 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=000077><TR><TD>");
1015 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1016 wprintf("<B>Enter (create) a new room</B>\n");
1017 wprintf("</FONT></TD></TR></TABLE>\n");
1019 wprintf("<FORM METHOD=\"POST\" ACTION=\"/entroom\">\n");
1021 wprintf("<UL><LI>Name of room: ");
1022 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"19\">\n");
1024 wprintf("<LI>Type of room:<UL>\n");
1026 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1027 wprintf("CHECKED > Public room\n");
1029 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
1030 wprintf("> Private - guess name\n");
1032 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1033 wprintf("> Private - require password:\n");
1034 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
1036 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1037 wprintf("> Private - invitation only\n");
1040 wprintf("<LI>Resides on floor: ");
1042 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1043 for (i = 0; i < 128; ++i)
1044 if (strlen(floorlist[i]) > 0) {
1045 wprintf("<OPTION ");
1046 wprintf("VALUE=\"%d\">", i);
1047 escputs(floorlist[i]);
1048 wprintf("</OPTION>\n");
1050 wprintf("</SELECT>\n");
1054 wprintf("<CENTER>\n");
1055 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1056 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1057 wprintf("</CENTER>\n");
1058 wprintf("</FORM>\n");
1072 char er_password[10];
1076 if (strcmp(bstr("sc"), "OK")) {
1077 display_error("Cancelled. No new room was created.");
1080 strcpy(er_name, bstr("er_name"));
1081 strcpy(er_type, bstr("type"));
1082 strcpy(er_password, bstr("er_password"));
1083 er_floor = atoi(bstr("er_floor"));
1086 if (!strcmp(er_type, "guessname"))
1088 if (!strcmp(er_type, "passworded"))
1090 if (!strcmp(er_type, "invonly"))
1093 sprintf(buf, "CRE8 1|%s|%d|%s|%d",
1094 er_name, er_num_type, er_password, er_floor);
1097 if (buf[0] != '2') {
1098 display_error(&buf[4]);
1101 smart_goto(er_name);
1106 * display the screen to enter a private room
1108 void display_private(char *rname, int req_pass)
1113 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
1114 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1115 wprintf("<B>Goto a private room</B>\n");
1116 wprintf("</FONT></TD></TR></TABLE>\n");
1118 wprintf("<CENTER>\n");
1119 wprintf("If you know the name of a hidden (guess-name) or\n");
1120 wprintf("passworded room, you can enter that room by typing\n");
1121 wprintf("its name below. Once you gain access to a private\n");
1122 wprintf("room, it will appear in your regular room listings\n");
1123 wprintf("so you don't have to keep returning here.\n");
1124 wprintf("<BR><BR>");
1126 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
1128 wprintf("<TABLE border><TR><TD>");
1129 wprintf("Enter room name:</TD><TD>");
1130 wprintf("<INPUT TYPE=\"text\" NAME=\"gr_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1133 wprintf("</TD></TR><TR><TD>");
1134 wprintf("Enter room password:</TD><TD>");
1135 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1137 wprintf("</TD></TR></TABLE>\n");
1139 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1140 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1141 wprintf("</FORM>\n");
1146 * goto a private room
1148 void goto_private(void)
1153 if (strcasecmp(bstr("sc"), "OK")) {
1154 display_main_menu();
1157 strcpy(hold_rm, WC->wc_roomname);
1158 strcpy(buf, "GOTO ");
1159 strcat(buf, bstr("gr_name"));
1161 strcat(buf, bstr("gr_pass"));
1165 if (buf[0] == '2') {
1166 smart_goto(bstr("gr_name"));
1169 if (!strncmp(buf, "540", 3)) {
1170 display_private(bstr("gr_name"), 1);
1174 wprintf("%s\n", &buf[4]);
1181 * display the screen to zap a room
1183 void display_zap(void)
1187 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
1188 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1189 wprintf("<B>Zap (forget) the current room</B>\n");
1190 wprintf("</FONT></TD></TR></TABLE>\n");
1192 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
1193 wprintf("disappear from your room list. Is this what you wish ");
1194 wprintf("to do?<BR>\n");
1196 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
1197 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1198 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1199 wprintf("</FORM>\n");
1210 char final_destination[256];
1212 /* If the forget-room routine fails for any reason, we fall back
1213 * to the current room; otherwise, we go to the Lobby
1215 strcpy(final_destination, WC->wc_roomname);
1217 if (!strcasecmp(bstr("sc"), "OK")) {
1218 serv_printf("GOTO %s", WC->wc_roomname);
1220 if (buf[0] != '2') {
1221 /* ExpressMessageCat(&buf[4]); FIXME */
1225 if (buf[0] != '2') {
1226 /* ExpressMessageCat(&buf[4]); FIXME */
1228 strcpy(final_destination, "_BASEROOM_");
1232 smart_goto(final_destination);
1239 * Confirm deletion of the current room
1241 void confirm_delete_room(void)
1245 serv_puts("KILL 0");
1247 if (buf[0] != '2') {
1248 display_error(&buf[4]);
1252 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=770000><TR><TD>");
1253 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1254 wprintf("<B>Confirm deletion of room</B>\n");
1255 wprintf("</FONT></TD></TR></TABLE>\n");
1257 wprintf("<CENTER>");
1258 wprintf("<FORM METHOD=\"POST\" ACTION=\"/delete_room\">\n");
1260 wprintf("Are you sure you want to delete <FONT SIZE=+1>");
1261 escputs(WC->wc_roomname);
1262 wprintf("</FONT>?<BR>\n");
1264 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Delete\">");
1265 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1267 wprintf("</FORM></CENTER>\n");
1273 * Delete the current room
1275 void delete_room(void)
1280 strcpy(sc, bstr("sc"));
1282 if (strcasecmp(sc, "Delete")) {
1283 display_error("Cancelled. This room was not deleted.");
1286 serv_puts("KILL 1");
1288 if (buf[0] != '2') {
1289 display_error(&buf[4]);
1291 smart_goto("_BASEROOM_");