diff options
-rw-r--r-- | src/game/g_admin.c | 168 | ||||
-rw-r--r-- | src/game/g_admin.h | 1 | ||||
-rw-r--r-- | src/game/g_local.h | 1 | ||||
-rw-r--r-- | src/game/g_main.c | 2 |
4 files changed, 145 insertions, 27 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 8b2be68..9b8945a 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -350,6 +350,11 @@ g_admin_cmd_t g_admin_cmds[ ] = "purges a report or archive entry", "[^3report#^7] (^3!^7) - ^3!^7 means archive instead of report" }, + + {"rshow", G_admin_rshow, "reportmanage", + "shows a report/archive entry in its entirety", + "[^3rshow#^7] (^3!^7) [report#] - ^3!^7 shows archive instead of report" + }, {"seen", G_admin_seen, "seen", "find the last time a player was on the server", @@ -9232,7 +9237,7 @@ qboolean G_admin_report( gentity_t *ent, int skiparg ) { vic = &g_entities[ i ]; - if( G_admin_level( vic ) >= 3 ) + if( G_admin_level( vic ) >= g_reportAdminListMinLvl.integer ) { Q_strcat( admins, sizeof(admins), va( "%s^7 ", G_admin_get_adminname( vic ) ) ); } @@ -9271,6 +9276,7 @@ qboolean G_admin_rlist( gentity_t *ent, int skiparg ) char reporter_fmt[ 32 ] = { "%s" }; char name_match[ MAX_NAME_LENGTH ] = {""}; char duration[ 32 ]; + char reason[ 81 ]; char *ip_match = NULL; int i, t; int show_count = 0; @@ -9484,18 +9490,25 @@ qboolean G_admin_rlist( gentity_t *ent, int skiparg ) secs = ( report->expires - t ); G_admin_duration( secs, duration, sizeof( duration ) ); - ADMBP( va( "%4i %s^7 %-15s Expires: %s\n | Reported by: %-15s^7 Level:%2i\n | ^5%s^7\n | Made: %s^7 on ^3%s^7 with ^3%i^7 players online\n | Admins online: %s^7\n \\__ ^5Note: %s^7\n", + if( strlen(report->reason) > 80 ) + { + strncpy( reason, report->reason, 77 ); + strcat( reason, "..." ); + } else { + strncpy( reason, report->reason, 80 ); + } + + ADMBP( va( "%4i %s^7 %-15s Expires: %s\n" + " | Reported by: %-15s^7 Level:%2i\n" + " | ^5%s^7\n" + " \\__ ^5Note: %s^7\n", ( i + 1 ), n1, report->ip, duration, n2, report->level, - report->reason, - report->time, - report->map, - report->players, - report->admins, + reason, report->note ) ); show_count++; @@ -9513,11 +9526,11 @@ qboolean G_admin_rlist( gentity_t *ent, int skiparg ) else Com_sprintf( matchmethod, sizeof(matchmethod), "ip range size" ); - ADMBP( va( "^3!rlist:^7 found %d matching reports by %s.", + ADMBP( va( "^3!rlist:^7 found %d matching reports by %s. ", show_count, matchmethod ) ); } else { - ADMBP( va( "^3!rlist:^7 showing reports %d - %d of %d.", + ADMBP( va( "^3!rlist:^7 showing reports %d - %d of %d. ", ( found ) ? ( start + 1 ) : 0, ( ( start + MAX_ADMIN_SHOWREPORTS ) > found ) ? found : ( start + MAX_ADMIN_SHOWREPORTS ), @@ -9531,7 +9544,7 @@ qboolean G_admin_rlist( gentity_t *ent, int skiparg ) (filter[0]) ? filter : "" ) ); } - ADMBP( "^3rlist:^7 run ^3!rshow^7 <entry> to see all details about a report" ); + ADMBP( "Run ^3!rshow^7 <entry> to see full report" ); ADMBP( "\n" ); ADMBP_end(); @@ -9591,7 +9604,7 @@ qboolean G_admin_rban( gentity_t *ent, int skiparg ) if( admin_guid_to_level( ent->client->pers.guid ) < admin_guid_to_level( report->guid ) ) { - ADMP( "Your target has a higher admin level than you." ); + ADMP( "Your target has a higher admin level than you.\n" ); return qfalse; } @@ -9770,6 +9783,7 @@ qboolean G_admin_rarclist( gentity_t *ent, int skiparg ) char reporter_fmt[ 32 ] = { "%s" }; char name_match[ MAX_NAME_LENGTH ] = {""}; char duration[ 32 ]; + char reason[ 81 ]; char *ip_match = NULL; int show_count = 0; int max_name = 1, max_reporter = 1; @@ -9946,19 +9960,26 @@ qboolean G_admin_rarclist( gentity_t *ent, int skiparg ) secs = ( archive->expires - t ); G_admin_duration( secs, duration, sizeof( duration ) ); - ADMBP( va( "%4i %s^7 %-15s Archive expires in: %s\n | Reported by: %-15s^7 Level:%2i\n | ^5%s^7\n | Made: %s^7 on ^3%s^7 with ^3%i^7 players online\n | Admins online: %s\n \\__ Note: ^5%s^7\n", - ( i + 1 ), - n1, - archive->ip, - duration, - n2, - archive->level, - archive->reason, - archive->time, - archive->map, - archive->players, - archive->admins, - archive->note ) ); + if( strlen(archive->reason) > 80 ) + { + strncpy( reason, archive->reason, 77 ); + strcat( reason, "..." ); + } else { + strncpy( reason, archive->reason, 80 ); + } + + ADMBP( va( "%4i %s^7 %-15s Expires: %s\n" + " | Reported by: %-15s^7 Level:%2i\n" + " | ^5%s^7\n" + " \\__ ^5Note: %s^7\n", + ( i + 1 ), + n1, + archive->ip, + duration, + n2, + archive->level, + reason, + archive->note ) ); } show_count++; } @@ -9974,13 +9995,13 @@ qboolean G_admin_rarclist( gentity_t *ent, int skiparg ) Com_sprintf( matchmethod, sizeof(matchmethod), "ip range size" ); - ADMBP( va( "^3!rarclist:^7 found %d matching archived reports by %s. ", + ADMBP( va( "^3!rarclist:^7 found %d matching archived reports by %s. ", show_count, matchmethod ) ); } else { - ADMBP( va( "^3!rarclist:^7 showing archived reports %d - %d of %d. ", + ADMBP( va( "^3!rarclist:^7 showing archived reports %d - %d of %d. ", ( found ) ? ( start + 1 ) : 0, ( ( start + MAX_ADMIN_SHOWREPORTS ) > found ) ? found : ( start + MAX_ADMIN_SHOWREPORTS ), @@ -9994,7 +10015,7 @@ qboolean G_admin_rarclist( gentity_t *ent, int skiparg ) (filter[0]) ? filter : "" ) ); } - ADMBP( "^3rlist:^7 run ^3!rshow^7 ^5!^7 <entry> to see all details about an archive" ); + ADMBP( "Run ^3!rshow^7 ^5!^7 <entry> to see full archive" ); ADMBP( "\n" ); ADMBP_end(); @@ -10125,6 +10146,99 @@ qboolean G_admin_rnote( gentity_t *ent, int skiparg ) return qtrue; } +qboolean G_admin_rshow( gentity_t *ent, int skiparg ) +{ + char tmp[ 2 ]; + char arg2[ 5 ]; + char duration[ 32 ]; + int ID, secs, t; + g_admin_report_t *report; + g_admin_archive_t *archive; + qtime_t qt; + + t = trap_RealTime( &qt ); + + if( G_SayArgc() < 2 + skiparg ) + { + ADMP( "^3!rshow: ^7usage: !rshow [report#] (!) - adding ! shows archive# instead of report#\n" ); + return qfalse; + } + + G_SayArgv( 1 + skiparg, arg2, sizeof( arg2 ) ); + ID = atoi( arg2 ); + G_SayArgv( 2 + skiparg, tmp, sizeof( tmp ) ); + + archive = g_admin_archives[ ID - 1 ]; + report = g_admin_reports[ ID - 1 ]; + + if( !strcmp( tmp, "!" ) ) + { + if( ID < 1 || + ID > MAX_ADMIN_ARCHIVES || + !archive ) + { + ADMP( "^3!rshow: ^7invalid archive#\n" ); + return qfalse; + } + + secs = ( archive->expires - t ); + G_admin_duration( secs, duration, sizeof( duration ) ); + + ADMP( va( "%4i %s^7 %-15s Expires: %s\n" + " | Reported by: %-15s^7 Level:%2i\n" + " | ^5%s^7\n" + " | Made: %s^7 on ^3%s^7 with ^3%i^7 players online\n" + " | Admins online: %s^7\n" + " \\__ ^5Note: %s^7\n", + ID, + archive->name, + archive->ip, + duration, + archive->rep, + archive->level, + archive->reason, + archive->time, + archive->map, + archive->players, + archive->admins, + archive->note ) ); + + return qtrue; + + } + else if( ID < 1 || + ID > MAX_ADMIN_REPORTS || + !report ) + { + ADMP( "^3!rshow: ^7invalid report#\n" ); + return qfalse; + } + + secs = ( report->expires - t ); + G_admin_duration( secs, duration, sizeof( duration ) ); + + ADMP( va( "%4i %s^7 %-15s Expires: %s\n" + " | Reported by: %-15s^7 Level:%2i\n" + " | ^5%s^7\n" + " | Made: %s^7 on ^3%s^7 with ^3%i^7 players online\n" + " | Admins online: %s^7\n" + " \\__ ^5Note: %s^7\n", + ID, + report->name, + report->ip, + duration, + report->rep, + report->level, + report->reason, + report->time, + report->map, + report->players, + report->admins, + report->note ) ); + + return qtrue; +} + qboolean G_admin_scrim(gentity_t *ent, int skiparg ) { char state[5]; diff --git a/src/game/g_admin.h b/src/game/g_admin.h index 61d4353..0850cea 100644 --- a/src/game/g_admin.h +++ b/src/game/g_admin.h @@ -359,6 +359,7 @@ qboolean G_admin_rarclist( gentity_t *ent, int skiparg ); qboolean G_admin_rclose( gentity_t *ent, int skiparg ); qboolean G_admin_rpurge( gentity_t *ent, int skiparg ); qboolean G_admin_rnote( gentity_t *ent, int skiparg ); +qboolean G_admin_rshow( gentity_t *ent, int skiparg ); qboolean G_admin_scrim( gentity_t *ent, int skiparg ); diff --git a/src/game/g_local.h b/src/game/g_local.h index 5835385..8edcc71 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1539,6 +1539,7 @@ extern vmCvar_t g_maxReports; extern vmCvar_t g_maxUnregReports; extern vmCvar_t g_reportWelcomeComment; +extern vmCvar_t g_reportAdminListMinLvl; extern vmCvar_t g_schachtmeisterClearThreshold; extern vmCvar_t g_schachtmeisterAutobahnThreshold; diff --git a/src/game/g_main.c b/src/game/g_main.c index cd53e3f..4c68925 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -279,6 +279,7 @@ vmCvar_t g_maxReports; vmCvar_t g_maxUnregReports; vmCvar_t g_reportWelcomeComment; +vmCvar_t g_reportAdminListMinLvl; vmCvar_t g_schachtmeisterClearThreshold; vmCvar_t g_schachtmeisterAutobahnThreshold; @@ -546,6 +547,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_maxUnregReports, "g_maxUnregReports", "1", CVAR_ARCHIVE, 0, qfalse }, { &g_reportWelcomeComment, "g_reportWelcomeComment", "", CVAR_ARCHIVE, 0, qfalse }, + { &g_reportAdminListMinLvl, "g_reportAdminListMinLvl", "4", CVAR_ARCHIVE, 0, qfalse }, { &g_scrimMode, "g_scrimMode", "0", CVAR_ARCHIVE, 0, qfalse }, |