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=");
121 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
123 else if (f & QR_DIRECTORY)
125 else if (f & QR_NETWORK)
129 wprintf("</A><TT> </TT>\n");
131 if (rp->rnext != NULL) {
132 room_tree_list(rp->rnext);
139 * Room ordering stuff (compare first by floor, then by order)
141 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
143 if ((r1 == NULL) && (r2 == NULL))
149 if (r1->rlfloor < r2->rlfloor)
151 if (r1->rlfloor > r2->rlfloor)
153 if (r1->rlorder < r2->rlorder)
155 if (r1->rlorder > r2->rlorder)
162 * Common code for all room listings
164 void listrms(char *variety)
169 struct roomlisting *rl = NULL;
170 struct roomlisting *rp;
171 struct roomlisting *rs;
174 /* Ask the server for a room list */
181 while (serv_gets(buf), strcmp(buf, "000")) {
183 rp = malloc(sizeof(struct roomlisting));
184 extract(rp->rlname, buf, 0);
185 rp->rlflags = extract_int(buf, 1);
186 rp->rlfloor = extract_int(buf, 2);
187 rp->rlorder = extract_int(buf, 3);
196 if (rordercmp(rp, rs) < 0) {
197 if (rs->lnext == NULL) {
204 if (rs->rnext == NULL) {
216 /* If no rooms were listed, print an nbsp to make the cell
217 * borders show up anyway.
219 if (num_rooms == 0) wprintf(" ");
231 * list all rooms by floor
233 void list_all_rooms_by_floor(void)
240 printf("HTTP/1.0 200 OK\n");
243 wprintf("<TABLE width=100% border><TR><TH>Floor</TH>");
244 wprintf("<TH><FONT FACE=\"Arial,Helvetica,sans-serif\">Rooms with new messages</FONT></TH>");
245 wprintf("<TH><FONT FACE=\"Arial,Helvetica,sans-serif\">Rooms with no new messages</FONT></TH></TR>\n");
247 for (a = 0; a < 128; ++a)
248 if (floorlist[a][0] != 0) {
250 /* Floor name column */
251 wprintf("<TR><TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
253 serv_printf("OIMG _floorpic_|%d", a);
258 wprintf("<IMG SRC=\"/image&name=_floorpic_&parm=%d\" ALT=\"%s\">",
259 a, &floorlist[a][0]);
261 escputs(&floorlist[a][0]);
264 wprintf("</FONT></TD>");
266 /* Rooms with new messages column */
267 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
268 sprintf(buf, "LKRN %d", a);
270 wprintf("</FONT></TD>\n<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
272 /* Rooms with old messages column */
273 sprintf(buf, "LKRO %d", a);
275 wprintf("</FONT></TD></TR>\n");
277 wprintf("</TABLE>\n");
283 * list all forgotten rooms
285 void zapped_list(void)
287 printf("HTTP/1.0 200 OK\n");
289 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
290 wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFFFF\"");
291 wprintf("<B>Zapped (forgotten) rooms</B>\n");
292 wprintf("</FONT></TD></TR></TABLE><BR>\n");
294 wprintf("<BR><BR>\n");
295 wprintf("Click on any room to un-zap it and goto that room.\n");
301 * read this room's info file (set v to 1 for verbose mode)
313 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
319 void embed_room_banner(char *got) {
322 static int remember_new_mail = (-1);
324 /* We need to have the information returned by a GOTO server command.
325 * If it isn't supplied, we fake it by issuing our own GOTO.
328 serv_printf("GOTO %s", wc_roomname);
333 /* Check for new mail. */
334 new_mail = extract_int(&got[4], 9);
336 /* Now start spewing HTML. */
337 wprintf("<CENTER><TABLE border=0><TR>");
339 if ((strlen(ugname) > 0) && (strcasecmp(ugname, wc_roomname))) {
340 wprintf("<TD VALIGN=TOP><A HREF=\"/ungoto\">");
341 wprintf("<IMG SRC=\"/static/back.gif\" BORDER=0></A></TD>");
343 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\"><FONT SIZE=+2>%s</FONT><BR>", wc_roomname);
344 wprintf("%d new of %d messages</FONT></TD>\n",
345 extract_int(&got[4], 1),
346 extract_int(&got[4], 2));
348 /* Display room graphic. The server doesn't actually
349 * need the room name, but we supply it in order to
350 * keep the browser from using a cached graphic from
353 serv_puts("OIMG _roompic_");
356 wprintf("<TD><FONT FACE=\"Arial,Helvetica,sans-serif\">");
357 wprintf("<IMG SRC=\"/image&name=_roompic_&room=");
358 urlescputs(wc_roomname);
359 wprintf("\"></FONT></TD>");
363 wprintf("<TD VALIGN=TOP><FONT FACE=\"Arial,Helvetica,sans-serif\">");
365 wprintf("</FONT></TD>");
367 /* Let the user know if new mail has arrived */
368 if ( (new_mail > remember_new_mail) && (new_mail>0) ) {
369 wprintf("<TD VALIGN=TOP>"
370 "<IMG SRC=\"/static/mail.gif\" border=0 "
371 "ALT=\"You have new mail\">"
372 "<BR><BLINK>%d</BLINK></TD>", new_mail);
373 remember_new_mail = new_mail;
376 wprintf("<TD VALIGN=TOP><A HREF=\"/gotonext\">");
377 wprintf("<IMG SRC=\"/static/forward.gif\" border=0></A></TD>");
378 wprintf("</TR></TABLE></CENTER>\n");
386 * generic routine to take the session to a new room
388 * display_name values: 0 = goto only
389 * 1 = goto and display
392 void gotoroom(char *gname, int display_name)
395 static long ls = (-1L);
399 printf("HTTP/1.0 200 OK\n");
400 printf("Pragma: no-cache\n");
401 printf("Cache-Control: no-store\n");
404 wprintf("<HTML><HEAD>\n"
405 "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"
407 wprintf("BACKGROUND=\"/image&name=background\" TEXT=\"#000000\" LINK=\"#004400\">\n");
409 if (display_name != 2) {
410 /* store ungoto information */
411 strcpy(ugname, wc_roomname);
414 /* move to the new room */
415 serv_printf("GOTO %s", gname);
418 serv_puts("GOTO _BASEROOM_");
423 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
428 extract(wc_roomname, &buf[4], 0);
429 room_flags = extract_int(&buf[4], 4);
430 /* highest_msg_read = extract_int(&buf[4],6);
431 maxmsgnum = extract_int(&buf[4],5);
432 is_mail = (char) extract_int(&buf[4],7); */
433 ls = extract_long(&buf[4], 6);
436 is_room_aide = is_aide;
438 is_room_aide = (char) extract_int(&buf[4], 8);
440 remove_march(wc_roomname);
441 if (!strcasecmp(gname, "_BASEROOM_"))
444 /* Display the room banner */
446 embed_room_banner(buf);
449 strcpy(wc_roomname, wc_roomname);
454 * Locate the room on the march list which we most want to go to. Each room
455 * is measured given a "weight" of preference based on various factors.
457 char *pop_march(int desired_floor)
459 static char TheRoom[64];
461 int TheOrder = 32767;
464 struct march *mptr = NULL;
466 strcpy(TheRoom, "_BASEROOM_");
470 for (mptr = march; mptr != NULL; mptr = mptr->next) {
472 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
473 weight = weight + 10000;
474 if (mptr->march_floor == desired_floor)
475 weight = weight + 5000;
477 weight = weight + ((128 - (mptr->march_floor)) * 128);
478 weight = weight + (128 - (mptr->march_order));
480 if (weight > TheWeight) {
482 strcpy(TheRoom, mptr->march_name);
483 TheFloor = mptr->march_floor;
484 TheOrder = mptr->march_order;
492 /* Goto next room having unread messages.
493 * We want to skip over rooms that the user has already been to, and take the
494 * user back to the lobby when done. The room we end up in is placed in
495 * newroom - which is set to 0 (the lobby) initially.
496 * We start the search in the current room rather than the beginning to prevent
497 * two or more concurrent users from dragging each other back to the same room.
502 struct march *mptr, *mptr2;
505 /* First check to see if the march-mode list is already allocated.
506 * If it is, pop the first room off the list and go there.
513 while (serv_gets(buf), strcmp(buf, "000")) {
514 mptr = (struct march *) malloc(sizeof(struct march));
516 extract(mptr->march_name, buf, 0);
517 mptr->march_floor = extract_int(buf, 2);
518 mptr->march_order = extract_int(buf, 3);
523 while (mptr2->next != NULL)
528 /* add _BASEROOM_ to the end of the march list, so the user will end up
529 * in the system base room (usually the Lobby>) at the end of the loop
531 mptr = (struct march *) malloc(sizeof(struct march));
533 strcpy(mptr->march_name, "_BASEROOM_");
538 while (mptr2->next != NULL)
543 * ...and remove the room we're currently in, so a <G>oto doesn't make us
544 * walk around in circles
546 remove_march(wc_roomname);
549 strcpy(next_room, pop_march(-1));
551 strcpy(next_room, "_BASEROOM_");
555 smart_goto(next_room);
559 void smart_goto(char *next_room) {
560 gotoroom(next_room, 0);
567 * mark all messages in current room as having been read
569 void slrp_highest(void)
574 serv_puts("SLRP HIGHEST");
577 wprintf("<EM>%s</EM><BR>\n", &buf[4]);
584 * un-goto the previous room
590 if (!strcmp(ugname, "")) {
591 smart_goto(wc_roomname);
594 serv_printf("GOTO %s", ugname);
597 smart_goto(wc_roomname);
601 serv_printf("SLRP %ld", uglsn);
610 * display the form for editing a room
612 void display_editroom(void)
616 char er_password[10];
618 char er_roomaide[26];
627 display_error(&buf[4]);
630 extract(er_name, &buf[4], 0);
631 extract(er_password, &buf[4], 1);
632 extract(er_dirname, &buf[4], 2);
633 er_flags = extract_int(&buf[4], 3);
634 er_floor = extract_int(&buf[4], 4);
637 printf("HTTP/1.0 200 OK\n");
640 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
641 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
642 wprintf("<B>Edit this room</B>\n");
643 wprintf("</FONT></TD></TR></TABLE>\n");
645 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
647 wprintf("<UL><LI>Name of room: ");
648 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
650 wprintf("<LI>Resides on floor: ");
652 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
653 for (i = 0; i < 128; ++i)
654 if (strlen(floorlist[i]) > 0) {
657 wprintf("SELECTED ");
658 wprintf("VALUE=\"%d\">", i);
659 escputs(floorlist[i]);
660 wprintf("</OPTION>\n");
662 wprintf("</SELECT>\n");
664 wprintf("<LI>Type of room:<UL>\n");
666 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
667 if ((er_flags & QR_PRIVATE) == 0)
669 wprintf("> Public room\n");
671 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
672 if ((er_flags & QR_PRIVATE) &&
673 (er_flags & QR_GUESSNAME))
675 wprintf("> Private - guess name\n");
677 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
678 if ((er_flags & QR_PRIVATE) &&
679 (er_flags & QR_PASSWORDED))
681 wprintf("> Private - require password:\n");
682 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
684 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
685 if ((er_flags & QR_PRIVATE)
686 && ((er_flags & QR_GUESSNAME) == 0)
687 && ((er_flags & QR_PASSWORDED) == 0))
689 wprintf("> Private - invitation only\n");
691 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
692 wprintf("> If private, cause current users to forget room\n");
696 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
697 if (er_flags & QR_PREFONLY)
699 wprintf("> Preferred users only\n");
701 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
702 if (er_flags & QR_READONLY)
704 wprintf("> Read-only room\n");
706 /* directory stuff */
707 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
708 if (er_flags & QR_DIRECTORY)
710 wprintf("> File directory room\n");
712 wprintf("<UL><LI>Directory name: ");
713 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
715 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
716 if (er_flags & QR_UPLOAD)
718 wprintf("> Uploading allowed\n");
720 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
721 if (er_flags & QR_DOWNLOAD)
723 wprintf("> Downloading allowed\n");
725 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
726 if (er_flags & QR_VISDIR)
728 wprintf("> Visible directory</UL>\n");
730 /* end of directory stuff */
732 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
733 if (er_flags & QR_NETWORK)
735 wprintf("> Network shared room\n");
737 /* start of anon options */
739 wprintf("<LI>Anonymous messages<UL>\n");
741 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
742 if (((er_flags & QR_ANONONLY) == 0)
743 && ((er_flags & QR_ANONOPT) == 0))
745 wprintf("> No anonymous messages\n");
747 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
748 if (er_flags & QR_ANONONLY)
750 wprintf("> All messages are anonymous\n");
752 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
753 if (er_flags & QR_ANONOPT)
755 wprintf("> Prompt user when entering messages</UL>\n");
757 /* end of anon options */
759 wprintf("<LI>Room aide: \n");
763 wprintf("<EM>%s</EM>\n", &buf[4]);
765 extract(er_roomaide, &buf[4], 0);
766 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
769 wprintf("</UL><CENTER>\n");
770 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
771 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
772 wprintf("</CENTER>\n");
779 * save new parameters for a room
785 char er_password[10];
787 char er_roomaide[26];
793 if (strcmp(bstr("sc"), "OK")) {
794 display_error("Cancelled. Changes were not saved.");
801 display_error(&buf[4]);
804 extract(er_name, &buf[4], 0);
805 extract(er_password, &buf[4], 1);
806 extract(er_dirname, &buf[4], 2);
807 er_flags = extract_int(&buf[4], 3);
809 strcpy(er_roomaide, bstr("er_roomaide"));
810 if (strlen(er_roomaide) == 0) {
814 strcpy(er_roomaide, "");
816 extract(er_roomaide, &buf[4], 0);
819 strcpy(buf, bstr("er_name"));
822 strcpy(er_name, buf);
824 strcpy(buf, bstr("er_password"));
827 strcpy(er_password, buf);
829 strcpy(buf, bstr("er_dirname"));
832 strcpy(er_dirname, buf);
834 strcpy(buf, bstr("type"));
835 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
837 if (!strcmp(buf, "invonly")) {
838 er_flags |= (QR_PRIVATE);
840 if (!strcmp(buf, "guessname")) {
841 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
843 if (!strcmp(buf, "passworded")) {
844 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
846 if (!strcmp(bstr("prefonly"), "yes")) {
847 er_flags |= QR_PREFONLY;
849 er_flags &= ~QR_PREFONLY;
852 if (!strcmp(bstr("readonly"), "yes")) {
853 er_flags |= QR_READONLY;
855 er_flags &= ~QR_READONLY;
858 if (!strcmp(bstr("network"), "yes")) {
859 er_flags |= QR_NETWORK;
861 er_flags &= ~QR_NETWORK;
864 if (!strcmp(bstr("directory"), "yes")) {
865 er_flags |= QR_DIRECTORY;
867 er_flags &= ~QR_DIRECTORY;
870 if (!strcmp(bstr("ulallowed"), "yes")) {
871 er_flags |= QR_UPLOAD;
873 er_flags &= ~QR_UPLOAD;
876 if (!strcmp(bstr("dlallowed"), "yes")) {
877 er_flags |= QR_DOWNLOAD;
879 er_flags &= ~QR_DOWNLOAD;
882 if (!strcmp(bstr("visdir"), "yes")) {
883 er_flags |= QR_VISDIR;
885 er_flags &= ~QR_VISDIR;
888 strcpy(buf, bstr("anon"));
890 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
891 if (!strcmp(buf, "anononly"))
892 er_flags |= QR_ANONONLY;
893 if (!strcmp(buf, "anon2"))
894 er_flags |= QR_ANONOPT;
897 if (!strcmp(bstr("bump"), "yes"))
900 er_floor = atoi(bstr("er_floor"));
902 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
903 er_name, er_password, er_dirname, er_flags, bump, er_floor);
907 display_error(&buf[4]);
910 gotoroom(er_name, 0);
912 if (strlen(er_roomaide) > 0) {
913 sprintf(buf, "SETA %s", er_roomaide);
917 display_error(&buf[4]);
927 * display the form for entering a new room
929 void display_entroom(void)
937 display_error(&buf[4]);
940 printf("HTTP/1.0 200 OK\n");
943 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
944 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
945 wprintf("<B>Enter (create) a new room</B>\n");
946 wprintf("</FONT></TD></TR></TABLE>\n");
948 wprintf("<FORM METHOD=\"POST\" ACTION=\"/entroom\">\n");
950 wprintf("<UL><LI>Name of room: ");
951 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"19\">\n");
953 wprintf("<LI>Type of room:<UL>\n");
955 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
956 wprintf("CHECKED > Public room\n");
958 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"guessname\" ");
959 wprintf("> Private - guess name\n");
961 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
962 wprintf("> Private - require password:\n");
963 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
965 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
966 wprintf("> Private - invitation only\n");
968 wprintf("<CENTER>\n");
969 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
970 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
971 wprintf("</CENTER>\n");
972 wprintf("</FORM>\n");
986 char er_password[10];
989 if (strcmp(bstr("sc"), "OK")) {
990 display_error("Cancelled. No new room was created.");
993 strcpy(er_name, bstr("er_name"));
994 strcpy(er_type, bstr("type"));
995 strcpy(er_password, bstr("er_password"));
998 if (!strcmp(er_type, "guessname"))
1000 if (!strcmp(er_type, "passworded"))
1002 if (!strcmp(er_type, "invonly"))
1005 sprintf(buf, "CRE8 1|%s|%d|%s", er_name, er_num_type, er_password);
1008 if (buf[0] != '2') {
1009 display_error(&buf[4]);
1012 smart_goto(er_name);
1017 * display the screen to enter a private room
1019 void display_private(char *rname, int req_pass)
1022 printf("HTTP/1.0 200 OK\n");
1025 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1026 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1027 wprintf("<B>Goto a private room</B>\n");
1028 wprintf("</FONT></TD></TR></TABLE>\n");
1030 wprintf("<CENTER>\n");
1031 wprintf("If you know the name of a hidden (guess-name) or\n");
1032 wprintf("passworded room, you can enter that room by typing\n");
1033 wprintf("its name below. Once you gain access to a private\n");
1034 wprintf("room, it will appear in your regular room listings\n");
1035 wprintf("so you don't have to keep returning here.\n");
1036 wprintf("<BR><BR>");
1038 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
1040 wprintf("<TABLE border><TR><TD>");
1041 wprintf("Enter room name:</TD><TD>");
1042 wprintf("<INPUT TYPE=\"text\" NAME=\"gr_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1045 wprintf("</TD></TR><TR><TD>");
1046 wprintf("Enter room password:</TD><TD>");
1047 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1049 wprintf("</TD></TR></TABLE>\n");
1051 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1052 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1053 wprintf("</FORM>\n");
1058 * goto a private room
1060 void goto_private(void)
1065 if (strcasecmp(bstr("sc"), "OK")) {
1066 display_main_menu();
1069 strcpy(hold_rm, wc_roomname);
1070 strcpy(buf, "GOTO ");
1071 strcat(buf, bstr("gr_name"));
1073 strcat(buf, bstr("gr_pass"));
1077 if (buf[0] == '2') {
1078 smart_goto(bstr("gr_name"));
1081 if (!strncmp(buf, "540", 3)) {
1082 display_private(bstr("gr_name"), 1);
1085 printf("HTTP/1.0 200 OK\n");
1087 wprintf("%s\n", &buf[4]);
1094 * display the screen to zap a room
1096 void display_zap(void)
1098 printf("HTTP/1.0 200 OK\n");
1101 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1102 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1103 wprintf("<B>Zap (forget) the current room</B>\n");
1104 wprintf("</FONT></TD></TR></TABLE>\n");
1106 wprintf("If you select this option, <em>%s</em> will ", wc_roomname);
1107 wprintf("disappear from your room list. Is this what you wish ");
1108 wprintf("to do?<BR>\n");
1110 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
1111 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1112 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1113 wprintf("</FORM>\n");
1124 char final_destination[256];
1126 /* If the forget-room routine fails for any reason, we fall back
1127 * to the current room; otherwise, we go to the Lobby
1129 strcpy(final_destination, wc_roomname);
1131 if (!strcasecmp(bstr("sc"), "OK")) {
1132 serv_printf("GOTO %s", wc_roomname);
1134 if (buf[0] != '2') {
1135 ExpressMessageCat(&buf[4]);
1139 if (buf[0] != '2') {
1140 ExpressMessageCat(&buf[4]);
1142 strcpy(final_destination, "_BASEROOM_");
1146 smart_goto(final_destination);
1153 * Confirm deletion of the current room
1155 void confirm_delete_room(void)
1159 serv_puts("KILL 0");
1161 if (buf[0] != '2') {
1162 display_error(&buf[4]);
1165 printf("HTTP/1.0 200 OK\n");
1167 wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
1168 wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
1169 wprintf("<B>Confirm deletion of room</B>\n");
1170 wprintf("</FONT></TD></TR></TABLE>\n");
1172 wprintf("<CENTER>");
1173 wprintf("<FORM METHOD=\"POST\" ACTION=\"/delete_room\">\n");
1175 wprintf("Are you sure you want to delete <FONT SIZE=+1>");
1176 escputs(wc_roomname);
1177 wprintf("</FONT>?<BR>\n");
1179 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Delete\">");
1180 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1182 wprintf("</FORM></CENTER>\n");
1188 * Delete the current room
1190 void delete_room(void)
1195 strcpy(sc, bstr("sc"));
1197 if (strcasecmp(sc, "Delete")) {
1198 display_error("Cancelled. This room was not deleted.");
1201 serv_puts("KILL 1");
1203 if (buf[0] != '2') {
1204 display_error(&buf[4]);
1206 smart_goto("_BASEROOM_");