diff --git a/src/bot.rs b/src/bot.rs
index 8de5e87..5d903dc 100644
--- a/src/bot.rs
+++ b/src/bot.rs
@@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
-use crate::webhook::{format_webhook, GitlabHook};
+use crate::hook::{format_hook, GitlabHook};
use log::debug;
use xmpp::parsers::message::MessageType;
@@ -74,10 +74,10 @@ impl XmppClient {
}
}
- pub async fn webhook(&mut self, wh: GitlabHook) {
- debug!("Received Webhook");
- if let Some(display) = format_webhook(&wh) {
- debug!("Webhook: {}", display);
+ pub async fn hook(&mut self, wh: GitlabHook) {
+ debug!("Received Hook");
+ if let Some(display) = format_hook(&wh) {
+ debug!("Hook: {}", display);
for room in &self.rooms {
self.agent
.send_message(
diff --git a/src/webhook.rs b/src/hook.rs
similarity index 97%
rename from src/webhook.rs
rename to src/hook.rs
index ef5a2fa..a3e09ee 100644
--- a/src/webhook.rs
+++ b/src/hook.rs
@@ -31,7 +31,7 @@ impl From for Hook {
}
}
-pub fn format_webhook(glh: &GitlabHook) -> Option {
+pub fn format_hook(glh: &GitlabHook) -> Option {
Some(match glh {
GitlabHook::Push(push) => {
if push.ref_ != "refs/heads/main" {
@@ -154,7 +154,7 @@ pub fn format_webhook(glh: &GitlabHook) -> Option {
)
}
_glh => {
- debug!("Webhook not supported");
+ debug!("Hook not supported");
return None;
}
})
diff --git a/src/main.rs b/src/main.rs
index 3e50df6..667dd7b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,13 +18,13 @@
mod bot;
mod error;
+mod hook;
mod web;
-mod webhook;
use crate::bot::XmppClient;
use crate::error::Error;
-use crate::web::webhooks;
-use crate::webhook::Hook;
+use crate::hook::Hook;
+use crate::web::hooks;
use std::fs::File;
use std::io::{Error as IoError, ErrorKind as IoErrorKind, Read};
@@ -158,7 +158,7 @@ async fn main() -> Result {
.serve_connection(io, service_fn(|request| {
let value_tx = value_tx.clone();
async move {
- webhooks(request, token, value_tx).await
+ hooks(request, token, value_tx).await
}
}))
.await
@@ -170,7 +170,7 @@ async fn main() -> Result {
}
wh = value_rx.recv() => {
if let Some(Hook::Gitlab(hook)) = wh {
- client.webhook(hook).await
+ client.hook(hook).await
}
}
}
diff --git a/src/web.rs b/src/web.rs
index 05fd547..89d8494 100644
--- a/src/web.rs
+++ b/src/web.rs
@@ -14,7 +14,7 @@
// along with this program. If not, see .
use crate::error::Error;
-use crate::webhook::{ForgejoHook, GitlabHook, Hook};
+use crate::hook::{ForgejoHook, GitlabHook, Hook};
use std::convert::Infallible;
use std::io::Read;
@@ -41,7 +41,7 @@ fn error_res(e: E) -> Result>, Infallib
Ok(res)
}
-async fn webhooks_inner(req: Request, token: &str) -> Result {
+async fn hooks_inner(req: Request, token: &str) -> Result {
match req.method() {
&Method::POST => (),
_ => return Err(Error::MethodMismatch),
@@ -96,12 +96,12 @@ async fn webhooks_inner(req: Request, token: &str) -> Result,
token: &str,
value_tx: Arc>>,
) -> Result>, Infallible> {
- match webhooks_inner(req, token).await {
+ match hooks_inner(req, token).await {
Ok(wh) => {
debug!("Passed: {:?}", wh);