* burn our folder cache when zapping/deleting
authorWilfried Göesgens <willi@citadel.org>
Wed, 11 Aug 2010 16:25:42 +0000 (16:25 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 11 Aug 2010 16:25:42 +0000 (16:25 +0000)
* remove non-template zap stuff

webcit/roomops.c
webcit/roomops.h
webcit/static/t/menu/advanced_roomcommands.html
webcit/static/t/room/zap_this.html [new file with mode: 0644]
webcit/static/t/room/zapped_list.html

index ab398c69b5e1c534457918812bb72a14f0651f2f..319b80f4e7136f43bafc5147e6a6ff39ab7ac63e 100644 (file)
@@ -222,33 +222,6 @@ void listrms(char *variety)
 }
 
 
-/*
- * 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);
-}
-
-
-
 
 /*
  * Embed the room banner
@@ -2815,7 +2788,7 @@ void entroom(void)
        }
        /** 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);
@@ -2921,34 +2894,6 @@ void goto_private(void)
 }
 
 
-/**
- * \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("&nbsp;");
-       wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
-       wc_printf("</form>\n");
-       wDumpContent(1);
-}
-
 
 /**
  * \brief zap a room
@@ -2975,6 +2920,7 @@ void zap(void)
                                StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
                        }
                }
+               FlushRoomlist ();
        }
        smart_goto(final_destination);
        FreeStrBuf(&final_destination);
@@ -2993,6 +2939,7 @@ void delete_room(void)
        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();
@@ -3473,6 +3420,15 @@ HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP)
        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)
@@ -3492,8 +3448,6 @@ InitModule_ROOMOPS
        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);
@@ -3637,10 +3591,7 @@ SessionDestroyModule_ROOMOPS
                free(sess->cache_fold);
        }
        
-       free_march_list(sess);
-       DeleteHash(&sess->Floors);
-       DeleteHash(&sess->Rooms);
-       DeleteHash(&sess->FloorsByName);
+       FlushRoomlist ();
 }
 
 
index e5ab76ab6f6cc8b5ecf1ffa96fda245e620d5abb..865ad5dcbef4dfcf2d05b7609bde202f4ef159ad 100644 (file)
@@ -116,6 +116,7 @@ HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP);
 void vDeleteFolder(void *vFolder);
 void FlushFolder(folder *room);
 void ParseGoto(folder *proom, StrBuf *Line);
+void FlushRoomlist(void); /* release our caches, so a deleted / zapped room disapears */
 
 /*
  * wrapper around usual sort-comparator; private rooms will allways be prefered, -1 if one of them NULL
index b33760ca1370f58d76db81266f5f69df0090089f..48d99e48808b18bc98ab4ed45c959c6b033fc5ee 100644 (file)
@@ -5,7 +5,6 @@
 <?!("X", 1)>
 <li><a href="display_private"><?_("Go to a 'hidden' room")></a></li>
 <li><a href="display_entroom"><?_("Create a new room")></a></li>
-<li><a href="display_zap"><?_("Zap (forget) this room")></a></li>
+<li><a href="do_template?template=room_zap_this"><?_("Zap (forget) this room")></a></li>
 <li><a href="do_template?template=room_zapped_list"><?_("List all forgotten rooms")></a></li>
-<li><a href="zapped_list">(old)<?_("List all forgotten rooms")></a></li>
 </ul>
diff --git a/webcit/static/t/room/zap_this.html b/webcit/static/t/room/zap_this.html
new file mode 100644 (file)
index 0000000..85770b9
--- /dev/null
@@ -0,0 +1,16 @@
+<?=("head")><?=("important_msg")><?%("COND:LOGGEDIN", 1, 1, 1, "", ="paging")>
+<div id="banner">
+<h1><?_("Zap (forget/unsubscribe) the current room")></h1>
+</div>
+<div id="content" class="service">
+<?_("If you select this option,")>
+<em><?ROOM:INFO:PRINT_NAME("X")></em>
+<?_("will disappear from your room list.  Is this what you wish to do?")>
+<br>
+
+<form method="POST" action="zap">
+<input type="hidden" name="nonce" value="<?NONCE>">
+<input type="submit" NAME="ok_button" VALUE="<?_("Zap this room")>">&nbsp;
+<input type="submit" NAME="cancel_button" VALUE="<?_("Cancel")>">
+</form>
+<?=("trailing")>
\ No newline at end of file
index 0705696762cc629a0f45d1a153e3cf68fee01875..3a1845149ab75433ecde1a3c46825b51e72f14d4 100644 (file)
@@ -6,6 +6,8 @@
 
 <?=("beginbox_1")><?_("Zapped (forgotten) rooms")><?=("beginbox_2")>
 <?ITERATE("LZRM", ="room_zap_entry")>
+<br /><br />
+<?_("Click on any room to un-zap it and goto that room.")>
 <?=("endbox")>
 </div>
 <?=("trailing")>