Mime.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
// @file Mime.qm Mime module definition
/* Mime.qm Copyright (C) 2012 - 2018 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
// minimum required Qore version
// assume local var scope, do not use "$" for vars, members, and method calls
namespace Mime {
public struct MessageInfo {
hash hdr;
data body;
list<hash<MessageInfo>> part();
};
public struct MessagePartInfo {
data data;
hash hdr;
};
public struct FormDataMessageInfo {
string name;
*string filename;
hash hdr;
data body;
};
const MimeTypeUnknown = MimeTypeOctetStream;
const MimeTypeOctetStream = "application/octet-stream";
const MimeTypeText = "text/plain";
const MimeTypeHtml = "text/html";
const MimeTypeCsv = "text/csv";
const MimeTypeJpeg = "image/jpeg";
const MimeTypePng = "image/png";
const MimeTypeSoapXml = "application/soap+xml";
const MimeTypeYaml = "text/x-yaml";
const MimeTypeXml = "text/xml";
const MimeTypeXmlApp = "application/xml";
const MimeTypeJson = "application/json";
const MimeTypeJsonRpc = MimeTypeJson;
const MimeTypeXmlRpc = MimeTypeXml;
const MimeTypeYamlRpc = "application/x-yaml";
const MimeTypeJavascript = "application/javascript";
const MimeTypeCss = "text/css";
const MimeTypeFormUrlEncoded = "application/x-www-form-urlencoded";
const MimeTypeMultipartFormData = "multipart/form-data";
const MimeTypeMultipartRelated = "multipart/related";
const MimeTypeMultipartMixed = "multipart/mixed";
const MimeTypes = (
"7z": "application/x-7z-compressed",
"ai": "application/postscript",
"aif": "audio/x-aiff",
"aifc": "audio/x-aiff",
"aiff": "audio/x-aiff",
"asc": MimeTypeText,
"atom": "application/atom+xml",
"au": "audio/basic",
"avi": "video/x-msvideo",
"bcpio": "application/x-bcpio",
"bin": MimeTypeUnknown,
"bmp": "image/bmp",
"bz2": "application/x-bzip",
"cc": MimeTypeText,
"cdf": "application/x-netcdf",
"cgm": "image/cgm",
"class": MimeTypeUnknown,
"cpio": "application/x-cpio",
"cpp": MimeTypeText,
"cpt": "application/mac-compactpro",
"csh": "application/x-csh",
"css": MimeTypeCss,
"csv": MimeTypeCsv,
"dcr": "application/x-director",
"dif": "video/x-dv",
"dir": "application/x-director",
"djv": "image/vnd.djvu",
"djvu": "image/vnd.djvu",
"dll": MimeTypeUnknown,
"dmg": MimeTypeUnknown,
"dms": MimeTypeUnknown,
"doc": "application/msword",
"dtd": "application/xml-dtd",
"dv": "video/x-dv",
"dvi": "application/x-dvi",
"dxr": "application/x-director",
"eps": "application/postscript",
"etx": "text/x-setext",
"exe": MimeTypeUnknown,
"ez": "application/andrew-inset",
"gif": "image/gif",
"gram": "application/srgs",
"grxml": "application/srgs+xml",
"gtar": "application/x-gtar",
"gz": "application/x-gzip",
"h": MimeTypeText,
"hdf": "application/x-hdf",
"hh": MimeTypeText,
"hpp": MimeTypeText,
"hqx": "application/mac-binhex40",
"htm": MimeTypeHtml,
"html": MimeTypeHtml,
"ice": "x-conference/x-cooltalk",
"ico": "image/x-icon",
"ics": "text/calendar",
"ief": "image/ief",
"ifb": "text/calendar",
"iges": "model/iges",
"igs": "model/iges",
"jar": "application/java-archive",
"java": MimeTypeText,
"jnlp": "application/x-java-jnlp-file",
"jp2": "image/jp2",
"jpe": MimeTypeJpeg,
"jpeg": MimeTypeJpeg,
"jpg": MimeTypeJpeg,
"js": MimeTypeJavascript,
"json": MimeTypeJson,
"kar": "audio/midi",
"latex": "application/x-latex",
"lha": MimeTypeUnknown,
"lzh": MimeTypeUnknown,
"m3u": "audio/x-mpegurl",
"m4a": "audio/mp4a-latm",
"m4b": "audio/mp4a-latm",
"m4p": "audio/mp4a-latm",
"m4u": "video/vnd.mpegurl",
"m4v": "video/x-m4v",
"mac": "image/x-macpaint",
"man": "application/x-troff-man",
"mathml": "application/mathml+xml",
"me": "application/x-troff-me",
"mesh": "model/mesh",
"mid": "audio/midi",
"midi": "audio/midi",
"mif": "application/vnd.mif",
"mov": "video/quicktime",
"movie": "video/x-sgi-movie",
"mp2": "audio/mpeg",
"mp3": "audio/mpeg",
"mp4": "video/mp4",
"mpe": "video/mpeg",
"mpeg": "video/mpeg",
"mpg": "video/mpeg",
"mpga": "audio/mpeg",
"ms": "application/x-troff-ms",
"msh": "model/mesh",
"mxu": "video/vnd.mpegurl",
"nc": "application/x-netcdf",
"oda": "application/oda",
"ogg": "application/ogg",
"pbm": "image/x-portable-bitmap",
"pct": "image/pict",
"pdb": "chemical/x-pdb",
"pdf": "application/pdf",
"pgm": "image/x-portable-graymap",
"pgn": "application/x-chess-pgn",
"pic": "image/pict",
"pict": "image/pict",
"png": MimeTypePng,
"pnm": "image/x-portable-anymap",
"pnt": "image/x-macpaint",
"pntg": "image/x-macpaint",
"ppm": "image/x-portable-pixmap",
"ppt": "application/vnd.ms-powerpoint",
"ps": "application/postscript",
// Qore script
"q": MimeTypeText,
// Qore class include file
"qc": MimeTypeText,
// Qorus function definition file
"qfd": MimeTypeText,
// Qorus class definition file
"qclass": MimeTypeText,
// Qorus constant definition file
"qconst": MimeTypeText,
// Qorus job definition
"qjob": MimeTypeText,
// Qore include file
"ql": MimeTypeText,
// Qore user module source
"qm": MimeTypeText,
// Qorus service definition
"qsd": MimeTypeText,
// Qorus workflow definition
"qwf": MimeTypeText,
"qt": "video/quicktime",
"qti": "image/x-quicktime",
"qtif": "image/x-quicktime",
"ra": "audio/x-pn-realaudio",
"ram": "audio/x-pn-realaudio",
"ras": "image/x-cmu-raster",
"rdf": "application/rdf+xml",
"rgb": "image/x-rgb",
"rm": "application/vnd.rn-realmedia",
"roff": "application/x-troff",
"rtf": "text/rtf",
"rtx": "text/richtext",
"sgm": "text/sgml",
"sgml": "text/sgml",
"sh": "application/x-sh",
"shar": "application/x-shar",
"silo": "model/mesh",
"sit": "application/x-stuffit",
"skd": "application/x-koan",
"skm": "application/x-koan",
"skp": "application/x-koan",
"skt": "application/x-koan",
"smi": "application/smil",
"smil": "application/smil",
"snd": "audio/basic",
"so": MimeTypeUnknown,
"spl": "application/x-futuresplash",
"src": "application/x-wais-source",
"sv4cpio": "application/x-sv4cpio",
"sv4crc": "application/x-sv4crc",
"svg": "image/svg+xml",
"swf": "application/x-shockwave-flash",
"t": "application/x-troff",
"tar": "application/x-tar",
"tar.bz2": "application/x-bzip-compressed-tar",
"tar.gz": "application/x-tar-gz",
"tbz": "application/x-bzip-compressed-tar",
"tcl": "application/x-tcl",
"tex": "application/x-tex",
"texi": "application/x-texinfo",
"texinfo": "application/x-texinfo",
"text": MimeTypeText,
"tgz": "application/x-tar-gz",
"tif": "image/tiff",
"tiff": "image/tiff",
"tr": "application/x-troff",
"tsv": "text/tab-separated-values",
"txt": MimeTypeText,
"ustar": "application/x-ustar",
"vcd": "application/x-cdlink",
"vrml": "model/vrml",
"vxml": "application/voicexml+xml",
"wav": "audio/x-wav",
"wbmp": "image/vnd.wap.wbmp",
"wbmxl": "application/vnd.wap.wbxml",
"wml": "text/vnd.wap.wml",
"wmlc": "application/vnd.wap.wmlc",
"wmls": "text/vnd.wap.wmlscript",
"wmlsc": "application/vnd.wap.wmlscriptc",
"wrl": "model/vrml",
"wsdl": "application/wsdl+xml",
"xbm": "image/x-xbitmap",
"xht": "application/xhtml+xml",
"xhtml": "application/xhtml+xml",
"xls": "application/vnd.ms-excel",
"xml": MimeTypeXml,
"xpm": "image/x-xpixmap",
"xsd": MimeTypeXml,
"xsl": "application/xml",
"xslt": "application/xslt+xml",
"xul": "application/vnd.mozilla.xul+xml",
"xwd": "image/x-xwindowdump",
"xyz": "chemical/x-xyz",
"yaml": MimeTypeYaml,
"zip": "application/zip",
);
const UrlEncodedChars = (
"\$": True,
"-": True,
"_": True,
".": True,
"!": True,
"*": True,
"'": True,
"(": True,
")": True,
",": True
);
const ContentTransEnc7Bit = "7bit";
const ContentTransEnc8Bit = "8bit";
const ContentTransEncBinary = "binary";
const ContentTransEncBase64 = "base64";
const ContentTransEncQuotedPrintable = "quoted-printable";
const MimeBase64LineLen = 76;
const MimeQuotedPrintableLineLen = 76;
string mime_encode_base64(data str, int len = MimeBase64LineLen);
string mime_encode_quoted_printable(string str, bool hdr = False);
data mime_encode_transfer_data(data mime_data, string enc);
string mime_encode_header_word_b(string str);
string mime_encode_header_word_q(string str);
binary mime_decode_base64(data str);
string mime_decode_base64_to_string(data str, *string encoding);
string mime_decode_quoted_printable(string str, *string encoding);
data mime_decode_transfer_data(data mime_data, string enc, *string ct);
string mime_decode_header(string hdr);
string get_mime_type_from_ext(string path);
string mime_get_urlencoded_string(auto val);
string mime_get_form_urlencoded_string(hash h);
string mime_decode_urlencoded_string(string str);
hash<auto> mime_parse_form_urlencoded_string(string str);
const MPT_FORM_DATA = "form-data";
const MPT_MIXED = "mixed";
const MPT_MESSAGE = "message";
const MPT_DIGEST = "digest";
const MPT_ALTERNATIVE = "alternative";
const MPT_RELATED = "related";
const MPT_SIGNED = "signed";
const MPT_ENCRYPTED = "encrypted";
const MPT_BYTERANGES = "byteranges";
class MultiPartMessage {
public:
const MP_DEFAULT_MSG = "This is a MIME multipart message";
private :
string mptype;
string boundary;
string ct;
list<hash<MessagePartInfo>> l();
hash hdr;
public:
constructor(string mptype, string boundary = MultiPartMessage::getBoundary());
binary serialize();
binary serializeBody();
int size();
string getBoundary();
static binary serializeHeaders(hash hdr);
static string getBoundary();
static string getRandomString(int len);
static hash<MessageInfo> parseBody(string boundary, string body, bool decode = True);
abstract hash<MessageInfo> getMsgAndHeaders();
// don't reimplement this method; fix/enhance it in the module
private:
final hash<MessageInfo> getMsgAndHeadersIntern(*string content_type, bool conlen = True);
public:
// don't reimplement this method; fix/enhance it in the module
private:
splicePartIntern(data mime_data, hash hdr);
public:
// don't reimplement this method; fix/enhance it in the module
private:
addPartIntern(data mime_data, hash hdr);
public:
private:
static hash<MessagePartInfo> getPart(data mime_data, hash hdr);
public:
};
class MultiPartRelatedMessage : public MultiPartMessage {
public:
private :
// the starting part ID
string startid;
public:
constructor(string boundary = MultiPartMessage::getBoundary()) ;
splicePart(data mime_data, string id, string content_type, *hash hdr);
addPart(data mime_data, string id, string content_type, *hash hdr);
hash<MessageInfo> getMsgAndHeaders();
};
class MultiPartMixedMessage : public MultiPartMessage {
public:
constructor(string boundary = MultiPartMessage::getBoundary()) ;
splicePart(data mime_data, string content_type = MimeTypeText, string disp = "inline", *hash hdr);
addPart(data mime_data, string content_type = MimeTypeText, string disp = "inline", *hash hdr);
spliceEncodePart(data mime_data, string enc, string content_type = MimeTypeText, string disp = "inline", *hash hdr);
addEncodePart(data mime_data, string enc, string content_type = MimeTypeText, string disp = "inline", *hash hdr);
hash<MessageInfo> getMsgAndHeaders();
};
class MultiPartFormDataMessage : public MultiPartMessage {
public:
private :
hash parts;
public:
constructor(string boundary = MultiPartMessage::getBoundary()) ;
splicePart(data mime_data, string name, *hash hdr);
splicePart(data mime_data, string name, string filename, string content_type, *hash hdr);
splicePart(hash<FormDataMessageInfo> h);
addPart(data mime_data, string name, *hash hdr);
addPart(data mime_data, string name, string filename, string content_type, *hash hdr);
addPart(hash<FormDataMessageInfo> h);
hash<MessageInfo> getMsgAndHeaders();
static hash<string, hash<FormDataMessageInfo>> parseMessage(string content, string body);
static MultiPartFormDataMessage makeMessage(hash<string, hash<FormDataMessageInfo>> parts);
static binary makeMessageBody(hash<string, hash<FormDataMessageInfo>> parts);
private:
checkPartName(string name);
public:
private:
hash getPartHeader(string name, *string filename, *string content_type, *hash hdr);
public:
};
};
Mime::UrlEncodedChars
const UrlEncodedChars
hash of non-alphanumeric characters that can be used unencoded in URL encoded format ...
Definition: Mime.qm.dox.h:472
Mime::MultiPartMessage::getMsgAndHeaders
abstract hash< MessageInfo > getMsgAndHeaders()
returns a hash of the message
Mime::MPT_RELATED
const MPT_RELATED
for sending multiple components of an aggregated whole (http://tools.ietf.org/html/rfc2387) ...
Definition: Mime.qm.dox.h:691
Mime::MimeTypeJpeg
const MimeTypeJpeg
MIME type for jpeg images.
Definition: Mime.qm.dox.h:190
Mime::MultiPartRelatedMessage::constructor
constructor(string boundary=MultiPartMessage::getBoundary())
creates the object
Mime::MultiPartFormDataMessage::getPartHeader
hash getPartHeader(string name, *string filename, *string content_type, *hash hdr)
builds the header for the part
Mime::MultiPartMixedMessage::constructor
constructor(string boundary=MultiPartMessage::getBoundary())
creates the object
Mime::MultiPartFormDataMessage::constructor
constructor(string boundary=MultiPartMessage::getBoundary())
creates the object
Mime::MessagePartInfo::data
data data
part body data
Definition: Mime.qm.dox.h:153
Mime::MPT_MESSAGE
const MPT_MESSAGE
for email/MIME messages with headers (http://tools.ietf.org/html/rfc2046)
Definition: Mime.qm.dox.h:682
Mime::MultiPartFormDataMessage
implements the MultiPartFormDataMessage class, a specialization of MultiPartMessage ...
Definition: Mime.qm.dox.h:1016
Mime::MultiPartMessage::getBoundary
string getBoundary()
returns the message boundary string used
Mime::MultiPartMessage::constructor
constructor(string mptype, string boundary=MultiPartMessage::getBoundary())
creates the object
Mime::FormDataMessageInfo::body
data body
the data for the message or part
Definition: Mime.qm.dox.h:167
Mime::MultiPartMixedMessage::spliceEncodePart
spliceEncodePart(data mime_data, string enc, string content_type=MimeTypeText, string disp="inline", *hash hdr)
adds a message part to the start of the list; encodes the data according to the transfer encoding arg...
Mime::mime_encode_header_word_q
string mime_encode_header_word_q(string str)
returns a string in "Q" ("quoted-printable") encoding for MIME header string words according to RFC 2...
Mime::ContentTransEnc8Bit
const ContentTransEnc8Bit
implies lines < 1000 chars (= no encoding)
Definition: Mime.qm.dox.h:493
Mime::MultiPartMessage
MultiPartMessage class implementation.
Definition: Mime.qm.dox.h:704
Mime::MimeTypeYaml
const MimeTypeYaml
Mime type for yaml data files.
Definition: Mime.qm.dox.h:199
Mime::MultiPartMessage::parseBody
static hash< MessageInfo > parseBody(string boundary, string body, bool decode=True)
returns a hash representing a parsed multipart message body from a boundary string and body arguments...
Mime::MimeTypeXml
const MimeTypeXml
Mime type for plain (human-readable) xml files.
Definition: Mime.qm.dox.h:202
Mime::MPT_ENCRYPTED
const MPT_ENCRYPTED
for sending encrypted messages (http://tools.ietf.org/html/rfc1847#section-2.2)
Definition: Mime.qm.dox.h:697
Mime::MultiPartFormDataMessage::parts
hash parts
hash of part names to ensure uniqueness
Definition: Mime.qm.dox.h:1021
Mime::MultiPartRelatedMessage::splicePart
splicePart(data mime_data, string id, string content_type, *hash hdr)
adds a message part to the start of the list
Mime::FormDataMessageInfo
parsed form-data message part info
Definition: Mime.qm.dox.h:159
Mime::MultiPartFormDataMessage::checkPartName
checkPartName(string name)
check for unique part names and adds the part to the unique name hash
Mime::mime_encode_quoted_printable
string mime_encode_quoted_printable(string str, bool hdr=False)
returns a string in "quoted-printable" (or "QP") encoding according to RFC 2045 section 6...
Mime::MultiPartMessage::serializeHeaders
static binary serializeHeaders(hash hdr)
serializes a header hash to a binary object
True
const True
Mime::MultiPartFormDataMessage::getMsgAndHeaders
hash< MessageInfo > getMsgAndHeaders()
returns a hash of the message
Mime::mime_get_form_urlencoded_string
string mime_get_form_urlencoded_string(hash h)
returns a string in MIME multipart form URL encoded format (for use with "Content-Type: application/x...
Mime::FormDataMessageInfo::name
string name
the name of the part
Definition: Mime.qm.dox.h:161
Mime::MultiPartMixedMessage
implements the MultiPartMixedMessage class, a specialization of MultiPartMessage
Definition: Mime.qm.dox.h:927
Mime::MimeTypeMultipartFormData
const MimeTypeMultipartFormData
Mime type for multipart form data.
Definition: Mime.qm.dox.h:229
Mime::MPT_ALTERNATIVE
const MPT_ALTERNATIVE
for sending multiple "alternatives" of the same content (http://tools.ietf.org/html/rfc2046#section-5...
Definition: Mime.qm.dox.h:688
binary
binary binary()
Mime::MessagePartInfo::hdr
hash hdr
part header hash
Definition: Mime.qm.dox.h:155
Mime::mime_get_urlencoded_string
string mime_get_urlencoded_string(auto val)
returns a single string in MIME URL encoded format
Mime::MimeTypeJsonRpc
const MimeTypeJsonRpc
Mime type for JSON-RPC.
Definition: Mime.qm.dox.h:211
Mime::MPT_BYTERANGES
const MPT_BYTERANGES
for sending noncontiguous byte ranges of a single message (http://tools.ietf.org/html/rfc2616) ...
Definition: Mime.qm.dox.h:700
Mime::MultiPartFormDataMessage::addPart
addPart(data mime_data, string name, *hash hdr)
adds a message part to the end of the list
Mime::MimeTypeJson
const MimeTypeJson
Mime type for JSON.
Definition: Mime.qm.dox.h:208
Mime::MPT_SIGNED
const MPT_SIGNED
to attach a digital signature to a message (http://tools.ietf.org/html/rfc1847#section-2.1)
Definition: Mime.qm.dox.h:694
Mime::ContentTransEncBase64
const ContentTransEncBase64
base-64 Content-Transfer-Encoding
Definition: Mime.qm.dox.h:499
Mime::MultiPartMessage::serialize
binary serialize()
serializes the message with the Content-Type header first and returns a binary object ready to send o...
Mime::MimeTypePng
const MimeTypePng
MIME type for png images.
Definition: Mime.qm.dox.h:193
Mime::MimeQuotedPrintableLineLen
const MimeQuotedPrintableLineLen
maximum line length for quoted-printable encoding
Definition: Mime.qm.dox.h:512
False
const False
Mime::MultiPartFormDataMessage::parseMessage
static hash< string, hash< FormDataMessageInfo > > parseMessage(string content, string body)
parses a multipart/form-data encoded message and returns a hash of its ContentTransEnc7Bit ...
Mime::MimeTypeJavascript
const MimeTypeJavascript
Mime type for Javascript.
Definition: Mime.qm.dox.h:220
Mime::MimeTypeUnknown
const MimeTypeUnknown
MIME type for unknown file types.
Definition: Mime.qm.dox.h:175
Mime::MessageInfo::hdr
hash hdr
message or part headers
Definition: Mime.qm.dox.h:143
Mime::mime_decode_base64_to_string
string mime_decode_base64_to_string(data str, *string encoding)
returns a string value from a string in "BASE64" encoding according to RFC 2045
Mime::MultiPartRelatedMessage
implements the MultiPartRelatedMessage class, a specialization of MultiPartMessage ...
Definition: Mime.qm.dox.h:878
Mime::MimeTypeOctetStream
const MimeTypeOctetStream
MIME type for unknown file types.
Definition: Mime.qm.dox.h:178
Mime::MimeTypeCss
const MimeTypeCss
Mime type for css.
Definition: Mime.qm.dox.h:223
Mime::MimeTypeFormUrlEncoded
const MimeTypeFormUrlEncoded
Mime type for multipart form URL encoding.
Definition: Mime.qm.dox.h:226
Mime::mime_decode_header
string mime_decode_header(string hdr)
decodes a header string; if any part of the string is encoded with "B" ("BASE64") or "Q" ("quoted-pri...
Mime::MimeTypeMultipartMixed
const MimeTypeMultipartMixed
Mime type for multipart mixed.
Definition: Mime.qm.dox.h:235
Mime::mime_decode_base64
binary mime_decode_base64(data str)
returns a binary value from a string in "BASE64" encoding according to RFC 2045
Mime::MultiPartFormDataMessage::splicePart
splicePart(data mime_data, string name, *hash hdr)
adds a message part to the start of the list
Mime::MimeTypeYamlRpc
const MimeTypeYamlRpc
Mime type for YAML-RPC.
Definition: Mime.qm.dox.h:217
Mime::mime_decode_urlencoded_string
string mime_decode_urlencoded_string(string str)
decodes the given string from URL encoded format
Mime::MultiPartMixedMessage::getMsgAndHeaders
hash< MessageInfo > getMsgAndHeaders()
returns a hash of the message
Mime::MimeTypeXmlRpc
const MimeTypeXmlRpc
Mime type for XML-RPC.
Definition: Mime.qm.dox.h:214
Mime::MultiPartMixedMessage::addEncodePart
addEncodePart(data mime_data, string enc, string content_type=MimeTypeText, string disp="inline", *hash hdr)
adds a message part to the end of the list; encodes the data according to the transfer encoding argum...
Mime::MultiPartMixedMessage::splicePart
splicePart(data mime_data, string content_type=MimeTypeText, string disp="inline", *hash hdr)
adds a message part to the start of the list; the data muyst already be encoded and any Content-Trans...
Mime::get_mime_type_from_ext
string get_mime_type_from_ext(string path)
returns the mime type for the given filename from the extension or Mime::MimeTypeUnknown if the exten...
Mime::MessageInfo
message and part info hash
Definition: Mime.qm.dox.h:141
Mime::MultiPartRelatedMessage::addPart
addPart(data mime_data, string id, string content_type, *hash hdr)
adds a message part to the end of the list
Mime::MessageInfo::body
data body
the data for the message or part
Definition: Mime.qm.dox.h:145
Mime::MPT_MIXED
const MPT_MIXED
for sending files with different "Content-Type" headers (http://tools.ietf.org/html/rfc2046#section-5...
Definition: Mime.qm.dox.h:679
Mime::mime_encode_base64
string mime_encode_base64(data str, int len=MimeBase64LineLen)
returns a string in "BASE64" encoding according to RFC 2045
Mime::MultiPartMessage::serializeBody
binary serializeBody()
serializes the message body only and returns a binary object ready to send over a socket ...
Mime::MessagePartInfo
message part hash
Definition: Mime.qm.dox.h:151
Mime::MultiPartRelatedMessage::getMsgAndHeaders
hash< MessageInfo > getMsgAndHeaders()
returns a hash of the message
Mime::mime_encode_transfer_data
data mime_encode_transfer_data(data mime_data, string enc)
encodes data according to the given encoding
Mime::MPT_DIGEST
const MPT_DIGEST
for sending multiple text messages (http://tools.ietf.org/html/rfc2046#section-5.1.5)
Definition: Mime.qm.dox.h:685
Mime::MPT_FORM_DATA
const MPT_FORM_DATA
for form data (http://tools.ietf.org/html/rfc1867, http://tools.ietf.org/html/rfc2388) ...
Definition: Mime.qm.dox.h:676
Mime::ContentTransEncQuotedPrintable
const ContentTransEncQuotedPrintable
quoted-printable Content-Transfer-Encoding
Definition: Mime.qm.dox.h:502
Mime::MultiPartMessage::size
int size()
returns the number of parts in the message
Mime::FormDataMessageInfo::hdr
hash hdr
message or part headers
Definition: Mime.qm.dox.h:165
Mime::mime_encode_header_word_b
string mime_encode_header_word_b(string str)
returns a string in "B" ("BASE64") encoding for MIME header string words according to RFC 2047 ...
Mime::MultiPartFormDataMessage::makeMessage
static MultiPartFormDataMessage makeMessage(hash< string, hash< FormDataMessageInfo >> parts)
creates a multipart/form-data message from a hash of FormDataMessageInfo hashes keyed by part name ...
Mime::MultiPartMessage::getRandomString
static string getRandomString(int len)
returns a string of random characters
Mime
public Mime namespace defines constants and functions relevant to MIME
Definition: Mime.qm.dox.h:137
Mime::FormDataMessageInfo::filename
*string filename
the optional filename for the part
Definition: Mime.qm.dox.h:163
Mime::MimeBase64LineLen
const MimeBase64LineLen
maximum line length for base64 encoding
Definition: Mime.qm.dox.h:507
Mime::MimeTypeHtml
const MimeTypeHtml
MIME type for HTML.
Definition: Mime.qm.dox.h:184
Mime::MimeTypes
const MimeTypes
A map of default mime types per file extension; the hash keys are file extensions in lower-case witho...
Definition: Mime.qm.dox.h:240
Mime::mime_decode_transfer_data
data mime_decode_transfer_data(data mime_data, string enc, *string ct)
decodes data according to the given encoding
hash
hash hash(object obj)
Mime::MimeTypeSoapXml
const MimeTypeSoapXml
Mime type for SOAP XML messages (XML MIME type reference: http://tools.ietf.org/html/rfc3023) ...
Definition: Mime.qm.dox.h:196
Mime::ContentTransEncBinary
const ContentTransEncBinary
binary transfer encoding; implies no maximum line length (= no encoding)
Definition: Mime.qm.dox.h:496
Mime::MimeTypeMultipartRelated
const MimeTypeMultipartRelated
Mime type for multipart related.
Definition: Mime.qm.dox.h:232
Mime::MultiPartFormDataMessage::makeMessageBody
static binary makeMessageBody(hash< string, hash< FormDataMessageInfo >> parts)
creates a multipart/form-data message body from a hash of FormDataMessageInfo hashes keyed by part na...
Mime::MultiPartMixedMessage::addPart
addPart(data mime_data, string content_type=MimeTypeText, string disp="inline", *hash hdr)
adds a message part to the end of the list; the data muyst already be encoded and any Content-Transfe...
Mime::MimeTypeXmlApp
const MimeTypeXmlApp
Mime type for more complicated (not human-readable) xml files.
Definition: Mime.qm.dox.h:205
Mime::ContentTransEnc7Bit
const ContentTransEnc7Bit
default Content-Transfer-Encoding if none is present; implies lines < 1000 chars (= no encoding) ...
Definition: Mime.qm.dox.h:490
Mime::MimeTypeCsv
const MimeTypeCsv
MIME type for csv files (http://tools.ietf.org/html/rfc4180)
Definition: Mime.qm.dox.h:187
Mime::mime_parse_form_urlencoded_string
hash< auto > mime_parse_form_urlencoded_string(string str)
returns a hash corresponding to the string in MIME multipart form URL encoded format (for use with "C...
Mime::MimeTypeText
const MimeTypeText
MIME type for text.
Definition: Mime.qm.dox.h:181
Mime::MessageInfo::part
list< hash< MessageInfo > > part()
parts of the message or subparts of the part
Mime::mime_decode_quoted_printable
string mime_decode_quoted_printable(string str, *string encoding)
returns a string parsed from "quoted-printable" (or "QP") encoding according to RFC 2045 section 6...