summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/curses/gui-display.c13
-rw-r--r--src/irc/irc-dcc.c2
-rw-r--r--src/irc/irc.h1
-rw-r--r--weechat/src/gui/curses/gui-display.c13
-rw-r--r--weechat/src/irc/irc-dcc.c2
-rw-r--r--weechat/src/irc/irc.h1
6 files changed, 24 insertions, 8 deletions
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index 26481f740..e3c956e09 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -675,7 +675,8 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
char *unit_format[] = { "%.0Lf", "%.1Lf", "%.02Lf", "%.02Lf" };
long unit_divide[] = { 1, 1024, 1024*1024, 1024*1024,1024 };
int num_unit;
- char format[32];
+ char format[32], date[128];
+ struct tm *date_tmp;
if (!gui_ok)
return;
@@ -736,11 +737,11 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
_(dcc_status_string[ptr_dcc->status]));
/* other infos */
+ gui_window_set_color (ptr_win->win_chat,
+ (ptr_dcc == dcc_selected) ?
+ COLOR_DCC_SELECTED : COLOR_WIN_CHAT);
if (DCC_IS_FILE(ptr_dcc->type))
{
- gui_window_set_color (ptr_win->win_chat,
- (ptr_dcc == dcc_selected) ?
- COLOR_DCC_SELECTED : COLOR_WIN_CHAT);
wprintw (ptr_win->win_chat, " [");
if (ptr_dcc->size == 0)
num_bars = 10;
@@ -770,9 +771,13 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
unit_name[num_unit],
((long double) ptr_dcc->size) / ((long double)(unit_divide[num_unit])),
unit_name[num_unit]);
+ wclrtoeol (ptr_win->win_chat);
}
else
{
+ date_tmp = localtime (&(ptr_dcc->start_time));
+ strftime (date, sizeof (date) - 1, "%a, %d %b %Y %H:%M:%S", date_tmp);
+ wprintw (ptr_win->win_chat, " %s", date);
wclrtoeol (ptr_win->win_chat);
}
diff --git a/src/irc/irc-dcc.c b/src/irc/irc-dcc.c
index 6cc21774f..07749f670 100644
--- a/src/irc/irc-dcc.c
+++ b/src/irc/irc-dcc.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <stdarg.h>
#include <fcntl.h>
+#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -355,6 +356,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
new_dcc->channel = NULL;
new_dcc->type = type;
new_dcc->status = DCC_WAITING;
+ new_dcc->start_time = time (NULL);
new_dcc->addr = addr;
new_dcc->port = port;
new_dcc->nick = strdup (nick);
diff --git a/src/irc/irc.h b/src/irc/irc.h
index 755bb874b..45c26daae 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -210,6 +210,7 @@ struct t_irc_dcc
t_irc_channel *channel; /* irc channel (for DCC chat only) */
int type; /* DCC type (send or receive) */
int status; /* DCC status (waiting, sending, ..) */
+ time_t start_time; /* the time when DCC started */
unsigned long addr; /* IP address */
int port; /* port */
char *nick; /* remote nick */
diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c
index 26481f740..e3c956e09 100644
--- a/weechat/src/gui/curses/gui-display.c
+++ b/weechat/src/gui/curses/gui-display.c
@@ -675,7 +675,8 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
char *unit_format[] = { "%.0Lf", "%.1Lf", "%.02Lf", "%.02Lf" };
long unit_divide[] = { 1, 1024, 1024*1024, 1024*1024,1024 };
int num_unit;
- char format[32];
+ char format[32], date[128];
+ struct tm *date_tmp;
if (!gui_ok)
return;
@@ -736,11 +737,11 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
_(dcc_status_string[ptr_dcc->status]));
/* other infos */
+ gui_window_set_color (ptr_win->win_chat,
+ (ptr_dcc == dcc_selected) ?
+ COLOR_DCC_SELECTED : COLOR_WIN_CHAT);
if (DCC_IS_FILE(ptr_dcc->type))
{
- gui_window_set_color (ptr_win->win_chat,
- (ptr_dcc == dcc_selected) ?
- COLOR_DCC_SELECTED : COLOR_WIN_CHAT);
wprintw (ptr_win->win_chat, " [");
if (ptr_dcc->size == 0)
num_bars = 10;
@@ -770,9 +771,13 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
unit_name[num_unit],
((long double) ptr_dcc->size) / ((long double)(unit_divide[num_unit])),
unit_name[num_unit]);
+ wclrtoeol (ptr_win->win_chat);
}
else
{
+ date_tmp = localtime (&(ptr_dcc->start_time));
+ strftime (date, sizeof (date) - 1, "%a, %d %b %Y %H:%M:%S", date_tmp);
+ wprintw (ptr_win->win_chat, " %s", date);
wclrtoeol (ptr_win->win_chat);
}
diff --git a/weechat/src/irc/irc-dcc.c b/weechat/src/irc/irc-dcc.c
index 6cc21774f..07749f670 100644
--- a/weechat/src/irc/irc-dcc.c
+++ b/weechat/src/irc/irc-dcc.c
@@ -29,6 +29,7 @@
#include <string.h>
#include <stdarg.h>
#include <fcntl.h>
+#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -355,6 +356,7 @@ dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nic
new_dcc->channel = NULL;
new_dcc->type = type;
new_dcc->status = DCC_WAITING;
+ new_dcc->start_time = time (NULL);
new_dcc->addr = addr;
new_dcc->port = port;
new_dcc->nick = strdup (nick);
diff --git a/weechat/src/irc/irc.h b/weechat/src/irc/irc.h
index 755bb874b..45c26daae 100644
--- a/weechat/src/irc/irc.h
+++ b/weechat/src/irc/irc.h
@@ -210,6 +210,7 @@ struct t_irc_dcc
t_irc_channel *channel; /* irc channel (for DCC chat only) */
int type; /* DCC type (send or receive) */
int status; /* DCC status (waiting, sending, ..) */
+ time_t start_time; /* the time when DCC started */
unsigned long addr; /* IP address */
int port; /* port */
char *nick; /* remote nick */