Expand description
Some tools and enhancements to the used libraries, there should be no references to Context and other “larger” entities here.
Structs§
- MailTo
- Struct containing all mailto information
- System
Time - A measurement of the system clock, useful for talking to external entities like the file system or other processes.
- Temp
Path 🔒Guard - A guard which will remove the path when dropped.
- Time
- A measurement of the system clock, useful for talking to external entities like the file system or other processes.
Constants§
- BROTLI_
BUFSZ 🔒 - Compressor/decompressor buffer size.
Traits§
Functions§
- buf_
compress 🔒 - Compresses
buf
toVec
usingbrotli
. Note that it handles an emptybuf
as a special value that remains empty after compression, otherwise brotli would add its metadata to it which is not nice because this function is used for compression of strings stored in the db and empty strings are common there. This approach is not strictly correct because nowhere in the brotli documentation is said that an empty buffer can’t be a result of compression of some input, but i think this will never break. - buf_
decompress 🔒 - Decompresses
buf
toVec
usingbrotli
. Seebuf_compress()
for why we don’t pass an empty buffer to brotli decompressor. - create_
folder 🔒 - create_
id 🔒 - Generate an unique ID.
- create_
outgoing_ 🔒rfc724_ mid - Function generates a Message-ID that can be used for a new outgoing message.
- create_
smeared_ 🔒timestamp - Returns a timestamp that is guaranteed to be unique.
- create_
smeared_ 🔒timestamps - delete_
file 🔒 - duration_
to_ str - Converts duration to string representation suitable for logs.
- extract_
address_ 🔒from_ receive_ header - get_
abs_ 🔒path - Expand paths relative to $BLOBDIR into absolute paths.
- get_
filebytes 🔒 - get_
filemeta - Returns the
(width, height)
of the given image buffer. - get_
filesuffix_ lc - get_
release_ timestamp - Returns the last release timestamp as a unix timestamp compatible for comparison with time() and database times.
- gm2local_
offset 🔒 - inc_
and_ 🔒check - Increments
*t
and checks that it equals toexpected
after that. - maybe_
add_ 🔒time_ based_ warnings - maybe_
warn_ 🔒on_ bad_ time - maybe_
warn_ 🔒on_ outdated - open_
file - open_
file_ std - parse_
mailto - Parse mailto urls
- parse_
receive_ 🔒header - parse_
receive_ 🔒headers - parses “receive”-headers
- read_
dir - Reads directory and returns a vector of directory entries.
- read_
file - Reads the file and returns its context as a byte vector.
- remove_
subject_ prefix - sanitize_
filename 🔒 - Create a safe name based on a messy input string.
- single_
value 🔒 - If
collection
contains exactly one element, return this element. Otherwise, return None. - smeared_
time 🔒 - Returns the current smeared timestamp,
- time 🔒
- time_
elapsed 🔒 - timestamp_
to_ str - Converts Unix time in seconds to a local timestamp string.
- truncate 🔒
- Shortens a string to a specified length and adds “[…]” to the end of the shortened string.
- truncate_
by_ 🔒lines - Shortens a string to a specified line count and adds “[…]” to the end of the shortened string.
- truncate_
msg_ 🔒text - Shortens a message text if necessary according to the configuration. Adds “[…]” to the end of the shortened text.
- validate_
id 🔒 - Returns true if given string is a valid ID.
- write_
file 🔒 - Write a the given content to provided file path.