Use the same format in /DCC LIST for all waiting offers
Previously waiting (inactive) file-type offers were shown different to others, omitting the time-since-offer. Unify them to use the same format, which also cuts out a few lines of code. Also tweaks the DCC_BAR_TYPE 1 format to include the DCC state (always Active) where the completion bar would be in the DCC_BAR_TYPE 0 format. This just looks a bit more consistent.
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
[Changes 1.2.2]
|
[Changes 1.2.2]
|
||||||
|
|
||||||
|
* Use the same format in /DCC LIST for all waiting offers and tweak
|
||||||
|
the DCC_BAR_TYPE 1 format to show DCC state. (caf)
|
||||||
|
|
||||||
* Correctly show time since offer for DCC CHAT offers in /DCC LIST. (caf)
|
* Correctly show time since offer for DCC CHAT offers in /DCC LIST. (caf)
|
||||||
|
|
||||||
* Improve completion bar for /SET DCC_BAR_TYPE 1 so that it always matches
|
* Improve completion bar for /SET DCC_BAR_TYPE 1 so that it always matches
|
||||||
|
|||||||
34
source/dcc.c
34
source/dcc.c
@@ -2472,7 +2472,7 @@ static const char *dcc_get_state(const SocketList *s)
|
|||||||
* Includes the inline completion bar if DCC_VAR_TYPE is 0.
|
* Includes the inline completion bar if DCC_VAR_TYPE is 0.
|
||||||
*/
|
*/
|
||||||
#define STAT_FORMAT_PREFIX "#$[3]0 $[6]1%Y$2%n $[11]3 "
|
#define STAT_FORMAT_PREFIX "#$[3]0 $[6]1%Y$2%n $[11]3 "
|
||||||
#define STAT_FORMAT_SUFFIX " $[7]4 $[7]5 $[7]6 $7-"
|
#define STAT_FORMAT_SUFFIX " $[7]5 $[7]6 $[7]7 $8-"
|
||||||
static const char *get_stat_format(double pcomplete)
|
static const char *get_stat_format(double pcomplete)
|
||||||
{
|
{
|
||||||
#ifdef ONLY_STD_CHARS
|
#ifdef ONLY_STD_CHARS
|
||||||
@@ -2509,14 +2509,14 @@ static const char * const bar_format[] = {
|
|||||||
{
|
{
|
||||||
return bar_format[idx];
|
return bar_format[idx];
|
||||||
}
|
}
|
||||||
return STAT_FORMAT_PREFIX "$[7]4 $[18]5 $[7]6 $7-";
|
return STAT_FORMAT_PREFIX "$[10]4" STAT_FORMAT_SUFFIX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dcc_glist(char *command, char *args)
|
void dcc_glist(char *command, char *args)
|
||||||
{
|
{
|
||||||
#define DCC_FORMAT_STAT_PENDING STAT_FORMAT_PREFIX "$[25]4 $[7]5 $6-"
|
#define DCC_FORMAT_STAT_PENDING STAT_FORMAT_PREFIX "$[25]4 $[7]5 $6-"
|
||||||
#define DCC_FORMAT_STAT_CHAT STAT_FORMAT_PREFIX "$[7]4 $[-4]5 $[-3]6 $[-3]7 $[-3]8 $[7]9 $10"
|
#define DCC_FORMAT_STAT STAT_FORMAT_PREFIX "$[7]4 $[-4]5 $[-3]6 $[-3]7 $[-3]8 $[7]9 $10"
|
||||||
int i;
|
int i;
|
||||||
DCC_int *n = NULL;
|
DCC_int *n = NULL;
|
||||||
SocketList *s;
|
SocketList *s;
|
||||||
@@ -2594,7 +2594,9 @@ void dcc_glist(char *command, char *args)
|
|||||||
while ((p = strchr(p, ' ')))
|
while ((p = strchr(p, ' ')))
|
||||||
*p = '_';
|
*p = '_';
|
||||||
|
|
||||||
if (((type == DCC_CHAT) || (type == DCC_RAW) || (type == DCC_BOTMODE) || (type == DCC_FTPOPEN)))
|
/* All Waiting or non-file DCCs use the ordinary STAT line */
|
||||||
|
if (!(s->flags & DCC_ACTIVE) ||
|
||||||
|
(type == DCC_CHAT) || (type == DCC_RAW) || (type == DCC_BOTMODE) || (type == DCC_FTPOPEN))
|
||||||
{
|
{
|
||||||
if (!(s->flags & DCC_ACTIVE))
|
if (!(s->flags & DCC_ACTIVE))
|
||||||
xtime = now - n->lasttime.tv_sec;
|
xtime = now - n->lasttime.tv_sec;
|
||||||
@@ -2602,7 +2604,7 @@ void dcc_glist(char *command, char *args)
|
|||||||
n->dccnum, type_name, s->server,
|
n->dccnum, type_name, s->server,
|
||||||
dcc_get_state(s),
|
dcc_get_state(s),
|
||||||
"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(DCC_FORMAT_STAT_CHAT, "%d %s %s %s %s %s %s %s",
|
put_it("%s", convert_output_format(DCC_FORMAT_STAT, "%d %s %s %s %s %s %s %s",
|
||||||
n->dccnum,
|
n->dccnum,
|
||||||
type_name,
|
type_name,
|
||||||
n->encrypt ? "E" : "<EFBFBD>",
|
n->encrypt ? "E" : "<EFBFBD>",
|
||||||
@@ -2612,23 +2614,7 @@ void dcc_glist(char *command, char *args)
|
|||||||
"N/A",
|
"N/A",
|
||||||
strip_path(filename)));
|
strip_path(filename)));
|
||||||
}
|
}
|
||||||
else if (!(s->flags & DCC_ACTIVE))
|
/* Active file DCCs use the STATF / STATF1 lines */
|
||||||
{
|
|
||||||
if (do_hook(DCC_STAT_LIST, "%d %s %s %s %s %s %s",
|
|
||||||
n->dccnum, type_name, s->server,
|
|
||||||
dcc_get_state(s),
|
|
||||||
"N/A", strip_path(filename), n->encrypt?"E":empty_string))
|
|
||||||
{
|
|
||||||
put_it("%s", convert_output_format(DCC_FORMAT_STAT_PENDING, "%d %s %s %s %s %s %s",
|
|
||||||
n->dccnum,
|
|
||||||
type_name,
|
|
||||||
n->encrypt ? "E" : "<EFBFBD>",
|
|
||||||
s->server,
|
|
||||||
dcc_get_state(s),
|
|
||||||
"N/A",
|
|
||||||
strip_path(filename)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double bytes = n->bytes_read + n->bytes_sent;
|
double bytes = n->bytes_read + n->bytes_sent;
|
||||||
@@ -2676,9 +2662,9 @@ void dcc_glist(char *command, char *args)
|
|||||||
{
|
{
|
||||||
const char *stat_format = get_stat_format(pcomplete);
|
const char *stat_format = get_stat_format(pcomplete);
|
||||||
|
|
||||||
put_it("%s", convert_output_format(stat_format, "%d %s %s %s %s %s %s %s",
|
put_it("%s", convert_output_format(stat_format, "%d %s %s %s %s %s %s %s %s",
|
||||||
n->dccnum, type_name, n->encrypt ? "E":"<EFBFBD>",
|
n->dccnum, type_name, n->encrypt ? "E":"<EFBFBD>",
|
||||||
s->server, percent, eta, kilobytes,
|
s->server, dcc_get_state(s), percent, eta, kilobytes,
|
||||||
strip_path(filename)));
|
strip_path(filename)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user