summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)Author
2020-01-02Optimization: Get the Message-Id from the header, if it is thereMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-02Use MessageId type where applicableMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-02Impl Display for MessageIdMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-02Add more impls on MessageId typeMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-02Fix: Set isflag when creating a mail in the storeMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-02Fix: Do not assume a mail file to be valid UTF8Matthias Beyer
We did assume that the file contained valid UTF8 when reading to `String`. Now we read to a byte buffer, which removes the (wrong) assumtion. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-02Store::retrieve_mail_from_path() should have a flag to force making a ref ↵Matthias Beyer
out of the entry Because if the entry already exists, we might override the ref anyways. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2020-01-01Update copyright years to 2015-2020Matthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-25Fix: Remove Box::leak() call in runtime application abstractionMatthias Beyer
This patch removes the leakage in the runtime application abstraction. Also fix formatting. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove unused lifetimeMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove unnecessary clone().to_string() callsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove unnecessary return keywordMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove unnecessary clone() callMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove main() in doctestMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove unnecessary clone() callMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Remove DebugResult and DebugOption helpersMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Replace map_dbg() and map_dbg_str() with context() and inspect() callsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-23Replace map_dbg_err() calls with context() callsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-22Fix: Ignore broken pipe when reporting idsMatthias Beyer
This fixes a bug where a broken pipe in Runtime::report_touched() resulted in an Err(_) raised up to main() which then reported this. But as report_touched() should ignore a broken pipe (because the program will exit anyways shortly after the call), we can safely ignore this error. This also results in `ExitCode` removed from the function signature, which pushes us forward to the removal of custom error-handling implementations! Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-22Remove let binding for unit valueMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-21Remove unit-let-bindingMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-21Impl FromStr instead of own functionMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-21Remove unit-let-bindingMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-08Add functions to get by id and remove with FileLockEntryMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-08Add "is"-flag setting when creating bookmarkMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-12-08Remove old implementation, define interface for new implementationMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-11-11Fix: a tag can contain ascii digitsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-11-11Make tag-checking error message more explicit about what is wrongMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-11-09Add builder for todo entriesMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-11-09Reimplement libimagtodoMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-11-09Remove old implementationMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-11-09Add Runtime::input_is_pipe()Matthias Beyer
We need this because we might want to check whether we can get the STDIN handle from the runtime or not. In some (rare) cases, the runtime "thinks" that STDIN is a stream of IDs, but it is not. So the client can check whether stdin is a pipe (thus, whether Runtime thinks that there's a stream of IDs) and easily work around that by taking ::std::io::stdin() itself. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-27Add extension trait for iterator over Result<Entry>Matthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-27Add iterator extensions for store-id touched reportingMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Revert "Add extension traits for handling Result<Option<T>, E> conversion"Matthias Beyer
This reverts commit d810b63886f4006d01bca894982bbc867616f37c. As resiter v0.4.0 does provide this extension now, we don't need it in the codebase anymore.
2019-10-26Add extension traits for handling Result<Option<T>, E> conversionMatthias Beyer
This extension traits help transforming Result<Option<T>, E> to Result<T, E> or transforming an iterator over the former type to an iterator over the latter type. Should be moved to resiter of course, but we need to implement this first. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Implement Error for ExitCodeMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Add Entry::set_content()Matthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Pass the path to the ui builder function when creating a mock applicationMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Add ImagApplication trait for CLI completion + single-binary supportLeon Schuermann
To re-add the imag-binary CLI completion, as well as to enable building a single imag containing all of the subcommands, this commit introduces an ImagApplication trait to be implemented by all imag binary crates. The binary crates will be converted to libraries, with an additional binary target. This enables standalone and single binary builds. On its own, this commit doesn't do much, but rather it paves the way to dynamically interacting with the imag uis/clis using a library-crate interface. Signed-off-by: Leon Schuermann <leon@is.currently.online>
2019-10-26Add some debug outputMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Fix test: Check whether in cache, then get, then check againMatthias Beyer
After moving an entry, the entry should _not_ be in the cache. This is just a decision that has to be made, whether we cache the moved entry or not. I decided to not cache because it is results in less code. After that check, we get the entry from the backend and then we can check whether the entry is in the cache, which is then should be. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Add test: Test moving entry with writing to it before and after movingMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Fix: Testing backend bug where an entry was not properly rewrittenMatthias Beyer
When moving an entry, what we did is copying the entry inside the backend abstraction (the hashmap) from one key to another. But as the entry itself does also encode its location, we actually have to rewrite the entire entry. This patch fixes this. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-26Fix: Renaming entries should also remove the old entryMatthias Beyer
This is a bugfix for a bug in Store::move_entry_by_id(): The old entry was not removed after the new one was created. The bug is a bit subtle. The issue was, that the internal cache held open a reference to the old entry (as StoreEntry object) and when that object got drop()ed, the contents of the entry were written to disk, which resulted in the old entry being recreated. This patch rewrites the function to behave well. The most critical part is that we do not check whether the old entry is borrowed with `hsmap.get()` but rather `hsmap.remove()`. The trick here is that the `StoreEntry` object is dropped in the moment the check is done, clearing the cached object and flushing it to the backend (the disk). After that, we continue doing the filesystem operation and the cache is clean. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-13Fix: --override-config argument can be passed multiple timesMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-11Merge branch 'libimagcalendar/init' into masterMatthias Beyer
2019-10-09Add function to get all eventsMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-09Add getter helperMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2019-10-09Implement calendar libraryMatthias Beyer
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>