Correctly show time since offer for DCC CHAT offers in /DCC LIST

s->time on the SocketList is set to the time that the chat offer will expire, so it's in the future.
This shows up as a very large positive time.  Instead, use n->lasttime as that is set to the time
when the offer is made.

Also adjust the format for non-file offers so that it all lines up properly.
This commit is contained in:
Kevin Easton
2016-10-27 15:14:57 +11:00
parent 30e3e65af7
commit 919b76fcef
2 changed files with 4 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
[Changes 1.2.2] [Changes 1.2.2]
* 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
the completion percentage. (caf) the completion percentage. (caf)

View File

@@ -2517,7 +2517,7 @@ static const char * const _dcc_offer[] = {
void dcc_glist(char *command, char *args) void dcc_glist(char *command, char *args)
{ {
#define DCC_FORMAT_STAT_PENDING "#$[3]0 $[6]1%Y$2%n $[11]3 $[25]4 $[7]5 $6-" #define DCC_FORMAT_STAT_PENDING "#$[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" #define DCC_FORMAT_STAT_CHAT "#$[3]0 $[6]1%Y$2%n $[11]3 $[7]4 $[-4]5 $[-3]6 $[-3]7 $[-3]8 $[7]9 $10"
#define DCC_FORMAT_STAT_BARTYPE_0 "#$[3]0 $[6]1%Y$2%n $[11]3 $4 $[7]5 $[7]6 $[7]7 $8-" #define DCC_FORMAT_STAT_BARTYPE_0 "#$[3]0 $[6]1%Y$2%n $[11]3 $4 $[7]5 $[7]6 $[7]7 $8-"
#define DCC_FORMAT_STAT_BARTYPE_1 "#$[3]0 $[6]1%Y$2%n $[11]3 $[7]5 $[18]6 $[7]7 $8-" #define DCC_FORMAT_STAT_BARTYPE_1 "#$[3]0 $[6]1%Y$2%n $[11]3 $[7]5 $[18]6 $[7]7 $8-"
int i; int i;
@@ -2607,7 +2607,7 @@ void dcc_glist(char *command, char *args)
if (((type == DCC_CHAT) || (type == DCC_RAW) || (type == DCC_BOTMODE) || (type == DCC_FTPOPEN))) if (((type == DCC_CHAT) || (type == DCC_RAW) || (type == DCC_BOTMODE) || (type == DCC_FTPOPEN)))
{ {
if (!(s->flags & DCC_ACTIVE)) if (!(s->flags & DCC_ACTIVE))
xtime = now - s->time; xtime = now - n->lasttime.tv_sec;
if (do_hook(DCC_STAT_LIST, "%d %s %s %s %s %s %s", if (do_hook(DCC_STAT_LIST, "%d %s %s %s %s %s %s",
n->dccnum, local_type, s->server, n->dccnum, local_type, s->server,
dcc_get_state(s), dcc_get_state(s),