X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmarchlist.c;h=7031d264309cf01101e3d923d89b12e74b537b35;hb=HEAD;hp=72d8d71c7c295f4127f6ebb85c7483ee07ffd66e;hpb=c5b744d934aeaae4451e19a4914b9b89a8eaf4d2;p=citadel.git diff --git a/webcit/marchlist.c b/webcit/marchlist.c index 72d8d71c7..8888c5d3c 100644 --- a/webcit/marchlist.c +++ b/webcit/marchlist.c @@ -1,5 +1,5 @@ #include "webcit.h" -#include "webserver.h" + /* * Free a session's march list @@ -57,8 +57,6 @@ void remove_march(const StrBuf *aaa) char *pop_march(int desired_floor) { static char TheRoom[128]; - int TheFloor = 0; - int TheOrder = 32767; int TheWeight = 0; int weight; struct march *mptr = NULL; @@ -80,8 +78,10 @@ char *pop_march(int desired_floor) if (weight > TheWeight) { TheWeight = weight; strcpy(TheRoom, mptr->march_name); +/* TODOO: and now???? TheFloor = mptr->march_floor; TheOrder = mptr->march_order; +*/ } } return (TheRoom); @@ -169,6 +169,7 @@ void gotonext(void) } if (WC->march != NULL) { next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */ + putlbstr("gotonext", 1); } else { next_room = NewStrBufPlain(HKEY("_BASEROOM_")); } @@ -215,23 +216,39 @@ void ungoto(void) +void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + + if ((WCC!=NULL) && + (!IsEmptyStr(WCC->ugname))) + StrBufAppendBufPlain(Target, WCC->ugname, -1, 0); +} + void _gotonext(void) { slrp_highest(); gotonext(); } -void dotskip(void) { - smart_goto(sbstr("room")); -} +int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP) +{ + wcsession *WCC = WC; + + return ((WCC!=NULL) && + (!IsEmptyStr(WCC->ugname)) && + (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0)); +} void InitModule_MARCHLIST (void) { + RegisterConditional("COND:UNGOTO", 0, ConditionalHaveUngoto, CTX_NONE); + RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE); WebcitAddUrlHandler(HKEY("gotonext"), "", 0, _gotonext, NEED_URL); WebcitAddUrlHandler(HKEY("skip"), "", 0, gotonext, NEED_URL);