197 |
with e -> |
with e -> |
198 |
lprintf "Exception in file_cancel: %s\n" (Printexc2.to_string e) |
lprintf "Exception in file_cancel: %s\n" (Printexc2.to_string e) |
199 |
|
|
200 |
|
let time_to_string time = |
201 |
|
let days = time / 60 / 60 / 24 in |
202 |
|
let rest = time - days * 60 * 60 * 24 in |
203 |
|
let hours = rest / 60 / 60 in |
204 |
|
let rest = rest - hours * 60 * 60 in |
205 |
|
let minutes = rest / 60 in |
206 |
|
let seconds = rest - minutes * 60 in |
207 |
|
if days > 0 |
208 |
|
then Printf.sprintf " %dd " days |
209 |
|
else if hours > 0 |
210 |
|
then Printf.sprintf " %dh %dm " hours minutes |
211 |
|
else Printf.sprintf " %dm " minutes |
212 |
|
|
213 |
let mail_for_completed_file file = |
let mail_for_completed_file file = |
214 |
if !!mail <> "" then |
if !!mail <> "" then |
215 |
let module M = Mailer in |
let module M = Mailer in |
216 |
|
let info = file_info file in |
217 |
let line1 = "mldonkey has completed the download of:\r\n\r\n" in |
let line1 = "mldonkey has completed the download of:\r\n\r\n" in |
218 |
|
|
219 |
let line2 = Printf.sprintf "\r\nFile: %s\r\nSize: %Ld bytes\r\n" |
let line2 = Printf.sprintf "\r\nFile: %s\r\nSize: %Ld bytes\r\nHash: %s\r\nFile was downloaded in%s\r\n" |
220 |
(file_best_name file) |
(file_best_name file) |
221 |
(file_size file) |
(file_size file) |
222 |
|
(string_of_uids info.G.file_uids) |
223 |
|
(let age = (BasicSocket.last_time ()) - info.G.file_age in time_to_string age) |
224 |
in |
in |
225 |
|
|
226 |
let line3 = if (file_comment file) <> "" then |
let line3 = if (file_comment file) <> "" then |