/*
* load the list of floors
- */
+ * /
void load_floorlist(StrBuf *Buf)
{
int a;
extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
}
}
-
-
-
-
-/*
- * display rooms in tree structure
- */
-void room_tree_list(struct roomlisting *rp)
-{
- char rmname[64];
- int f;
-
- if (rp == NULL) {
- return;
- }
-
- room_tree_list(rp->lnext);
-
- strcpy(rmname, rp->rlname);
- f = rp->rlflags;
-
- wc_printf("<a href=\"dotgoto?room=");
- urlescputs(rmname);
- wc_printf("\"");
- wc_printf(">");
- escputs1(rmname, 1, 1);
- if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
- wc_printf("}");
- else if (f & QR_DIRECTORY)
- wc_printf("]");
- else if (f & QR_NETWORK)
- wc_printf(")");
- else
- wc_printf(">");
- wc_printf("</a><tt> </tt>\n");
-
- room_tree_list(rp->rnext);
- free(rp);
-}
-
-
-/*
- * Room ordering stuff (compare first by floor, then by order)
- */
-int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
-{
- if ((r1 == NULL) && (r2 == NULL))
- return (0);
- if (r1 == NULL)
- return (-1);
- if (r2 == NULL)
- return (1);
- if (r1->rlfloor < r2->rlfloor)
- return (-1);
- if (r1->rlfloor > r2->rlfloor)
- return (1);
- if (r1->rlorder < r2->rlorder)
- return (-1);
- if (r1->rlorder > r2->rlorder)
- return (1);
- return (0);
-}
-
-
-/*
- * Common code for all room listings
- */
-void listrms(char *variety)
-{
- char buf[SIZ];
- int num_rooms = 0;
-
- struct roomlisting *rl = NULL;
- struct roomlisting *rp;
- struct roomlisting *rs;
-
- /* Ask the server for a room list */
- serv_puts(variety);
- serv_getln(buf, sizeof buf);
- if (buf[0] != '1') {
- wc_printf(" ");
- return;
- }
-
- while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
- ++num_rooms;
- rp = malloc(sizeof(struct roomlisting));
- extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
- rp->rlflags = extract_int(buf, 1);
- rp->rlfloor = extract_int(buf, 2);
- rp->rlorder = extract_int(buf, 3);
- rp->lnext = NULL;
- rp->rnext = NULL;
-
- rs = rl;
- if (rl == NULL) {
- rl = rp;
- } else
- while (rp != NULL) {
- if (rordercmp(rp, rs) < 0) {
- if (rs->lnext == NULL) {
- rs->lnext = rp;
- rp = NULL;
- } else {
- rs = rs->lnext;
- }
- } else {
- if (rs->rnext == NULL) {
- rs->rnext = rp;
- rp = NULL;
- } else {
- rs = rs->rnext;
- }
- }
- }
- }
-
- room_tree_list(rl);
-
- /*
- * If no rooms were listed, print an nbsp to make the cell
- * borders show up anyway.
- */
- if (num_rooms == 0) wc_printf(" ");
-}
-
-
-/*
- * list all forgotten rooms
- */
-void zapped_list(void)
-{
- WCTemplputParams SubTP;
- StrBuf *Buf;
-
- output_headers(1, 1, 1, 0, 0, 0);
- memset(&SubTP, 0, sizeof(WCTemplputParams));
- Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
- SubTP.Filter.ContextType = CTX_STRBUF;
- SubTP.Context = Buf;
- DoTemplate(HKEY("beginbox"), NULL, &SubTP);
-
- FreeStrBuf(&Buf);
-
- listrms("LZRM -1");
-
- wc_printf("<br /><br />\n");
- wc_printf(_("Click on any room to un-zap it and goto that room.\n"));
- do_template("endbox", NULL);
- wDumpContent(1);
-}
-
-
+*/
/*
tab = bstr("tab");
if (IsEmptyStr(tab)) tab = "admin";
- Buf = NewStrBuf();
- load_floorlist(Buf);
- FreeStrBuf(&Buf);
+// Buf = NewStrBuf();
+// load_floorlist(Buf);
+// FreeStrBuf(&Buf);
output_headers(1, 1, 1, 0, 0, 0);
wc_printf("<div class=\"fix_scrollbar_bug\">");
wc_printf("<tr class=\"odd\"><td>");
wc_printf(_("Resides on floor: "));
wc_printf("</td><td>");
- load_floorlist(Buf);
+// load_floorlist(Buf);
wc_printf("<select name=\"er_floor\" size=\"1\">\n");
for (i = 0; i < 128; ++i)
if (!IsEmptyStr(floorlist[i])) {
}
/** TODO: Room created, now update the left hand icon bar for this user */
burn_folder_cache(0); /* burn the old folder cache */
-
+ FlushRoomlist ();
gotoroom(er_name);
serv_printf("VIEW %d", er_view);
}
-/**
- * \brief display the screen to zap a room
- */
-void display_zap(void)
-{
- output_headers(1, 1, 2, 0, 0, 0);
-
- wc_printf("<div id=\"banner\">\n");
- wc_printf("<h1>");
- wc_printf(_("Zap (forget/unsubscribe) the current room"));
- wc_printf("</h1>\n");
- wc_printf("</div>\n");
-
- wc_printf("<div id=\"content\" class=\"service\">\n");
-
- wc_printf(_("If you select this option, <em>%s</em> will "
- "disappear from your room list. Is this what you wish "
- "to do?<br />\n"), ChrPtr(WC->CurRoom.name));
-
- wc_printf("<form method=\"POST\" action=\"zap\">\n");
- wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
- wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
- wc_printf(" ");
- wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
- wc_printf("</form>\n");
- wDumpContent(1);
-}
-
/**
* \brief zap a room
StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
}
}
+ FlushRoomlist ();
}
smart_goto(final_destination);
FreeStrBuf(&final_destination);
serv_puts("KILL 1");
serv_getln(buf, sizeof buf);
burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
+ FlushRoomlist ();
if (buf[0] != '2') {
strcpy(WC->ImportantMessage, &buf[4]);
display_main_menu();
return Whok;
}
+void FlushRoomlist(void)
+{
+ wcsession *WCC = WC;
+ free_march_list(WCC);
+ DeleteHash(&WCC->Floors);
+ DeleteHash(&WCC->Rooms);
+ DeleteHash(&WCC->FloorsByName);
+}
+
void
InitModule_ROOMOPS
(void)
WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
WebcitAddUrlHandler(HKEY("display_private"), "", 0, _display_private, 0);
WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
- WebcitAddUrlHandler(HKEY("zapped_list"), "", 0, zapped_list, 0);
- WebcitAddUrlHandler(HKEY("display_zap"), "", 0, display_zap, 0);
WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
WebcitAddUrlHandler(HKEY("display_entroom"), "", 0, display_entroom, 0);
WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
free(sess->cache_fold);
}
- free_march_list(sess);
- DeleteHash(&sess->Floors);
- DeleteHash(&sess->Rooms);
- DeleteHash(&sess->FloorsByName);
+ FlushRoomlist ();
}