Debase, path! compare and import-email
[1/3] from: mario::cassani::icl::com at: 14-Nov-2001 16:17
Hallo Rebolers,
I am working with Brett's mime handling scripts trying to
save attachments with /View 1.2.1.
Some scripts claim that the 'debase is buggy in this
release so I wondered why this hasn't been fixed/released,
yet o, at least, an old 1.2.0 archive wasn't left on the RT
site (the truth is that I really want to put my hands on the
next version/release :P ).
At last I used manipulate-emails.r but I still have one
problem:
1) How can I compare two path!s?
to-lit-path mime-type == 'text/plain
gives this message:
** Script Error: text has no value
** Near: part-name: join "default" mime-file-ext part-mime
to better understand a piece of the script follows...
8<----------------------------------------------------------
do %manipulate-emails.r
mime-file-ext: func [mime-type] [
extension: ".bin"
if to-lit-path mime-type == 'text/plain [extension: ".txt"]
return extension
]
change-dir %/d/rebol/programs/develop/
mailfile: %/D/Archivio/MailArchive/2001/11/14/Mail/ICL/0002.txt
mmsg: import-email msg: read mailfile ; dump of a "real" message
mime-contents: extract-mime-multipart-msg mmsg
foreach [part-mime part-name part-data] mime-contents [
if none? part-name [
part-name: join "default" mime-file-ext part-mime
]
print rejoin [{Type: } part-mime newline {Name: "} part-name {"}]
save join %./ part-name part-data
]
---------------------------------------------------------->8
I have a doubt: isn't the 'import-email slow? Maybe some
mail handling should be made on the "original" message (msg)?
Thanks for any suggestion/comment
Mario
[2/3] from: greggirwin:mindspring at: 14-Nov-2001 10:59
Hi Mario,
<< 1) How can I compare two path!s?
to-lit-path mime-type == 'text/plain >>
How about:
:mime-type == 'text/plain
or
:mime-type = 'text/plain
I'm not a mime :) so I don't know if it should be case sensitive.
--Gregg
[3/3] from: brett:codeconscious at: 15-Nov-2001 10:23
Hi Mario,
I'm pleased to see that you are using some of my scripts, however I have
made a small blunder. I neglected to remove
the manipulate-emails.r script from my site and replace it with a somewhat
newer script that is on my Rebsite. This I will
rectify shortly. I also changed naming because while I was fixing some bugs
I also wanted to make it a bit more general:
http://www.codeconscious.com/rebol-library/inetmsg-model.r
http://www.codeconscious.com/rebol-library/mime-model.r
http://www.codeconscious.com/rebol-library/encodings.r
Regarding my debase claim:
This is Core 2.5:
>> debase enbase "x"
== #{78}
This is View 1.2.1
>> debase enbase "x"
Dr Watson for NT, An error has occurred.....
Finally, the comparison of the mime-type (path).
Maybe I didn't pick a good type for comparisons :)
Anyway Gregg has shown how to compare them, you could also convert it back
to a string with FORM like I do
in mime-model.r
Brett.