Commit f4fb68369b4289a1014589e3c752a9897d2bb586

Authored by David RENÉ
1 parent d83c67e5

get message header from list of Data_IO

Showing 1 changed file with 42 additions and 17 deletions   Show diff stats
mail/compose_email.anubis
@@ -410,6 +410,31 @@ define String @@ -410,6 +410,31 @@ define String
410 line + message_header(d_io) 410 line + message_header(d_io)
411 }. 411 }.
412 412
  413 +define String
  414 + message_header
  415 + (
  416 + List(Data_IO) l_d_io
  417 + ) =
  418 + if l_d_io is
  419 + {
  420 + [] then "",
  421 + [h . t] then
  422 + if (ReadLineResult) read_line(h) is
  423 + {
  424 + error then "",
  425 + timeout then "",
  426 + eof then
  427 + //end of file, continue with the next data_io
  428 + message_header(t),
  429 + ok(line) then
  430 + if length(line) = 0 then
  431 + ""
  432 + else
  433 + line + message_header(l_d_io)
  434 + }
  435 + }
  436 +.
  437 +
413 public define String 438 public define String
414 get_message_header 439 get_message_header
415 ( 440 (
@@ -428,7 +453,7 @@ public define String @@ -428,7 +453,7 @@ public define String
428 ( 453 (
429 List(Data_IO) mail_parts 454 List(Data_IO) mail_parts
430 )= 455 )=
431 - //open the message file from the drive 456 + //rewind the reader
432 if rewind(mail_parts) then 457 if rewind(mail_parts) then
433 message_header(mail_parts) 458 message_header(mail_parts)
434 //"get_message_header NOT YET Implemented." 459 //"get_message_header NOT YET Implemented."
@@ -465,22 +490,22 @@ public define List(String) @@ -465,22 +490,22 @@ public define List(String)
465 String string_list, 490 String string_list,
466 List(String) mails_list 491 List(String) mails_list
467 )= 492 )=
468 - if find(",", string_list, 0) is  
469 - {  
470 - failure then [string_list . mails_list],  
471 - success(separator) then  
472 - if sub_string(string_list, 0, separator) is  
473 - {  
474 - failure then [],  
475 - success(mail) then  
476 - if sub_string(string_list, separator + 1, length(string_list) - (separator + 1)) is  
477 - {  
478 - failure then [],  
479 - success(rest) then list_of_mails(rest, [mail . mails_list])  
480 - }  
481 - }  
482 - }  
483 - . 493 + if find(",", string_list, 0) is
  494 + {
  495 + failure then [string_list . mails_list],
  496 + success(separator) then
  497 + if sub_string(string_list, 0, separator) is
  498 + {
  499 + failure then [],
  500 + success(mail) then
  501 + if sub_string(string_list, separator + 1, length(string_list) - (separator + 1)) is
  502 + {
  503 + failure then [],
  504 + success(rest) then list_of_mails(rest, [mail . mails_list])
  505 + }
  506 + }
  507 + }
  508 +.
484 509
485 public define Maybe(Email_Address) 510 public define Maybe(Email_Address)
486 parse_address 511 parse_address