[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co... |
Date: |
Sun, 13 Mar 2011 17:51:02 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 11/03/13 17:51:02
Modified files:
distrib : ChangeLog
src/daemon/common: commonInteractive.ml commonOptions.ml
src/utils/net : mailer.ml
Log message:
patch #7456
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1522&r2=1.1523
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonInteractive.ml?cvsroot=mldonkey&r1=1.111&r2=1.112
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.238&r2=1.239
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/utils/net/mailer.ml?cvsroot=mldonkey&r1=1.15&r2=1.16
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1522
retrieving revision 1.1523
diff -u -b -r1.1522 -r1.1523
--- distrib/ChangeLog 13 Mar 2011 17:45:32 -0000 1.1522
+++ distrib/ChangeLog 13 Mar 2011 17:51:02 -0000 1.1523
@@ -15,6 +15,7 @@
=========
2011/03/13
+7456: Mail: Multiple mail addresses for admin (ygrek)
7500: Diskinfo: Recognize BTRFS
2011/03/10
Index: src/daemon/common/commonInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonInteractive.ml,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -b -r1.111 -r1.112
--- src/daemon/common/commonInteractive.ml 19 Dec 2010 10:31:21 -0000
1.111
+++ src/daemon/common/commonInteractive.ml 13 Mar 2011 17:51:02 -0000
1.112
@@ -114,12 +114,14 @@
if full then Hashtbl.replace last_sent_dir_warning dir current_time;
CommonEvent.add_event (Console_message_event
(Printf.sprintf "\nWARNING: %s %s, %s\n" dir status line1));
- if !!mail <> "" then
+ match String2.tokens !!mail with
+ | [] -> ()
+ | mails ->
let module M = Mailer in
let subject = Printf.sprintf "address@hidden AUTOMATED WARNING: %s %s"
(Unix.gethostname ()) dir status in
let mail = {
- M.mail_to = !!mail;
- M.mail_from = !!mail;
+ M.mail_to = mails;
+ M.mail_from = List.hd mails;
M.mail_subject = subject;
M.mail_body = line1;
M.smtp_login = !!smtp_login;
@@ -207,7 +209,7 @@
("USER_MAIL", ( if (file_owner file).user_mail <> "" then
(file_owner file).user_mail
else
- if !!mail <> "" then !!mail else ""));
+ match String2.tokens !!mail with [] -> "" | x::_
-> x));
("FILE_GROUP_CNT", string_of_int (fst (file_group_info)));
]
@ snd (file_group_info))
@@ -330,7 +332,8 @@
let mail_for_completed_file file =
let usermail = (file_owner file).user_mail in
- if (!!mail <> "" || usermail <> "") && !!smtp_server <> "" && !!smtp_port <>
0 then begin
+ let mail = String2.tokens !!mail in
+ if (mail <> [] || usermail <> "") && !!smtp_server <> "" && !!smtp_port <> 0
then begin
let module M = Mailer in
let info = file_info file in
let line1 = "mldonkey has completed the download of:\r\n\r\n" in
@@ -379,7 +382,7 @@
let send_mail address admin =
let mail = {
M.mail_to = address;
- M.mail_from = address;
+ M.mail_from = List.hd address;
M.mail_subject = subject;
M.mail_body = line1 ^ line2 ^ line3 ^ line4 ^ line5 ^ (if admin then
line6 else "") ^ line7;
M.smtp_login = !!smtp_login;
@@ -387,8 +390,8 @@
} in
M.sendmail !!smtp_server !!smtp_port !!add_mail_brackets mail
in
- if !!mail <> "" then send_mail !!mail true; (* Multiuser ToDo: this mail
is for the admin user, optional? *)
- if usermail <> "" && usermail <> !!mail then (try send_mail usermail false
with Not_found -> ())
+ if mail <> [] then send_mail mail true; (* Multiuser ToDo: this mail is
for the admin user, optional? *)
+ if usermail <> "" && [usermail] <> mail then (try send_mail [usermail]
false with Not_found -> ())
end
let file_completed (file : file) =
@@ -588,7 +591,7 @@
("USER_MAIL", ( if (file_owner file).user_mail <> "" then
(file_owner file).user_mail
else
- if !!mail <> "" then !!mail else ""));
+ match String2.tokens !!mail with [] -> "" | x::_
-> x));
("FILE_GROUP_CNT", string_of_int (fst (file_group_info)));
]
@ snd (file_group_info))
Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.238
retrieving revision 1.239
diff -u -b -r1.238 -r1.239
--- src/daemon/common/commonOptions.ml 23 Jan 2011 15:20:26 -0000 1.238
+++ src/daemon/common/commonOptions.ml 13 Mar 2011 17:51:02 -0000 1.239
@@ -1178,19 +1178,19 @@
string_option ""
let mail = define_option current_section ["mail"]
- "Your e-mail if you want to receive mails when downloads are completed"
+ (_s"Email address to receive notifications when downloads are completed or
disk is full (leave empty to disable, separate multiple addresses with space)")
string_option ""
let add_mail_brackets = define_option current_section ["add_mail_brackets"]
- "Set to false if your mail server cannot handle angle-brackets around
addresses (RFC 5321)"
+ (_s"Set to false if your mail server cannot handle angle-brackets around
addresses (RFC 5321)")
bool_option true
let filename_in_subject = define_option current_section ["filename_in_subject"]
- "Send filename in mail subject"
+ (_s"Send filename in mail subject")
bool_option true
let url_in_mail = define_option current_section ["url_in_mail"]
- "Put a prefix for the filename here which shows up in the notification mail"
+ (_s"Put a prefix for the filename here which shows up in the notification
mail")
string_option ""
Index: src/utils/net/mailer.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/utils/net/mailer.ml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/utils/net/mailer.ml 22 Dec 2010 10:04:57 -0000 1.15
+++ src/utils/net/mailer.ml 13 Mar 2011 17:51:02 -0000 1.16
@@ -25,7 +25,7 @@
open Md4
type mail = {
- mail_to : string;
+ mail_to : string list;
mail_from : string;
mail_subject : string;
mail_body : string;
@@ -115,11 +115,18 @@
let mail_address new_style s = if new_style then "<"^s^">" else s
let make_mail mail new_style =
+ let (mail_to,mail_cc) =
+ match mail.mail_to with
+ | [] -> failwith "no recipients specified"
+ | x::xs -> x,xs
+ in
let mail_date = Date.mail_string (Unix.time ()) in
+ let addr = mail_address new_style in
Printf.sprintf
- "From: mldonkey %s\r\nTo: %s\r\n%s\r\nMIME-Version:
1.0\r\nContent-Type: text/plain; charset=utf-8\r\nDate: %s\r\n\r\n%s"
- (mail_address new_style mail.mail_from)
- mail.mail_to
+ "From: mldonkey %s\r\nTo: %s\r\n%s%s\r\nMIME-Version:
1.0\r\nContent-Type: text/plain; charset=utf-8\r\nDate: %s\r\n\r\n%s"
+ (addr mail.mail_from)
+ (addr mail_to)
+ (match mail_cc with [] -> "" | l -> Printf.sprintf "Cc: %s\r\n"
(String.concat ", " (List.map addr l)))
(rfc2047_encode "Subject: " "utf-8" mail.mail_subject)
mail_date
mail.mail_body
@@ -225,8 +232,10 @@
send1 oc "MAIL FROM:" (mail_address new_style (canon_addr
mail.mail_from));
if read_response ic <> 250 then bad_response ();
- send1 oc "RCPT TO:" (mail_address new_style (canon_addr mail.mail_to));
+ List.iter begin fun address ->
+ send1 oc "RCPT TO:" (mail_address new_style (canon_addr address));
if read_response ic <> 250 then bad_response ();
+ end mail.mail_to;
send oc "DATA";
if read_response ic <> 354 then bad_response ();