From f4fb68369b4289a1014589e3c752a9897d2bb586 Mon Sep 17 00:00:00 2001 From: totoro Date: Fri, 30 Sep 2022 20:38:34 +0200 Subject: [PATCH] get message header from list of Data_IO --- mail/compose_email.anubis | 59 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/mail/compose_email.anubis b/mail/compose_email.anubis index 7125570..0344f7c 100644 --- a/mail/compose_email.anubis +++ b/mail/compose_email.anubis @@ -410,6 +410,31 @@ define String line + message_header(d_io) }. +define String + message_header + ( + List(Data_IO) l_d_io + ) = + if l_d_io is + { + [] then "", + [h . t] then + if (ReadLineResult) read_line(h) is + { + error then "", + timeout then "", + eof then + //end of file, continue with the next data_io + message_header(t), + ok(line) then + if length(line) = 0 then + "" + else + line + message_header(l_d_io) + } + } +. + public define String get_message_header ( @@ -428,7 +453,7 @@ public define String ( List(Data_IO) mail_parts )= - //open the message file from the drive + //rewind the reader if rewind(mail_parts) then message_header(mail_parts) //"get_message_header NOT YET Implemented." @@ -465,22 +490,22 @@ public define List(String) String string_list, List(String) mails_list )= - if find(",", string_list, 0) is - { - failure then [string_list . mails_list], - success(separator) then - if sub_string(string_list, 0, separator) is - { - failure then [], - success(mail) then - if sub_string(string_list, separator + 1, length(string_list) - (separator + 1)) is - { - failure then [], - success(rest) then list_of_mails(rest, [mail . mails_list]) - } - } - } - . + if find(",", string_list, 0) is + { + failure then [string_list . mails_list], + success(separator) then + if sub_string(string_list, 0, separator) is + { + failure then [], + success(mail) then + if sub_string(string_list, separator + 1, length(string_list) - (separator + 1)) is + { + failure then [], + success(rest) then list_of_mails(rest, [mail . mails_list]) + } + } + } +. public define Maybe(Email_Address) parse_address -- libgit2 0.21.4