From f2e3c88b60b4460f51d6e38ad64e550e8bba770b Mon Sep 17 00:00:00 2001 From: cottongin Date: Tue, 10 Mar 2026 21:52:17 -0400 Subject: [PATCH] feat: add events module with BridgeEvent, ControlCommand, OwncastState types Made-with: Cursor --- src/events.rs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 1 + 2 files changed, 52 insertions(+) create mode 100644 src/events.rs diff --git a/src/events.rs b/src/events.rs new file mode 100644 index 0000000..7d405c1 --- /dev/null +++ b/src/events.rs @@ -0,0 +1,51 @@ +use tokio::sync::oneshot; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum Source { + Irc, + Owncast, +} + +#[derive(Debug, Clone)] +pub enum BridgeEvent { + ChatMessage { + source: Source, + username: String, + body: String, + id: Option, + }, + StreamStarted { + title: String, + }, + StreamStopped, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum OwncastState { + Online, + OfflineChatOpen, + Unavailable, +} + +#[derive(Debug)] +pub enum ControlCommand { + IrcConnect, + IrcDisconnect, + IrcReconnect, + OwncastConnect, + OwncastDisconnect, + OwncastReconnect, + Status { + reply: oneshot::Sender, + }, + Quit, +} + +#[derive(Debug, Clone, serde::Serialize)] +pub struct BridgeStatus { + pub irc_connected: bool, + pub owncast_state: String, + pub webhook_listening: bool, + pub websocket_connected: bool, + pub uptime_secs: u64, +} diff --git a/src/main.rs b/src/main.rs index 98a45b6..86ab3db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ mod config; +mod events; fn main() { println!("owncast-irc-bridge");