Generalize the retarded clients / flood checking, and reset it when we played a game.
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@427 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
4e082fbcd6
commit
dbc778b478
|
@ -763,8 +763,6 @@ domailuser (char *username)
|
||||||
void
|
void
|
||||||
drawgamemenu(int game)
|
drawgamemenu(int game)
|
||||||
{
|
{
|
||||||
static int flood = 0;
|
|
||||||
|
|
||||||
if (loggedin) {
|
if (loggedin) {
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
@ -785,9 +783,7 @@ drawgamemenu(int game)
|
||||||
refresh ();
|
refresh ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for retarded clients */
|
if (check_retard(0))
|
||||||
flood++;
|
|
||||||
if (flood >= 20)
|
|
||||||
{
|
{
|
||||||
endwin();
|
endwin();
|
||||||
graceful_exit (119);
|
graceful_exit (119);
|
||||||
|
@ -2101,6 +2097,7 @@ main (int argc, char** argv)
|
||||||
|
|
||||||
/* launch program */
|
/* launch program */
|
||||||
ttyrec_main (userchoice, me->username, gen_ttyrec_filename());
|
ttyrec_main (userchoice, me->username, gen_ttyrec_filename());
|
||||||
|
check_retard(1); /* reset retard counter */
|
||||||
|
|
||||||
setproctitle ("%s", me->username);
|
setproctitle ("%s", me->username);
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,7 @@ extern char *gen_inprogress_lock(int game, pid_t pid, char *ttyrec_filename);
|
||||||
extern void catch_sighup(int signum);
|
extern void catch_sighup(int signum);
|
||||||
extern void loadbanner(int game, struct dg_banner *ban);
|
extern void loadbanner(int game, struct dg_banner *ban);
|
||||||
extern void drawbanner(unsigned int start_line, unsigned int howmany);
|
extern void drawbanner(unsigned int start_line, unsigned int howmany);
|
||||||
|
extern int check_retard(int reset);
|
||||||
extern char *dgl_format_str(int game, struct dg_user *me, char *str);
|
extern char *dgl_format_str(int game, struct dg_user *me, char *str);
|
||||||
|
|
||||||
extern int dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me);
|
extern int dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me);
|
||||||
|
|
10
dgl-common.c
10
dgl-common.c
|
@ -54,6 +54,16 @@ int num_games = 0;
|
||||||
|
|
||||||
struct dg_globalconfig globalconfig;
|
struct dg_globalconfig globalconfig;
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
check_retard(int reset)
|
||||||
|
{
|
||||||
|
static int retardation = 0; /* counter for retarded clients & flooding */
|
||||||
|
if (reset) retardation = 0;
|
||||||
|
else retardation++;
|
||||||
|
return ((retardation > 20) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* replace following codes with variables:
|
* replace following codes with variables:
|
||||||
* %u == shed_uid (number)
|
* %u == shed_uid (number)
|
||||||
|
|
Loading…
Reference in New Issue