summaryrefslogtreecommitdiff
path: root/src/gui/curses/gui-display.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-04-23 18:13:25 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-04-23 18:13:25 +0000
commit73c69d2d71b7051209d7904dba0162d53b829ca6 (patch)
tree853f4a89ad81e654ea2131504ed22cdfae2d8914 /src/gui/curses/gui-display.c
parent2f9f37bed63a990432b4f40347975cab5a28664c (diff)
downloadweechat-73c69d2d71b7051209d7904dba0162d53b829ca6.zip
Added transfer rate for DCC files
Diffstat (limited to 'src/gui/curses/gui-display.c')
-rw-r--r--src/gui/curses/gui-display.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index 094c3b019..e1f36e15f 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -765,6 +765,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
wprintw (ptr_win->win_chat, ">");
for (j = 0; j < 10 - num_bars; j++)
wprintw (ptr_win->win_chat, " ");
+
if (ptr_dcc->size < 1024*10)
num_unit = 0;
else if (ptr_dcc->size < 1024*1024)
@@ -779,20 +780,31 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
unit_format[num_unit],
unit_format[num_unit]);
wprintw (ptr_win->win_chat, format,
- ((long double) ptr_dcc->pos) / ((long double)(unit_divide[num_unit])),
+ ((long double)(ptr_dcc->pos)) / ((long double)(unit_divide[num_unit])),
unit_name[num_unit],
- ((long double) ptr_dcc->size) / ((long double)(unit_divide[num_unit])),
+ ((long double)(ptr_dcc->size)) / ((long double)(unit_divide[num_unit])),
+ unit_name[num_unit]);
+
+ if (ptr_dcc->bytes_per_sec < 1024*1024)
+ num_unit = 1;
+ else if (ptr_dcc->bytes_per_sec < 1024*1024*1024)
+ num_unit = 2;
+ else
+ num_unit = 3;
+ sprintf (format, " (%s %%s/s)", unit_format[num_unit]);
+ wprintw (ptr_win->win_chat, format,
+ ((long double) ptr_dcc->bytes_per_sec) / ((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);
}
+ wclrtoeol (ptr_win->win_chat);
+
ptr_win->dcc_last_displayed = ptr_dcc;
i += 2;
}