mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
bin/ircd: clean up functions parameters
This commit is contained in:
@@ -81,13 +81,17 @@ async fn broadcast_msg(
|
||||
}
|
||||
|
||||
async fn process(
|
||||
p2p_receiver: Receiver<Privmsg>,
|
||||
// server
|
||||
stream: TcpStream,
|
||||
peer_addr: SocketAddr,
|
||||
p2p: net::P2pPtr,
|
||||
// msg ids
|
||||
seen_msg_ids: SeenMsgIds,
|
||||
// channels
|
||||
autojoin_chans: Vec<String>,
|
||||
configured_chans: FxHashMap<String, ChannelInfo>,
|
||||
// p2p
|
||||
p2p: net::P2pPtr,
|
||||
p2p_receiver: Receiver<Privmsg>,
|
||||
) -> Result<()> {
|
||||
let (reader, writer) = stream.split();
|
||||
|
||||
@@ -95,9 +99,9 @@ async fn process(
|
||||
let mut conn = IrcServerConnection::new(
|
||||
writer,
|
||||
seen_msg_ids.clone(),
|
||||
p2p.clone(),
|
||||
autojoin_chans,
|
||||
configured_chans,
|
||||
p2p.clone(),
|
||||
);
|
||||
|
||||
loop {
|
||||
@@ -211,13 +215,13 @@ async fn realmain(settings: Args, executor: Arc<Executor<'_>>) -> Result<()> {
|
||||
|
||||
executor_cloned
|
||||
.spawn(process(
|
||||
p2p_recv_channel.clone(),
|
||||
stream,
|
||||
peer_addr,
|
||||
p2p.clone(),
|
||||
seen_msg_ids.clone(),
|
||||
settings.autojoin.clone(),
|
||||
configured_chans.clone(),
|
||||
p2p.clone(),
|
||||
p2p_recv_channel.clone(),
|
||||
))
|
||||
.detach();
|
||||
}
|
||||
|
||||
@@ -18,35 +18,39 @@ const RPL_NOTOPIC: u32 = 331;
|
||||
const RPL_TOPIC: u32 = 332;
|
||||
|
||||
pub struct IrcServerConnection {
|
||||
// server stream
|
||||
write_stream: WriteHalf<TcpStream>,
|
||||
// msg ids
|
||||
seen_msg_ids: SeenMsgIds,
|
||||
// user & channels
|
||||
is_nick_init: bool,
|
||||
is_user_init: bool,
|
||||
is_registered: bool,
|
||||
nickname: String,
|
||||
seen_msg_ids: SeenMsgIds,
|
||||
p2p: P2pPtr,
|
||||
auto_channels: Vec<String>,
|
||||
pub configured_chans: FxHashMap<String, ChannelInfo>,
|
||||
// p2p
|
||||
p2p: P2pPtr,
|
||||
}
|
||||
|
||||
impl IrcServerConnection {
|
||||
pub fn new(
|
||||
write_stream: WriteHalf<TcpStream>,
|
||||
seen_msg_ids: SeenMsgIds,
|
||||
p2p: P2pPtr,
|
||||
auto_channels: Vec<String>,
|
||||
configured_chans: FxHashMap<String, ChannelInfo>,
|
||||
p2p: P2pPtr,
|
||||
) -> Self {
|
||||
Self {
|
||||
write_stream,
|
||||
seen_msg_ids,
|
||||
is_nick_init: false,
|
||||
is_user_init: false,
|
||||
is_registered: false,
|
||||
nickname: "anon".to_string(),
|
||||
seen_msg_ids,
|
||||
p2p,
|
||||
auto_channels,
|
||||
configured_chans,
|
||||
p2p,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user