summaryrefslogtreecommitdiff
path: root/source/sv_user.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-08-24 16:10:31 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-08-24 16:10:31 +0000
commit0d18a13a94d2d3b9bf3ac6ca160c49f7199a0c91 (patch)
tree4e053139df20582497ad39e9446afc6e5b54aee9 /source/sv_user.c
parent0257c5df02687ff9a97c7ef87f464838d4df32aa (diff)
Game DLL expects gi.Args() return raw arguments, give it what it wants
for compatibility reasons (preserve non-ascii chars and double quotes in team chat, etc). Added `addfiltercmd', `delfiltercmd' and `listfiltercmds' commands designed to prevent game DLL from interpreting certain client commands.
Diffstat (limited to 'source/sv_user.c')
-rw-r--r--source/sv_user.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/sv_user.c b/source/sv_user.c
index 0c29983..b1396ed 100644
--- a/source/sv_user.c
+++ b/source/sv_user.c
@@ -801,6 +801,33 @@ static const ucmd_t ucmds[] = {
{ NULL, NULL }
};
+static void handle_filtercmd( filtercmd_t *filter ) {
+ size_t len;
+
+ switch( filter->action ) {
+ case FA_PRINT:
+ MSG_WriteByte( svc_print );
+ MSG_WriteByte( PRINT_HIGH );
+ break;
+ case FA_STUFF:
+ MSG_WriteByte( svc_stufftext );
+ break;
+ case FA_KICK:
+ SV_DropClient( sv_client, filter->comment[0] ?
+ filter->comment : "issued banned command" );
+ // fall through
+ default:
+ return;
+ }
+
+ len = strlen( filter->comment );
+ MSG_WriteData( filter->comment, len );
+ MSG_WriteByte( '\n' );
+ MSG_WriteByte( 0 );
+
+ SV_ClientAddMessage( sv_client, MSG_RELIABLE|MSG_CLEAR );
+}
+
/*
==================
SV_ExecuteUserCommand
@@ -808,6 +835,7 @@ SV_ExecuteUserCommand
*/
static void SV_ExecuteUserCommand( const char *s ) {
const ucmd_t *u;
+ filtercmd_t *filter;
char *c;
Cmd_TokenizeString( s, qfalse );
@@ -827,6 +855,12 @@ static void SV_ExecuteUserCommand( const char *s ) {
if( sv.state < ss_game ) {
return;
}
+ LIST_FOR_EACH( filtercmd_t, filter, &sv_filterlist, entry ) {
+ if( !Q_stricmp( filter->string, c ) ) {
+ handle_filtercmd( filter );
+ return;
+ }
+ }
ge->ClientCommand( sv_player );
}