mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
bin/darkirc: ignore CAP END if user is registered
This commit is contained in:
@@ -78,6 +78,8 @@ pub struct Client {
|
||||
pub registered: AtomicBool,
|
||||
/// Registration pause marker
|
||||
pub reg_paused: AtomicBool,
|
||||
/// CAP END marker
|
||||
pub is_cap_end: AtomicBool,
|
||||
/// Client username
|
||||
pub username: Arc<RwLock<String>>,
|
||||
/// Client nickname
|
||||
@@ -114,6 +116,7 @@ impl Client {
|
||||
penalty: AtomicUsize::new(0),
|
||||
registered: AtomicBool::new(false),
|
||||
reg_paused: AtomicBool::new(false),
|
||||
is_cap_end: AtomicBool::new(false),
|
||||
username: username.clone(),
|
||||
nickname: nickname.clone(),
|
||||
realname: RwLock::new(String::from("*")),
|
||||
|
||||
@@ -193,7 +193,8 @@ impl Client {
|
||||
"END" => {
|
||||
// At CAP END, if we have USER and NICK, we can welcome them.
|
||||
self.reg_paused.store(false, SeqCst);
|
||||
if self.registered.load(SeqCst) {
|
||||
if self.registered.load(SeqCst) && !self.is_cap_end.load(SeqCst) {
|
||||
self.is_cap_end.store(true, SeqCst);
|
||||
return Ok(self.welcome().await)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user