summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaeJong <mewiceclair@gmail.com>2017-04-18 00:40:47 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-04-18 01:14:59 +0200
commita9a39a92f75dc8343e78570a3ebe91c2a7698bd3 (patch)
treec0068272cf0b732cc2aff8b5f9b28ca9ef9f9f15 /src
parentadabd56276c47fcec73c845ad9b7424f84074c52 (diff)
Purify r/arc/list, add rshow to view reports/archives in detail
Diffstat (limited to 'src')
-rw-r--r--src/game/g_admin.c152
-rw-r--r--src/game/g_admin.h1
2 files changed, 134 insertions, 19 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index 79dfb71..fed3c63 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",
@@ -9293,6 +9298,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;
@@ -9506,18 +9512,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++;
@@ -9792,6 +9805,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;
@@ -9968,19 +9982,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++;
}
@@ -10147,6 +10168,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 ];
+ report = g_admin_reports[ ID ];
+
+ 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 );