Correctly align formatting of /DCC LIST line for /SET DCC_BAR_TYPE 1
With DCC_BAR_TYPE 1 set, the stat line for active DCC file connections was not aligned correctly with the header (the mm:ss field spilled into the KB/s column.) This also simplifies things by always generating the inline bar, so the only difference between the line printed for DCC_BAR_TYPE 0 and 1 is now the format itself.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2.2]
|
[Changes 1.2.2]
|
||||||
|
|
||||||
|
* Correctly align formatting of /DCC LIST line for /SET DCC_BAR_TYPE 1. (caf)
|
||||||
|
|
||||||
* Act on channel mode lock as half-op. (caf)
|
* Act on channel mode lock as half-op. (caf)
|
||||||
|
|
||||||
* Fix crash and memory leak in $aliasctl(COMMAND MATCH). (caf)
|
* Fix crash and memory leak in $aliasctl(COMMAND MATCH). (caf)
|
||||||
|
|||||||
37
source/dcc.c
37
source/dcc.c
@@ -2502,13 +2502,10 @@ static char *_dcc_offer[12] = {"%K
|
|||||||
|
|
||||||
void dcc_glist(char *command, char *args)
|
void dcc_glist(char *command, char *args)
|
||||||
{
|
{
|
||||||
char *dformat =
|
#define DCC_FORMAT_STAT_PENDING "#$[3]0 $[6]1%Y$2%n $[11]3 $[25]4 $[7]5 $6-"
|
||||||
"#$[3]0 $[6]1%Y$2%n $[11]3 $[25]4 $[7]5 $6-";
|
#define DCC_FORMAT_STAT_CHAT "#$[3]0 $[6]1%Y$2%n $[11]3 $4 $[-4]5 $[-4]6 $[-3]7 $[-3]8 $[7]9 $10"
|
||||||
char *d1format =
|
#define DCC_FORMAT_STAT_BARTYPE_0 "#$[3]0 $[6]1%Y$2%n $[11]3 $4 $[7]5 $[11]6 $[7]7 $8-"
|
||||||
"#$[3]0 $[6]1%Y$2%n $[11]3 $4 $[7]5 $[11]6 $[7]7 $8-";
|
#define DCC_FORMAT_STAT_BARTYPE_1 "#$[3]0 $[6]1%Y$2%n $[11]3 $[7]5 $[22]6 $[7]7 $8-"
|
||||||
char *c1format =
|
|
||||||
"#$[3]0 $[6]1%Y$2%n $[11]3 $4 $[-4]5 $[-4]6 $[-3]7 $[-3]8 $[7]9 $10";
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
DCC_int *n = NULL;
|
DCC_int *n = NULL;
|
||||||
SocketList *s;
|
SocketList *s;
|
||||||
@@ -2517,14 +2514,13 @@ int tdcc = 0;
|
|||||||
char *status;
|
char *status;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
DCC_List *c;
|
DCC_List *c;
|
||||||
char stats[80];
|
|
||||||
char kilobytes[20];
|
char kilobytes[20];
|
||||||
double barsize = 0.0;
|
double barsize = 0.0;
|
||||||
char spec[BIG_BUFFER_SIZE];
|
char spec[BIG_BUFFER_SIZE];
|
||||||
char *filename, *p;
|
char *filename, *p;
|
||||||
|
|
||||||
reset_display_target();
|
reset_display_target();
|
||||||
#if !defined(WINNT) && !defined(__EMX__)
|
#if !defined(WINNT) && !defined(__EMX__) && (defined(LATIN1) || defined(CHARSET_CUSTOM))
|
||||||
charset_ibmpc();
|
charset_ibmpc();
|
||||||
#endif
|
#endif
|
||||||
if (do_hook(DCC_HEADER_LIST, "%s %s %s %s %s %s %s", "Dnum","Type","Nick", "Status", "K/s", "File","Encrypt"))
|
if (do_hook(DCC_HEADER_LIST, "%s %s %s %s %s %s %s", "Dnum","Type","Nick", "Status", "K/s", "File","Encrypt"))
|
||||||
@@ -2564,7 +2560,7 @@ char *filename, *p;
|
|||||||
"Unknown",
|
"Unknown",
|
||||||
"N/A", strip_path(filename), n->encrypt?"E":empty_string))
|
"N/A", strip_path(filename), n->encrypt?"E":empty_string))
|
||||||
{
|
{
|
||||||
put_it("%s", convert_output_format(dformat, "%d %s %s %s %s %s %s",
|
put_it("%s", convert_output_format(DCC_FORMAT_STAT_PENDING, "%d %s %s %s %s %s %s",
|
||||||
n->dccnum,
|
n->dccnum,
|
||||||
local_type,
|
local_type,
|
||||||
n->encrypt ? "E" : "<EFBFBD>",
|
n->encrypt ? "E" : "<EFBFBD>",
|
||||||
@@ -2619,7 +2615,7 @@ char *filename, *p;
|
|||||||
s->flags & DCC_ACTIVE ?"Active" :
|
s->flags & DCC_ACTIVE ?"Active" :
|
||||||
"Unknown",
|
"Unknown",
|
||||||
"N/A", strip_path(filename), n->encrypt?"E":empty_string))
|
"N/A", strip_path(filename), n->encrypt?"E":empty_string))
|
||||||
put_it("%s", convert_output_format(c1format, "%d %s %s %s %s %s %s %s",
|
put_it("%s", convert_output_format(DCC_FORMAT_STAT_CHAT, "%d %s %s %s %s %s %s %s",
|
||||||
n->dccnum,
|
n->dccnum,
|
||||||
local_type,
|
local_type,
|
||||||
n->encrypt ? "E" : "<EFBFBD>",
|
n->encrypt ? "E" : "<EFBFBD>",
|
||||||
@@ -2643,7 +2639,7 @@ char *filename, *p;
|
|||||||
s->flags & DCC_ACTIVE ?"Active" :
|
s->flags & DCC_ACTIVE ?"Active" :
|
||||||
"Unknown",
|
"Unknown",
|
||||||
"N/A", strip_path(filename), n->encrypt?"E":empty_string))
|
"N/A", strip_path(filename), n->encrypt?"E":empty_string))
|
||||||
put_it("%s", convert_output_format(dformat, "%d %s %s %s %s %s %s",
|
put_it("%s", convert_output_format(DCC_FORMAT_STAT_PENDING, "%d %s %s %s %s %s %s",
|
||||||
n->dccnum,
|
n->dccnum,
|
||||||
local_type,
|
local_type,
|
||||||
n->encrypt ? "E" : "<EFBFBD>",
|
n->encrypt ? "E" : "<EFBFBD>",
|
||||||
@@ -2690,11 +2686,7 @@ char *filename, *p;
|
|||||||
|
|
||||||
if (n->filesize == 0)
|
if (n->filesize == 0)
|
||||||
size = BAR_LENGTH;
|
size = BAR_LENGTH;
|
||||||
sprintf(stats, "%4.1f", perc);
|
sprintf(spec, "%s %4.1f%s %02d:%02d", get_bar_percent(iperc), perc, "%%", minutes, seconds);
|
||||||
if (!get_int_var(DCC_BAR_TYPE_VAR))
|
|
||||||
sprintf(spec, "%s %s%s %02d:%02d", get_bar_percent(iperc), stats, "%%", minutes, seconds);
|
|
||||||
else
|
|
||||||
sprintf(spec, "%s%s %02d:%02d", stats, "%%", minutes, seconds);
|
|
||||||
|
|
||||||
strcpy(spec, convert_output_format(spec, NULL, NULL));
|
strcpy(spec, convert_output_format(spec, NULL, NULL));
|
||||||
}
|
}
|
||||||
@@ -2703,21 +2695,22 @@ char *filename, *p;
|
|||||||
kilobytes, strip_path(filename),
|
kilobytes, strip_path(filename),
|
||||||
n->encrypt?"E":empty_string))
|
n->encrypt?"E":empty_string))
|
||||||
{
|
{
|
||||||
char *s1;
|
const char *stat_format;
|
||||||
if (!get_int_var(DCC_BAR_TYPE_VAR))
|
if (!get_int_var(DCC_BAR_TYPE_VAR))
|
||||||
s1 = d1format;
|
stat_format = DCC_FORMAT_STAT_BARTYPE_0;
|
||||||
else
|
else
|
||||||
s1 = dformat;
|
stat_format = DCC_FORMAT_STAT_BARTYPE_1;
|
||||||
|
|
||||||
put_it("%s", convert_output_format(s1, "%d %s %s %s %s %s %s",
|
put_it("%s", convert_output_format(stat_format, "%d %s %s %s %s %s %s",
|
||||||
n->dccnum, local_type, n->encrypt ? "E":"<EFBFBD>",
|
n->dccnum, local_type, n->encrypt ? "E":"<EFBFBD>",
|
||||||
s->server, spec, kilobytes,
|
s->server, spec, kilobytes,
|
||||||
strip_path(filename)));
|
strip_path(filename)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This prints the second DCC stat line, if DCC_BAR_TYPE is non-zero. */
|
/* This prints the second DCC stat line, if DCC_BAR_TYPE is non-zero. */
|
||||||
if (do_hook(DCC_STATF1_LIST, "%s %lu %lu %d %d", stats, (unsigned long)bytes, (unsigned long)n->filesize, minutes, seconds))
|
if (do_hook(DCC_STATF1_LIST, "%4.1f %lu %lu %d %d", perc, (unsigned long)bytes, (unsigned long)n->filesize, minutes, seconds))
|
||||||
{
|
{
|
||||||
|
char stats[80];
|
||||||
char *stat_ptr, *spec_ptr;
|
char *stat_ptr, *spec_ptr;
|
||||||
if (!get_int_var(DCC_BAR_TYPE_VAR))
|
if (!get_int_var(DCC_BAR_TYPE_VAR))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user