summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorM. Kristall <mkpdev@gmail.com>2011-02-01 03:59:27 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:57 +0000
commit42bcfd40abeb44e93d729ce8826c6326e0688a7b (patch)
tree3089783c609aaacc06f1834b9654b7be9eaeeab5 /src
parent07c4991f25d0f11beb138bb34a3f934e28325849 (diff)
* (bug 3404) Warn all admins when a banned player tries to connect
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c10
-rw-r--r--src/game/g_admin.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 87aa8fce..adbc91bc 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -845,6 +845,7 @@ qboolean G_admin_ban_check( gentity_t *ent, char *reason, int rlen )
int i;
int t;
g_admin_ban_t *ban;
+ char warningMessage[ MAX_STRING_CHARS ];
t = trap_RealTime( NULL );
if( ent->client->pers.localClient )
@@ -860,6 +861,7 @@ qboolean G_admin_ban_check( gentity_t *ent, char *reason, int rlen )
char duration[ MAX_DURATION_LENGTH ];
G_admin_duration( ban->expires - t,
duration, sizeof( duration ) );
+
if( reason )
Com_sprintf(
reason,
@@ -869,12 +871,18 @@ qboolean G_admin_ban_check( gentity_t *ent, char *reason, int rlen )
ban->reason,
duration
);
- G_Printf( S_COLOR_YELLOW "Banned player %s" S_COLOR_YELLOW
+
+ Com_sprintf( warningMessage, sizeof( warningMessage ),
+ S_COLOR_YELLOW "Banned player %s" S_COLOR_YELLOW
" tried to connect from %s (ban #%d)\n",
ent->client->pers.netname[ 0 ] ? ent->client->pers.netname :
ban->name,
ent->client->pers.ip.str,
i + 1 );
+ trap_Print( warningMessage );
+ // don't spam admins
+ if( ban->warnCount++ < 5 )
+ G_AdminMessage( NULL, warningMessage );
return qtrue;
}
}
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index 34ada092..82554982 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -127,6 +127,7 @@ typedef struct g_admin_ban
char made[ 18 ]; // big enough for strftime() %c
int expires;
char banner[ MAX_NAME_LENGTH ];
+ int warnCount;
}
g_admin_ban_t;