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