add types to TUPLE: email

db4
Doug Coleman 2008-08-16 15:59:32 -05:00
parent 107cadf604
commit dbddc8d590
1 changed files with 10 additions and 7 deletions

View File

@ -1,10 +1,10 @@
! Copyright (C) 2007, 2008 Elie CHAFTARI, Dirk Vleugels,
! Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: namespaces io io.timeouts kernel logging io.sockets
USING: arrays namespaces io io.timeouts kernel logging io.sockets
sequences combinators sequences.lib splitting assocs strings
math.parser random system calendar io.encodings.ascii summary
calendar.format accessors sets ;
calendar.format accessors sets hashtables ;
IN: smtp
SYMBOL: smtp-domain
@ -132,7 +132,14 @@ ERROR: invalid-header-string string ;
: write-headers ( assoc -- )
[ write-header ] assoc-each ;
TUPLE: email from to subject headers body ;
TUPLE: email
{ from string }
{ to array }
{ subject string }
{ headers hashtable }
{ body string } ;
: <email> ( -- email ) email new ;
M: email clone
call-next-method [ clone ] change-headers ;
@ -177,10 +184,6 @@ M: email clone
now timestamp>rfc822 "Date" set-header
message-id "Message-Id" set-header ;
: <email> ( -- email )
email new
H{ } clone >>headers ;
: send-email ( email -- )
prepare (send) ;