summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c53
-rw-r--r--src/game/g_admin.h1
-rw-r--r--src/game/g_svcmds.c6
-rw-r--r--src/server/sv_ccmds.c28
-rw-r--r--src/server/sv_main.c12
5 files changed, 100 insertions, 0 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 49aa46da..41490814 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -214,6 +214,11 @@ g_admin_cmd_t g_admin_cmds[ ] =
"(^5name|IP(/mask)^7) (^5start at ban#^7)"
},
+ {"sm", G_admin_sm, qfalse, "schachtmeister",
+ "Schachtmeister",
+ "..."
+ },
+
{"spec999", G_admin_spec999, qfalse, "spec999",
"move 999 pingers to the spectator team",
""},
@@ -1669,6 +1674,54 @@ qboolean G_admin_setdisabled( gentity_t *ent )
return qtrue;
}
+qboolean G_admin_sm( gentity_t *ent )
+{
+ const char *s;
+ char feature[ 16 ];
+
+ if( trap_Argc() < 2 )
+ {
+ usage:
+ ADMP( "^3sm: ^7usage: sm ipa <IPA>\n" );
+ return qfalse;
+ }
+
+ s = ConcatArgs( 1 );
+ if( strchr( s, '\n' ) || strchr( s, '\r' ) )
+ {
+ ADMP( "^3sm: ^7invalid character\n" );
+ return qfalse;
+ }
+
+ trap_Argv( 1, feature, sizeof( feature ) );
+
+ if( !Q_stricmp( feature, "ipa" ) )
+ {
+ char ipa[ 32 ];
+
+ if( trap_Argc() > 3 )
+ {
+ ADMP( "^3sm: ^7excessive arguments\n" );
+ goto usage;
+ }
+ trap_Argv( 2, ipa, sizeof( ipa ) );
+
+ if( rand() % 2 /* FIXME cache hit */ )
+ {
+ const char *answer = "interesting";
+ ADMP( va( "^3sm: ^7IP address '%s^7' is: %s\n", ipa, answer ) );
+ return qtrue;
+ }
+
+ ADMP( "^3sm: ^7hmm...\n" );
+ trap_SendConsoleCommand( EXEC_APPEND, va( "smq ipa \"%s\"\n", ipa ) );
+ }
+ else
+ goto usage;
+
+ return qtrue;
+}
+
qboolean G_admin_kick( gentity_t *ent )
{
int pid;
diff --git a/src/game/g_admin.h b/src/game/g_admin.h
index 10727bd3..a93ae058 100644
--- a/src/game/g_admin.h
+++ b/src/game/g_admin.h
@@ -187,6 +187,7 @@ qboolean G_admin_buildlog( gentity_t *ent );
qboolean G_admin_revert( gentity_t *ent );
qboolean G_admin_setdevmode( gentity_t *ent );
qboolean G_admin_setdisabled( gentity_t *ent );
+qboolean G_admin_sm( gentity_t *ent );
void G_admin_print( gentity_t *ent, char *m );
void G_admin_buffer_print( gentity_t *ent, char *m );
diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c
index eaeea0c7..f36afb96 100644
--- a/src/game/g_svcmds.c
+++ b/src/game/g_svcmds.c
@@ -164,6 +164,11 @@ static void Svcmd_Status_f( void )
}
}
+static void Svcmd_SMR_f( void )
+{
+ G_Printf( "unrecognized Schachtmeister response: %s\n", ConcatArgs( 1 ) );
+}
+
/*
===================
Svcmd_ForceTeam_f
@@ -579,6 +584,7 @@ struct svcmd
{ "printqueue", qfalse, Svcmd_PrintQueue_f },
{ "say", qtrue, Svcmd_MessageWrapper },
{ "say_team", qtrue, Svcmd_TeamMessage_f },
+ { "smr", qfalse, Svcmd_SMR_f },
{ "status", qfalse, Svcmd_Status_f },
{ "stopMapRotation", qfalse, G_StopMapRotation },
{ "suddendeath", qfalse, Svcmd_SuddenDeath_f }
diff --git a/src/server/sv_ccmds.c b/src/server/sv_ccmds.c
index 56c73aa8..65585308 100644
--- a/src/server/sv_ccmds.c
+++ b/src/server/sv_ccmds.c
@@ -284,6 +284,33 @@ static void SV_KillServer_f( void ) {
SV_Shutdown( "killserver" );
}
+static void SV_SMQ_f( void ) {
+ static qboolean schmResolved = qfalse;
+ static netadr_t schmAddress;
+ char args[ MAX_STRING_CHARS ];
+ char *p;
+ int s, i;
+
+ if ( !schmResolved ) {
+ schmResolved = qtrue;
+ NET_StringToAdr( "127.0.0.1:1337", &schmAddress, NA_IP );
+ }
+
+ p = args;
+ s = sizeof( args );
+
+ for ( i = 1; i < Cmd_Argc(); ++i )
+ {
+ int l;
+ Com_sprintf( p, s, " \"%s\"", Cmd_Argv( i ) );
+ l = strlen( p );
+ s -= l;
+ p += l;
+ }
+
+ NET_OutOfBandPrint( NS_SERVER, schmAddress, "sm2query%s", args );
+}
+
//===========================================================
/*
@@ -320,6 +347,7 @@ void SV_AddOperatorCommands( void ) {
Cmd_AddCommand ("devmap", SV_Map_f);
Cmd_SetCommandCompletionFunc( "devmap", SV_CompleteMapName );
Cmd_AddCommand ("killserver", SV_KillServer_f);
+ Cmd_AddCommand ("smq", SV_SMQ_f);
}
/*
diff --git a/src/server/sv_main.c b/src/server/sv_main.c
index e5e7e5f1..41c51508 100644
--- a/src/server/sv_main.c
+++ b/src/server/sv_main.c
@@ -752,6 +752,16 @@ static void SVC_RemoteCommand( netadr_t from, msg_t *msg ) {
Com_EndRedirect ();
}
+static void SVC_SchachtmeisterResponse( netadr_t from ) {
+ if ( !( from.type == NA_IP && from.ip[0] == 127 ) ) {
+ return;
+ }
+
+ strcpy( Cmd_Argv( 0 ), "smr" );
+
+ SV_GameCommand();
+}
+
/*
=================
SV_ConnectionlessPacket
@@ -793,6 +803,8 @@ static void SV_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
// if a client starts up a local server, we may see some spurious
// server disconnect messages when their new server sees our final
// sequenced messages to the old client
+ } else if (!Q_stricmp(c, "sm2reply")) {
+ SVC_SchachtmeisterResponse( from );
} else {
Com_DPrintf ("bad connectionless packet from %s:\n%s\n",
NET_AdrToString (from), s);