33 lines
742 B
Rust
33 lines
742 B
Rust
use crate::endpoint::Endpoint;
|
|
use async_trait::async_trait;
|
|
use tokio::sync::{mpsc,oneshot};
|
|
use std::sync::Arc;
|
|
use eyre::Result;
|
|
use crate::event::{EventKind,Event};
|
|
|
|
pub struct IrcEndpoint {
|
|
}
|
|
|
|
#[async_trait]
|
|
impl Endpoint for IrcEndpoint {
|
|
fn name(&self) -> String {
|
|
"test irc_endpoint".into()
|
|
}
|
|
|
|
fn is_active(&self) -> bool {
|
|
true
|
|
}
|
|
|
|
async fn listen(self: Arc<Self>, success_status_send: oneshot::Sender<Result<()>>,
|
|
event_receiver: mpsc::Sender<Event>) {
|
|
success_status_send.send(Ok(()));
|
|
|
|
let (s,r) = oneshot::channel();
|
|
event_receiver.send(
|
|
Event {
|
|
kind: EventKind::Message,
|
|
result_receiver: r,
|
|
}).await;
|
|
}
|
|
}
|