Compare commits
2 Commits
52e24437bd
...
bc4b15a5aa
| Author | SHA1 | Date | |
|---|---|---|---|
| bc4b15a5aa | |||
| 00f61cf6be |
10
Cargo.lock
generated
10
Cargo.lock
generated
@ -2965,7 +2965,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-notmuch"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"log",
|
||||
@ -2980,14 +2980,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-procmail2notmuch"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-server"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
dependencies = [
|
||||
"ammonia",
|
||||
"anyhow",
|
||||
@ -3030,7 +3030,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-shared"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"letterbox-notmuch",
|
||||
@ -3039,7 +3039,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "letterbox-web"
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
dependencies = [
|
||||
"build-info",
|
||||
"build-info-build",
|
||||
|
||||
@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
|
||||
edition = "2021"
|
||||
license = "UNLICENSED"
|
||||
publish = ["xinu"]
|
||||
version = "0.8.4"
|
||||
version = "0.8.5"
|
||||
repository = "https://git.z.xinu.tv/wathiede/letterbox"
|
||||
|
||||
[profile.dev]
|
||||
|
||||
@ -628,33 +628,44 @@ impl Notmuch {
|
||||
let ts: ThreadSet = serde::de::Deserialize::deserialize(&mut deserializer)?;
|
||||
deserializer.end()?;
|
||||
let mut r = HashMap::new();
|
||||
fn collect_from_thread_node(
|
||||
r: &mut HashMap<String, usize>,
|
||||
tn: &ThreadNode,
|
||||
) -> Result<(), NotmuchError> {
|
||||
let Some(msg) = &tn.0 else {
|
||||
return Ok(());
|
||||
};
|
||||
let mut addrs = vec![];
|
||||
let hdr = &msg.headers.to;
|
||||
if let Some(to) = hdr {
|
||||
addrs.push(to);
|
||||
};
|
||||
let hdr = &msg.headers.cc;
|
||||
if let Some(cc) = hdr {
|
||||
addrs.push(cc);
|
||||
};
|
||||
for recipient in addrs {
|
||||
mailparse::addrparse(&recipient)?
|
||||
.into_inner()
|
||||
.iter()
|
||||
.for_each(|a| {
|
||||
let mailparse::MailAddr::Single(si) = a else {
|
||||
return;
|
||||
};
|
||||
let addr = &si.addr;
|
||||
|
||||
if addr == "couchmoney@gmail.com" || addr.ends_with("@xinu.tv") {
|
||||
*r.entry(addr.to_lowercase()).or_default() += 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
for t in ts.0 {
|
||||
for tn in t.0 {
|
||||
let Some(msg) = tn.0 else {
|
||||
continue;
|
||||
};
|
||||
let mut addrs = vec![];
|
||||
let hdr = msg.headers.to;
|
||||
if let Some(to) = hdr {
|
||||
addrs.push(to);
|
||||
};
|
||||
let hdr = msg.headers.cc;
|
||||
if let Some(cc) = hdr {
|
||||
addrs.push(cc);
|
||||
};
|
||||
for recipient in addrs {
|
||||
mailparse::addrparse(&recipient)?
|
||||
.into_inner()
|
||||
.iter()
|
||||
.for_each(|a| {
|
||||
let mailparse::MailAddr::Single(si) = a else {
|
||||
return;
|
||||
};
|
||||
let addr = &si.addr;
|
||||
if addr == "couchmoney@gmail.com" || addr.ends_with("@xinu.tv") {
|
||||
*r.entry(addr.to_lowercase()).or_default() += 1;
|
||||
}
|
||||
});
|
||||
collect_from_thread_node(&mut r, &tn)?;
|
||||
for sub_tn in tn.1 {
|
||||
collect_from_thread_node(&mut r, &sub_tn)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,8 +48,8 @@ urlencoding = "2.1.3"
|
||||
#xtracing = { path = "../../xtracing" }
|
||||
#xtracing = { git = "http://git-private.h.xinu.tv/wathiede/xtracing.git" }
|
||||
xtracing = { version = "0.3.0", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.8.4", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.8.4", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.8.5", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.8.5", path = "../shared", registry = "xinu" }
|
||||
|
||||
[build-dependencies]
|
||||
build-info-build = "0.0.39"
|
||||
|
||||
@ -286,7 +286,7 @@ impl QueryRoot {
|
||||
Ok(letterbox_shared::build_version(bi))
|
||||
}
|
||||
#[instrument(skip_all, fields(query=query))]
|
||||
#[instrument(skip_all, fields(query=query, request_id=request_id()))]
|
||||
#[instrument(skip_all, fields(query=query, rid=request_id()))]
|
||||
async fn count<'ctx>(&self, ctx: &Context<'ctx>, query: String) -> Result<usize, Error> {
|
||||
let nm = ctx.data_unchecked::<Notmuch>();
|
||||
let pool = ctx.data_unchecked::<PgPool>();
|
||||
@ -309,7 +309,7 @@ impl QueryRoot {
|
||||
|
||||
// TODO: this function doesn't get parallelism, possibly because notmuch is sync and blocks,
|
||||
// rewrite that with tokio::process:Command
|
||||
#[instrument(skip_all, fields(query=query, request_id=request_id()))]
|
||||
#[instrument(skip_all, fields(query=query, rid=request_id()))]
|
||||
async fn search<'ctx>(
|
||||
&self,
|
||||
ctx: &Context<'ctx>,
|
||||
@ -467,7 +467,7 @@ impl QueryRoot {
|
||||
.await?)
|
||||
}
|
||||
|
||||
#[instrument(skip_all, fields(request_id=request_id()))]
|
||||
#[instrument(skip_all, fields(rid=request_id()))]
|
||||
async fn tags<'ctx>(&self, ctx: &Context<'ctx>) -> FieldResult<Vec<Tag>> {
|
||||
let nm = ctx.data_unchecked::<Notmuch>();
|
||||
let pool = ctx.data_unchecked::<PgPool>();
|
||||
@ -476,7 +476,7 @@ impl QueryRoot {
|
||||
tags.append(&mut nm::tags(nm, needs_unread)?);
|
||||
Ok(tags)
|
||||
}
|
||||
#[instrument(skip_all, fields(thread_id=thread_id, request_id=request_id()))]
|
||||
#[instrument(skip_all, fields(thread_id=thread_id, rid=request_id()))]
|
||||
async fn thread<'ctx>(&self, ctx: &Context<'ctx>, thread_id: String) -> Result<Thread, Error> {
|
||||
let nm = ctx.data_unchecked::<Notmuch>();
|
||||
let cacher = ctx.data_unchecked::<FilesystemCacher>();
|
||||
@ -553,7 +553,7 @@ async fn tantivy_search(
|
||||
pub struct Mutation;
|
||||
#[Object]
|
||||
impl Mutation {
|
||||
#[instrument(skip_all, fields(query=query, unread=unread, request_id=request_id()))]
|
||||
#[instrument(skip_all, fields(query=query, unread=unread, rid=request_id()))]
|
||||
async fn set_read_status<'ctx>(
|
||||
&self,
|
||||
ctx: &Context<'ctx>,
|
||||
@ -572,7 +572,7 @@ impl Mutation {
|
||||
nm::set_read_status(nm, &query, unread).await?;
|
||||
Ok(true)
|
||||
}
|
||||
#[instrument(skip_all, fields(query=query, tag=tag, request_id=request_id()))]
|
||||
#[instrument(skip_all, fields(query=query, tag=tag, rid=request_id()))]
|
||||
async fn tag_add<'ctx>(
|
||||
&self,
|
||||
ctx: &Context<'ctx>,
|
||||
@ -584,7 +584,7 @@ impl Mutation {
|
||||
nm.tag_add(&tag, &query)?;
|
||||
Ok(true)
|
||||
}
|
||||
#[instrument(skip_all, fields(query=query, tag=tag, request_id=request_id()))]
|
||||
#[instrument(skip_all, fields(query=query, tag=tag, rid=request_id()))]
|
||||
async fn tag_remove<'ctx>(
|
||||
&self,
|
||||
ctx: &Context<'ctx>,
|
||||
@ -607,7 +607,7 @@ impl Mutation {
|
||||
|
||||
Ok(true)
|
||||
}
|
||||
#[instrument(skip_all, fields(request_id=request_id()))]
|
||||
#[instrument(skip_all, fields(rid=request_id()))]
|
||||
async fn refresh<'ctx>(&self, ctx: &Context<'ctx>) -> Result<bool, Error> {
|
||||
let nm = ctx.data_unchecked::<Notmuch>();
|
||||
let cacher = ctx.data_unchecked::<FilesystemCacher>();
|
||||
|
||||
@ -12,5 +12,5 @@ version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
build-info = "0.0.39"
|
||||
letterbox-notmuch = { version = "0.8.4", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.8.5", path = "../notmuch", registry = "xinu" }
|
||||
serde = { version = "1.0.147", features = ["derive"] }
|
||||
|
||||
@ -33,8 +33,8 @@ wasm-bindgen = "=0.2.100"
|
||||
uuid = { version = "1.13.1", features = [
|
||||
"js",
|
||||
] } # direct dep to set js feature, prevents Rng issues
|
||||
letterbox-shared = { version = "0.8.4", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.8.4", path = "../notmuch", registry = "xinu" }
|
||||
letterbox-shared = { version = "0.8.5", path = "../shared", registry = "xinu" }
|
||||
letterbox-notmuch = { version = "0.8.5", path = "../notmuch", registry = "xinu" }
|
||||
seed_hooks = { version = "0.4.0", registry = "xinu" }
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user