From c5b744d934aeaae4451e19a4914b9b89a8eaf4d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Wed, 11 Aug 2010 16:25:57 +0000 Subject: [PATCH] * migrate display_private to templates --- webcit/marchlist.c | 1 - webcit/roomops.c | 80 +++---------------- .../static/t/menu/advanced_roomcommands.html | 2 +- webcit/static/t/room/display_private.html | 34 ++++++++ 4 files changed, 47 insertions(+), 70 deletions(-) create mode 100644 webcit/static/t/room/display_private.html diff --git a/webcit/marchlist.c b/webcit/marchlist.c index 63cd84cc4..72d8d71c7 100644 --- a/webcit/marchlist.c +++ b/webcit/marchlist.c @@ -13,7 +13,6 @@ void free_march_list(wcsession *wcf) free(wcf->march); wcf->march = mptr; } - } diff --git a/webcit/roomops.c b/webcit/roomops.c index 139543ca4..44956be84 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -1098,7 +1098,6 @@ int set_roomflags(room_states *RoomOps) */ void display_editroom(void) { - StrBuf *Buf; char buf[SIZ]; char cmd[1024]; char node[256]; @@ -2679,63 +2678,6 @@ void entroom(void) } -/** - * \brief display the screen to enter a private room - */ -void display_private(char *rname, int req_pass) -{ - WCTemplputParams SubTP; - StrBuf *Buf; - output_headers(1, 1, 1, 0, 0, 0); - - Buf = NewStrBufPlain(_("Go to a hidden room"), -1); - memset(&SubTP, 0, sizeof(WCTemplputParams)); - SubTP.Filter.ContextType = CTX_STRBUF; - SubTP.Context = Buf; - DoTemplate(HKEY("beginbox"), NULL, &SubTP); - - FreeStrBuf(&Buf); - - wc_printf("

"); - wc_printf(_("If you know the name of a hidden (guess-name) or " - "passworded room, you can enter that room by typing " - "its name below. Once you gain access to a private " - "room, it will appear in your regular room listings " - "so you don't have to keep returning here.")); - wc_printf("

"); - - wc_printf("
\n"); - wc_printf("\n", WC->nonce); - - wc_printf(" " - "
"); - wc_printf(_("Enter room name:")); - wc_printf("" - "\n", rname); - - if (req_pass) { - wc_printf("
"); - wc_printf(_("Enter room password:")); - wc_printf(""); - wc_printf("\n"); - } - wc_printf("
\n"); - - wc_printf("
\n"); - wc_printf("" - " " - "", - _("Go there"), - _("Cancel") - ); - wc_printf("
\n"); - - do_template("endbox", NULL); - - wDumpContent(1); -} - /** * \brief goto a private room */ @@ -2748,6 +2690,7 @@ void goto_private(void) display_main_menu(); return; } + FlushRoomlist(); strcpy(hold_rm, ChrPtr(WC->CurRoom.name)); serv_printf("GOTO %s|%s", bstr("gr_name"), @@ -2759,7 +2702,7 @@ void goto_private(void) return; } if (!strncmp(buf, "540", 3)) { - display_private(bstr("gr_name"), 1); + DoTemplate(HKEY("room_display_private"), NULL, &NoCtx); return; } output_headers(1, 1, 1, 0, 0, 0); @@ -3086,11 +3029,6 @@ void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP) StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0); } - -void _display_private(void) { - display_private("", 0); -} - void dotgoto(void) { if (!havebstr("room")) { readloop(readnew, eUseDefault); @@ -3295,15 +3233,21 @@ HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP) return Whok; } -void FlushRoomlist(void) +void _FlushRoomList(wcsession *WCC) { - wcsession *WCC = WC; free_march_list(WCC); DeleteHash(&WCC->Floors); DeleteHash(&WCC->Rooms); DeleteHash(&WCC->FloorsByName); } +void FlushRoomlist(void) +{ + wcsession *WCC = WC; + _FlushRoomList(WCC); +} + + void InitModule_ROOMOPS (void) @@ -3321,7 +3265,7 @@ InitModule_ROOMOPS WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0); WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL); 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("zap"), "", 0, zap, 0); WebcitAddUrlHandler(HKEY("display_entroom"), "", 0, display_entroom, 0); @@ -3466,7 +3410,7 @@ SessionDestroyModule_ROOMOPS free(sess->cache_fold); } - FlushRoomlist (); + _FlushRoomList (sess); } diff --git a/webcit/static/t/menu/advanced_roomcommands.html b/webcit/static/t/menu/advanced_roomcommands.html index 48d99e488..676aa20a4 100644 --- a/webcit/static/t/menu/advanced_roomcommands.html +++ b/webcit/static/t/menu/advanced_roomcommands.html @@ -3,7 +3,7 @@
  • (old)
  • -
  • +
  • diff --git a/webcit/static/t/room/display_private.html b/webcit/static/t/room/display_private.html new file mode 100644 index 000000000..72dddc4f1 --- /dev/null +++ b/webcit/static/t/room/display_private.html @@ -0,0 +1,34 @@ + + +
    + + +

    +
    + + + + + + + + + + + + + + + +
    " maxlength="128"> +
    +
    +"> + "> +
    + + +
    + -- 2.30.2