diff options
| -rw-r--r-- | src/game/g_admin.c | 152 | ||||
| -rw-r--r-- | src/game/g_admin.h | 1 | 
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 );  | 
