From 367e90931ee6c0a7eda2bba9de370ef2a0fcae4e Mon Sep 17 00:00:00 2001 From: xmppftw Date: Tue, 23 Jun 2026 17:14:10 +0200 Subject: [PATCH 1/6] feat: vendored-openssl feature --- Cargo.toml | 3 ++- README.md | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index bb9548b..0ffe8fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ pretty_env_logger = "0.5" serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" toml = "1.1" -xmpp = { git = "https://code.bouah.net/pep/xmpp-rs", rev = "559159d4", default-features = false, features = [ "serde", "starttls", "rustls-native-certs", "aws_lc_rs" ] } +xmpp = { git = "https://gitlab.com/xmppftw/xmpp-rs", branch = "feat-openssl-vendored", default-features = false, features = [ "serde", "starttls", "rustls-native-certs", "aws_lc_rs" ] } hmac = "0.13" sha2 = "0.11" hex = "0.4" @@ -36,3 +36,4 @@ forgejo-hooks = { path = "forgejo-hooks" } [features] gitlab = [ "dep:gitlab" ] syntax-highlighting = ["xmpp/syntax-highlighting"] +vendored-openssl = [ "xmpp/vendored-openssl", "git2/vendored-openssl" ] diff --git a/README.md b/README.md index 5109c74..b3ba21b 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,12 @@ be somewhat of a testbed for xmpp-rs features. Originally based on tokio-webhook2muc. +# Cross-compile musl + +``` +cross build --release --target x86_64-unknown-linux-musl --features vendored-openssl +``` + ## License AGPL-3.0-or-later. See the LICENSE file. From 0763ce13c981f91e8700ccc719491c1ee607a168 Mon Sep 17 00:00:00 2001 From: xmppftw Date: Tue, 23 Jun 2026 17:15:36 +0200 Subject: [PATCH 2/6] meta: add exmaple config --- config.sample.toml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 config.sample.toml diff --git a/config.sample.toml b/config.sample.toml new file mode 100644 index 0000000..5fed1de --- /dev/null +++ b/config.sample.toml @@ -0,0 +1,8 @@ +admins = [ "foo@localhost" ] +jid = "bar@localhost" +password = "bonjourxmpp" + +rooms = [ "room@muc.localhost" ] +secret = "bonjourforgejo" + +addr = "[::1]:5225" From 732f77f141010c79b046b19e843aa27df6e2ddf9 Mon Sep 17 00:00:00 2001 From: xmppftw Date: Tue, 23 Jun 2026 17:29:43 +0200 Subject: [PATCH 3/6] feat: Notify when updating comment (not just commenting) --- src/hooks/forgejo.rs | 1 + src/hooks/mod.rs | 13 ++++++++++--- src/hooks/types.rs | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/hooks/forgejo.rs b/src/hooks/forgejo.rs index d1defc3..47b9bad 100644 --- a/src/hooks/forgejo.rs +++ b/src/hooks/forgejo.rs @@ -77,6 +77,7 @@ impl From for Note { .comment .map(|c| c.html_url) .unwrap_or(other.issue.html_url), + is_update: other.action == FjIssueAction::Edited, } } } diff --git a/src/hooks/mod.rs b/src/hooks/mod.rs index 68bf6c1..3a2fce3 100644 --- a/src/hooks/mod.rs +++ b/src/hooks/mod.rs @@ -109,19 +109,26 @@ pub fn format_hook(hook: &Hook) -> Option { if note.snippet { return None; } + + let updated_fmt = if note.is_update { + "updated comment" + } else { + "commented" + }; + if let Some(commit) = ¬e.commit { format!( - "[{}] {} commented on commit {:?} <{}>", + "[{}] {} {updated_fmt} on commit {:?} <{}>", note.repository.name, note.author.name, commit.ref_, commit.url, ) } else if let Some(issue) = ¬e.issue { format!( - "[{}] {} commented on issue {}: {} <{}>", + "[{}] {} {updated_fmt} on issue {}: {} <{}>", note.repository.name, note.author.name, issue.id, issue.title, note.url, ) } else if let Some(mr) = ¬e.merge_request { format!( - "[{}] {} commented on merge request {}: {} <{}>", + "[{}] {} {updated_fmt} on merge request {}: {} <{}>", note.repository.name, note.author.name, mr.id, mr.title, note.url, ) } else { diff --git a/src/hooks/types.rs b/src/hooks/types.rs index 6525fe2..b828ebe 100644 --- a/src/hooks/types.rs +++ b/src/hooks/types.rs @@ -116,6 +116,7 @@ pub struct Note { pub repository: Repository, pub author: User, pub url: String, + pub is_update: bool, } #[derive(Debug, Clone, PartialEq)] From 01a1b9a1858d91eab808bae6938cbed9ea7db633 Mon Sep 17 00:00:00 2001 From: xmppftw Date: Tue, 23 Jun 2026 17:14:10 +0200 Subject: [PATCH 4/6] feat: vendored-openssl feature --- Cargo.toml | 3 ++- README.md | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index bb9548b..a30854d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ pretty_env_logger = "0.5" serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" toml = "1.1" -xmpp = { git = "https://code.bouah.net/pep/xmpp-rs", rev = "559159d4", default-features = false, features = [ "serde", "starttls", "rustls-native-certs", "aws_lc_rs" ] } +xmpp = { git = "https://kl.netlib.re/forge/xmppftw/xmpp-rs", branch = "feat-openssl-vendored", default-features = false, features = [ "serde", "starttls", "rustls-native-certs", "aws_lc_rs" ] } hmac = "0.13" sha2 = "0.11" hex = "0.4" @@ -36,3 +36,4 @@ forgejo-hooks = { path = "forgejo-hooks" } [features] gitlab = [ "dep:gitlab" ] syntax-highlighting = ["xmpp/syntax-highlighting"] +vendored-openssl = [ "xmpp/vendored-openssl", "git2/vendored-openssl" ] diff --git a/README.md b/README.md index 5109c74..b3ba21b 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,12 @@ be somewhat of a testbed for xmpp-rs features. Originally based on tokio-webhook2muc. +# Cross-compile musl + +``` +cross build --release --target x86_64-unknown-linux-musl --features vendored-openssl +``` + ## License AGPL-3.0-or-later. See the LICENSE file. From baf52106fdb63f4321880cfa134309b2fd4d7e7f Mon Sep 17 00:00:00 2001 From: xmppftw Date: Tue, 23 Jun 2026 17:15:36 +0200 Subject: [PATCH 5/6] meta: add exmaple config --- config.sample.toml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 config.sample.toml diff --git a/config.sample.toml b/config.sample.toml new file mode 100644 index 0000000..5fed1de --- /dev/null +++ b/config.sample.toml @@ -0,0 +1,8 @@ +admins = [ "foo@localhost" ] +jid = "bar@localhost" +password = "bonjourxmpp" + +rooms = [ "room@muc.localhost" ] +secret = "bonjourforgejo" + +addr = "[::1]:5225" From 23745d682923032ea9a99ed4b687a1abe24092da Mon Sep 17 00:00:00 2001 From: xmppftw Date: Tue, 23 Jun 2026 17:29:43 +0200 Subject: [PATCH 6/6] feat: Notify when updating comment (not just commenting) --- src/hooks/forgejo.rs | 1 + src/hooks/mod.rs | 13 ++++++++++--- src/hooks/types.rs | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/hooks/forgejo.rs b/src/hooks/forgejo.rs index d1defc3..47b9bad 100644 --- a/src/hooks/forgejo.rs +++ b/src/hooks/forgejo.rs @@ -77,6 +77,7 @@ impl From for Note { .comment .map(|c| c.html_url) .unwrap_or(other.issue.html_url), + is_update: other.action == FjIssueAction::Edited, } } } diff --git a/src/hooks/mod.rs b/src/hooks/mod.rs index 68bf6c1..3a2fce3 100644 --- a/src/hooks/mod.rs +++ b/src/hooks/mod.rs @@ -109,19 +109,26 @@ pub fn format_hook(hook: &Hook) -> Option { if note.snippet { return None; } + + let updated_fmt = if note.is_update { + "updated comment" + } else { + "commented" + }; + if let Some(commit) = ¬e.commit { format!( - "[{}] {} commented on commit {:?} <{}>", + "[{}] {} {updated_fmt} on commit {:?} <{}>", note.repository.name, note.author.name, commit.ref_, commit.url, ) } else if let Some(issue) = ¬e.issue { format!( - "[{}] {} commented on issue {}: {} <{}>", + "[{}] {} {updated_fmt} on issue {}: {} <{}>", note.repository.name, note.author.name, issue.id, issue.title, note.url, ) } else if let Some(mr) = ¬e.merge_request { format!( - "[{}] {} commented on merge request {}: {} <{}>", + "[{}] {} {updated_fmt} on merge request {}: {} <{}>", note.repository.name, note.author.name, mr.id, mr.title, note.url, ) } else { diff --git a/src/hooks/types.rs b/src/hooks/types.rs index 6525fe2..b828ebe 100644 --- a/src/hooks/types.rs +++ b/src/hooks/types.rs @@ -116,6 +116,7 @@ pub struct Note { pub repository: Repository, pub author: User, pub url: String, + pub is_update: bool, } #[derive(Debug, Clone, PartialEq)]