Rircd/src/irc_endpoint.rs

33 lines
755 B
Rust
Raw Normal View History

2021-09-16 22:40:40 +02:00
use crate::endpoint::Endpoint;
use async_trait::async_trait;
use tokio::sync::{mpsc,oneshot};
use std::sync::Arc;
use eyre::Result;
2021-09-16 23:05:36 +02:00
use crate::event::{EventKind,Event};
2021-09-16 22:40:40 +02:00
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(()));
2021-09-16 23:05:36 +02:00
let (s,r) = oneshot::channel();
event_receiver.send(
Event {
kind: EventKind::Message,
2021-09-16 23:08:22 +02:00
event.result_sender.send(Ok(()),
2021-09-16 23:05:36 +02:00
}).await;
2021-09-16 22:40:40 +02:00
}
}