summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkai <kai@zittrig.eu>2020-05-20 21:36:20 +0100
committerkai <kai@zittrig.eu>2020-05-20 22:18:03 +0100
commita9e53e1d751022604cdcb8621cac4f1ec2f41716 (patch)
tree4418b0aef00f62042fa79543b34d5c7161bf62b0
parent1b8e3022f3e62837a50b0d49afe274686d834149 (diff)
improve the ban format
-rw-r--r--src/game/g_admin.c71
1 files changed, 35 insertions, 36 deletions
diff --git a/src/game/g_admin.c b/src/game/g_admin.c
index c546389..239cae4 100644
--- a/src/game/g_admin.c
+++ b/src/game/g_admin.c
@@ -5343,9 +5343,7 @@ qboolean G_admin_showbans( gentity_t *ent, int skiparg )
int t;
char duration[ 32 ];
char sduration[ 32 ];
- char suspended[ 64 ] = { "" };
- char name_fmt[ 32 ] = { "%s" };
- char banner_fmt[ 32 ] = { "%s" };
+ char status[ 64 ] = { "" };
int max_name = 1, max_banner = 1;
int secs;
int start = 0;
@@ -5355,7 +5353,6 @@ qboolean G_admin_showbans( gentity_t *ent, int skiparg )
int j;
char n1[ MAX_NAME_LENGTH * 2 ] = {""};
char n2[ MAX_NAME_LENGTH * 2 ] = {""};
- int bannerslevel = 0;
qboolean numeric = qtrue;
char *ip_match = NULL;
int ip_match_len = 0;
@@ -5522,45 +5519,47 @@ qboolean G_admin_showbans( gentity_t *ent, int skiparg )
date[ j + 1 ] = '\0';
made++;
}
-
- if( g_admin_bans[ i ]->expires != 0
- && ( g_admin_bans[ i ]->expires - t ) < 1 )
+
+ if( g_admin_bans[ i ]->expires == 0 ) // is it permanent?
+ {
+ Com_sprintf( duration, sizeof( duration ), "^1PERMANENT" );
+ }
+ else // otherwise just show how much time is left
{
- Com_sprintf( duration, sizeof( duration ), "^1*EXPIRED*^7" );
- } else {
secs = ( g_admin_bans[ i ]->expires - t );
G_admin_duration( secs, duration, sizeof( duration ) );
}
- suspended[ 0 ] = '\0';
- if( g_admin_bans[ i ]->suspend > t )
+ if( g_admin_bans[ i ]->expires != 0
+ && ( g_admin_bans[ i ]->expires - t ) < 1 ) // are they unbanned?
+ {
+ Com_sprintf( status, sizeof( status ), "^7(^2expired or unbanned^7)" );
+ }
+
+ if( ( g_admin_bans[ i ]->suspend > t )
+ && ( !g_admin_bans[ i ]->expires
+ || g_admin_bans[ i ]->expires - t > 0 ) )
{
G_admin_duration( g_admin_bans[ i ]->suspend - t, sduration, sizeof( sduration ) );
- Com_sprintf( suspended, sizeof( suspended ), "^3*SUSPENDED*^7 for %s^7",
- sduration );
- }
-
- G_DecolorString( g_admin_bans[ i ]->name, n1 );
- Com_sprintf( name_fmt, sizeof( name_fmt ), "%%%is",
- (int)( max_name + strlen( g_admin_bans[ i ]->name ) - strlen( n1 ) ) );
- Com_sprintf( n1, sizeof( n1 ), name_fmt, g_admin_bans[ i ]->name );
-
- G_DecolorString( g_admin_bans[ i ]->banner, n2 );
- Com_sprintf( banner_fmt, sizeof( banner_fmt ), "%%%is",
- (int)( max_banner + strlen( g_admin_bans[ i ]->banner ) - strlen( n2 ) ) );
- Com_sprintf( n2, sizeof( n2 ), banner_fmt, g_admin_bans[ i ]->banner );
- bannerslevel = g_admin_bans[ i ]->bannerlevel;
-
- ADMBP( va( "%4i %s^7 %-15s %-8s %-10s\n | %-15s^7 Level:%2i\n | %s\n \\__ %s\n",
- ( i + 1 ),
- n1,
- g_admin_bans[ i ]->ip,
- date,
- duration,
- n2,
- bannerslevel,
- suspended,
- g_admin_bans[ i ]->reason ) );
+ Com_sprintf( status, sizeof( status ), "^7(^3suspended^7 for ^3%s^7)", sduration );
+ }
+
+ ADMBP( va(
+ "%4i ^3------------------------------\n"
+ " ^7Name: ^7%s^7\n"
+ " ^7IP: ^3%s^7\n"
+ " ^7Admin: ^7%s^7 (^3%i^7)\n" // admin & level
+ " ^7Reason: ^3%s^7\n"
+ " ^7Date: ^3%s^7\n"
+ " ^7Duration: ^3%s %s^7\n", // duration & status (if available)
+ ( i + 1 ),
+ g_admin_bans[ i ]->name,
+ g_admin_bans[ i ]->ip,
+ g_admin_bans[ i ]->banner, g_admin_bans[ i ]->bannerlevel,
+ g_admin_bans[ i ]->reason,
+ date,
+ duration, status
+ ) );
show_count++;
}