Core: MIME more extensions

git-svn-id: svn://ultimatepp.org/upp/trunk@7202 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-04-09 11:17:28 +00:00
parent 5cddf6af17
commit ff4f567deb
4 changed files with 25 additions and 7 deletions

View file

@ -9,6 +9,7 @@ static Tuple2<const char *, const char *> sEXT_MIME[] = {
{ "eml", "message/rfc822" },
{ "tiff", "image/tiff" },
{ "xls", "application/vnd.ms-excel" },
{ "csv", "text/csv" },
{ "323", "text/h323" },
{ "acx", "application/internet-property-stream" },
@ -228,7 +229,10 @@ const Index<String>& GetMIMETypes() {
String FileExtToMIME(const String& ext)
{
int q = sEXT().Find(ToLower(ext));
String h = ToLower(ext);
if(*h == '.')
h = h.Mid(1);
int q = sEXT().Find(h);
return q >= 0 ? sMIME()[q] : "application/octet-stream";
}

View file

@ -130,9 +130,19 @@ ring][@(0.0.255) `&]_[*@3 txt])&]
[s2; Restarts Smtp for sending of next email (resets all addresses,
bodies, attachments, subject).&]
[s3; &]
[s4;%- &]
[s5;:Smtp`:`:GetMessage`(`):%- [_^String^ String]_[* GetMessage]()&]
[s2; Returns the message in RFC`-822 format, without sending it.&]
[s3;%- &]
[s4;%- &]
[s5;:Smtp`:`:Send`(const String`&`):%- [@(0.0.255) bool]_[* Send]([@(0.0.255) const]_[_^String^ S
tring][@(0.0.255) `&]_[*@3 message])&]
[s2; Send the raw message in RFC`-822 format.&]
[s3; &]
[s4; &]
[s5;:Smtp`:`:Send`(`):%- [@(0.0.255) bool]_[* Send]()&]
[s2; Sends email. Returns true on success.&]
[s2; Sends email. Returns true on success. Same as Send(GetMessage()),
except that this form is able to send attachments in chunks.&]
[s3; &]
[s4; &]
[s5;:Smtp`:`:GetError`(`)const:%- [_^String^ String]_[* GetError]()_[@(0.0.255) const]&]

View file

@ -116,10 +116,12 @@ public:
// << ", " << typeid(T).name()); //TODO remove
Free();
return; // Constraints:
#ifndef CPP_11
T t(pick(*vector)); // T must have transfer constructor (also GCC 4.0 bug workaround)
#endif
#ifdef CPP_11
AssertMoveable((T *)0); // T must be moveable
#else
T t(pick(*vector)); // T must have transfer constructor (also GCC 4.0 bug workaround)
AssertMoveable(&t); // T must be moveable
#endif
}
// Pick assignment & copy. Picked source can only do Clear(), ~Vector(), operator=, operator <<=

View file

@ -95,12 +95,14 @@ pes]()&]
[s4; &]
[s5;:FileExtToMIME`(const String`&`): [_^String^ String]_[* FileExtToMIME]([@(0.0.255) cons
t]_[_^String^ String][@(0.0.255) `&]_[*@3 ext])&]
[s2;%% Converts the file extension to MIME type.&]
[s2;%% Converts the file extension to MIME type. [%-*@3 ext] can, but
does not need to start with `'.`' (it is removed before searching).&]
[s3;%% &]
[s4; &]
[s5;:MIMEToFileExt`(const String`&`): [_^String^ String]_[* MIMEToFileExt]([@(0.0.255) cons
t]_[_^String^ String][@(0.0.255) `&]_[*@3 mime])&]
[s2;%% Converts the MIME type to the most likely file extension.&]
[s2;%% Converts the MIME type to the most likely file extension (without
`'.`' at begin).&]
[s3;%% &]
[s4; &]
[s5;:HttpResponse`(TcpSocket`&`,bool`,int`,const char`*`,const char`*`,const String`&`,const char`*`,bool`): [@(0.0.255) b