Attempt at Forgejo Webhook support

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2024-04-19 20:49:31 +02:00
commit 8e94435604
No known key found for this signature in database
GPG key ID: DEDA74AEECA9D0F2
7 changed files with 124 additions and 27 deletions

View file

@ -24,7 +24,7 @@ mod webhook;
use crate::bot::XmppClient;
use crate::error::Error;
use crate::web::webhooks;
use crate::webhook::WebHook;
use crate::webhook::Hook;
use std::fs::File;
use std::io::{Error as IoError, ErrorKind as IoErrorKind, Read};
@ -130,7 +130,7 @@ async fn main() -> Result<!, Error> {
}
};
let (value_tx, mut value_rx) = mpsc::unbounded_channel::<WebHook>();
let (value_tx, mut value_rx) = mpsc::unbounded_channel::<Hook>();
let mut client = XmppClient::new(
config.jid,
@ -169,8 +169,8 @@ async fn main() -> Result<!, Error> {
}
}
wh = value_rx.recv() => {
if let Some(wh) = wh {
client.webhook(wh).await
if let Some(Hook::Gitlab(hook)) = wh {
client.webhook(hook).await
}
}
}