From 7d037802a9d8567fd720a8b14b2345e5a3dbe947 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 3 Sep 2012 12:21:42 +0200 Subject: [PATCH] Check for validity of category/board when placing seek ad Code was copied for this from the match command --- lasker-2.2.3/src/seekproc.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/lasker-2.2.3/src/seekproc.c b/lasker-2.2.3/src/seekproc.c index 399dfbe..43ffe66 100644 --- a/lasker-2.2.3/src/seekproc.c +++ b/lasker-2.2.3/src/seekproc.c @@ -78,6 +78,22 @@ int com_seek(int p, param_list param) return COM_OK; /* couldn't parse */ } + if (category[0]) { + if (!board[0] && strcmp(category,"bughouse")) { + pprintf(p, "You must specify a board and a category.\n"); + return COM_OK; + + } else if (board[0]) { /* not bughouse */ + char fname[MAX_FILENAME_SIZE]; + + sprintf(fname, "%s/%s/%s", BOARD_DIR, category, board); + if (!file_exists(fname)) { + pprintf(p, "No such category/board: %s/%s\n", category, board); + return COM_OK; + } + } + } + seek_globals.ads[num].status = SEEKCLOSED; // params are valid; create ad if(wt < 0) wt = pp->d_time; if(bt < 0) bt = wt; -- 1.7.0.4