|
@@ -95,7 +95,7 @@ impl IrcServerConnection {
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- self.names(chan).await?;
|
|
|
|
|
|
|
+ self.on_receive_names(chan).await?;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
"NICK" => {
|
|
"NICK" => {
|
|
@@ -240,14 +240,21 @@ impl IrcServerConnection {
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async fn names(&mut self, chan: &str) -> Result<()> {
|
|
|
|
|
|
|
+ async fn on_receive_names(&mut self, chan: &str) -> Result<()> {
|
|
|
if self.configured_chans.contains_key(chan) {
|
|
if self.configured_chans.contains_key(chan) {
|
|
|
|
|
+ let end_of_names = format!(
|
|
|
|
|
+ ":DarkFi {:03} {} {} :End of NAMES list\r\n",
|
|
|
|
|
+ RPL_ENDOFNAMES, self.nickname, chan
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ self.reply(&end_of_names).await?;
|
|
|
|
|
+
|
|
|
let chan_info = self.configured_chans.get(chan).unwrap();
|
|
let chan_info = self.configured_chans.get(chan).unwrap();
|
|
|
|
|
|
|
|
if chan_info.names.is_empty() {
|
|
if chan_info.names.is_empty() {
|
|
|
- self.end_of_names(chan).await?;
|
|
|
|
|
return Ok(())
|
|
return Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
let names_reply = format!(
|
|
let names_reply = format!(
|
|
|
":{}!anon@dark.fi {} = {} : {}\r\n",
|
|
":{}!anon@dark.fi {} = {} : {}\r\n",
|
|
|
self.nickname,
|
|
self.nickname,
|
|
@@ -257,23 +264,11 @@ impl IrcServerConnection {
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
self.reply(&names_reply).await?;
|
|
self.reply(&names_reply).await?;
|
|
|
-
|
|
|
|
|
- self.end_of_names(chan).await?;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async fn end_of_names(&mut self, chan: &str) -> Result<()> {
|
|
|
|
|
- let end_of_names = format!(
|
|
|
|
|
- ":DarkFi {:03} {} {} :End of NAMES list\r\n",
|
|
|
|
|
- RPL_ENDOFNAMES, self.nickname, chan
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- self.reply(&end_of_names).await?;
|
|
|
|
|
- Ok(())
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
async fn on_join(&mut self, chan: &str) -> Result<()> {
|
|
async fn on_join(&mut self, chan: &str) -> Result<()> {
|
|
|
if !self.configured_chans.contains_key(chan) {
|
|
if !self.configured_chans.contains_key(chan) {
|
|
|
let mut chan_info = ChannelInfo::new()?;
|
|
let mut chan_info = ChannelInfo::new()?;
|
|
@@ -301,7 +296,7 @@ impl IrcServerConnection {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- self.names(chan).await?;
|
|
|
|
|
|
|
+ self.on_receive_names(chan).await?;
|
|
|
Ok(())
|
|
Ok(())
|
|
|
}
|
|
}
|
|
|
|
|
|