Compare commits
3 Commits
7c7a8c0dcb
...
1544405d3a
| Author | SHA1 | Date | |
|---|---|---|---|
| 1544405d3a | |||
| 3b547f6925 | |||
| 777f33e212 |
13
Cargo.lock
generated
13
Cargo.lock
generated
@ -672,7 +672,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "cacher"
|
||||
version = "0.1.0"
|
||||
source = "git+http://git-private.h.xinu.tv/wathiede/cacher.git#9f30f07ca5b5b47e07b22382efbe999e05678c3e"
|
||||
source = "git+http://git-private.h.xinu.tv/wathiede/cacher.git#70fa36e8cb1b1f800df9dcf17dadf21aceeba73b"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bitcode",
|
||||
@ -2839,7 +2839,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "letterbox"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"build-info-build",
|
||||
@ -2865,7 +2865,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-server"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
dependencies = [
|
||||
"ammonia",
|
||||
"anyhow",
|
||||
@ -3384,7 +3384,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notmuch"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
dependencies = [
|
||||
"itertools 0.10.5",
|
||||
"log",
|
||||
@ -3393,6 +3393,7 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 1.0.69",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4178,7 +4179,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "procmail2notmuch"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
@ -5248,7 +5249,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "shared"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"notmuch",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "notmuch"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
@ -10,6 +10,7 @@ log = "0.4.14"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = { version = "1.0", features = ["unbounded_depth"] }
|
||||
thiserror = "1.0.30"
|
||||
tracing = "0.1.41"
|
||||
|
||||
[dev-dependencies]
|
||||
itertools = "0.10.1"
|
||||
|
||||
@ -215,6 +215,7 @@ use std::{
|
||||
|
||||
use log::{error, info};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::instrument;
|
||||
|
||||
/// # Number of seconds since the Epoch
|
||||
pub type UnixTime = isize;
|
||||
@ -474,6 +475,7 @@ impl Notmuch {
|
||||
}
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
pub fn new(&self) -> Result<Vec<u8>, NotmuchError> {
|
||||
self.run_notmuch(["new"])
|
||||
}
|
||||
@ -482,6 +484,7 @@ impl Notmuch {
|
||||
self.run_notmuch(std::iter::empty::<&str>())
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(query=query))]
|
||||
pub fn tags_for_query(&self, query: &str) -> Result<Vec<String>, NotmuchError> {
|
||||
let res = self.run_notmuch(["search", "--format=json", "--output=tags", query])?;
|
||||
Ok(serde_json::from_slice(&res)?)
|
||||
@ -491,16 +494,19 @@ impl Notmuch {
|
||||
self.tags_for_query("*")
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(tag=tag,search_term=search_term))]
|
||||
pub fn tag_add(&self, tag: &str, search_term: &str) -> Result<(), NotmuchError> {
|
||||
self.run_notmuch(["tag", &format!("+{tag}"), search_term])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(tag=tag,search_term=search_term))]
|
||||
pub fn tag_remove(&self, tag: &str, search_term: &str) -> Result<(), NotmuchError> {
|
||||
self.run_notmuch(["tag", &format!("-{tag}"), search_term])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(query=query,offset=offset,limit=limit))]
|
||||
pub fn search(
|
||||
&self,
|
||||
query: &str,
|
||||
@ -524,6 +530,7 @@ impl Notmuch {
|
||||
}))
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(query=query))]
|
||||
pub fn count(&self, query: &str) -> Result<usize, NotmuchError> {
|
||||
// NOTE: --output=threads is technically more correct, but really slow
|
||||
// TODO: find a fast thread count path
|
||||
@ -536,6 +543,7 @@ impl Notmuch {
|
||||
.unwrap_or(0))
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(query=query))]
|
||||
pub fn show(&self, query: &str) -> Result<ThreadSet, NotmuchError> {
|
||||
let slice = self.run_notmuch([
|
||||
"show",
|
||||
@ -554,6 +562,7 @@ impl Notmuch {
|
||||
Ok(val)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(query=query,part=part))]
|
||||
pub fn show_part(&self, query: &str, part: usize) -> Result<Part, NotmuchError> {
|
||||
let slice = self.run_notmuch([
|
||||
"show",
|
||||
@ -573,20 +582,24 @@ impl Notmuch {
|
||||
Ok(val)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(id=id))]
|
||||
pub fn show_original(&self, id: &MessageId) -> Result<Vec<u8>, NotmuchError> {
|
||||
self.show_original_part(id, 0)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(id=id,part=part))]
|
||||
pub fn show_original_part(&self, id: &MessageId, part: usize) -> Result<Vec<u8>, NotmuchError> {
|
||||
let res = self.run_notmuch(["show", "--part", &part.to_string(), id])?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(query=query))]
|
||||
pub fn message_ids(&self, query: &str) -> Result<Vec<String>, NotmuchError> {
|
||||
let res = self.run_notmuch(["search", "--output=messages", "--format=json", query])?;
|
||||
Ok(serde_json::from_slice(&res)?)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(query=query))]
|
||||
pub fn files(&self, query: &str) -> Result<Vec<String>, NotmuchError> {
|
||||
let res = self.run_notmuch(["search", "--output=files", "--format=json", query])?;
|
||||
Ok(serde_json::from_slice(&res)?)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "procmail2notmuch"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "letterbox-server"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
edition = "2021"
|
||||
default-run = "letterbox-server"
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "shared"
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
version = "0.0.91"
|
||||
version = "0.0.92"
|
||||
name = "letterbox"
|
||||
repository = "https://github.com/seed-rs/seed-quickstart"
|
||||
authors = ["Bill Thiede <git@xinu.tv>"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user