diff --git a/mail/compose_email.anubis b/mail/compose_email.anubis index 97cdaf7..3908a7c 100644 --- a/mail/compose_email.anubis +++ b/mail/compose_email.anubis @@ -115,40 +115,6 @@ define Maybe($T) } }. - define Maybe(String) - day_name - ( - Int day_num - )= - if day_num = 1 then success("Mon") - else if day_num = 2 then success("Tue") - else if day_num = 3 then success("Wed") - else if day_num = 4 then success("Thu") - else if day_num = 5 then success("Fri") - else if day_num = 6 then success("Sat") - else if day_num = 7 then success("Sun") - else failure - . - - define Maybe(String) - month_name - ( - Int month_num - )= - if month_num = 1 then success("Jan") - else if month_num = 2 then success("Feb") - else if month_num = 3 then success("Mar") - else if month_num = 4 then success("Apr") - else if month_num = 5 then success("May") - else if month_num = 6 then success("Jun") - else if month_num = 7 then success("Jul") - else if month_num = 8 then success("Aug") - else if month_num = 9 then success("Sep") - else if month_num = 10 then success("Oct") - else if month_num = 11 then success("Nov") - else if month_num = 12 then success("Dec") - else failure - . public define String address_to_string @@ -239,24 +205,17 @@ public define String define String data_file_multipart ( - String attached_file, + File_ref file, )= - - if (Maybe(RStream))file(attached_file, read) is - { - failure then - data_file_multipart(attached_file, constant_byte_array(0,0)) - success(fd) then - with data_file = if reliable_read(fd, file_size(attached_file), 100) is + with data_file = if read_from_file(file.path +"/"+file.name) is { - failure then constant_byte_array(0,0), - success(data) then data - }, - - data_file_multipart(attached_file, data_file) + cannot_find_file then constant_byte_array(0,0), + read_error(data) then data + ok(data) then data + }, + data_file_multipart(file.name, data_file) +. - } -. if file(fullpath, read) is { failure then @@ -267,8 +226,7 @@ define String define String data_files_multipart ( - //List(File_Attached) files, - List(String) files, + List(File_ref) files, String boundary )= if files is @@ -277,7 +235,8 @@ define String [file_j . t] then "--" + boundary + crlf + data_file_multipart(file_j) + data_files_multipart(t, boundary) - }. + } +. public define String @@ -399,7 +358,7 @@ public define String "Message-ID: " + to_ascii(sha1((from, send_date))) + crlf + "Date: " + send_date + crlf + // "From: " + user.login + "<" + user.login + "@" + domain + ">" + crlf + - "User-Agent: Calexium lib email sender" + crlf + + "User-Agent: Anubis XLib email sender" + crlf + "From: " + "<" + from.address + ">" + crlf + (if reply_to = "" then "" -- libgit2 0.21.4