Fix instance not setting nick or using password
This commit is contained in:
parent
c1a970ae3c
commit
bd74931ecd
1 changed files with 22 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ use tokio::select;
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
|
||||||
use crate::api::packet::ParsedPacket;
|
use crate::api::packet::ParsedPacket;
|
||||||
|
use crate::api::{Auth, AuthOption, Data, Nick};
|
||||||
use crate::conn::{Conn, ConnTx, State};
|
use crate::conn::{Conn, ConnTx, State};
|
||||||
|
|
||||||
const EUPH_DOMAIN: &str = "euphoria.io";
|
const EUPH_DOMAIN: &str = "euphoria.io";
|
||||||
|
|
@ -187,6 +188,27 @@ impl Instance {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
match &event.packet.content {
|
||||||
|
Ok(Data::SnapshotEvent(_)) => {
|
||||||
|
if let Some(username) = &config.username {
|
||||||
|
let name = username.to_string();
|
||||||
|
let _ = conn.tx().send(Nick { name });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(Data::BounceEvent(_)) => {
|
||||||
|
if let Some(password) = &config.password {
|
||||||
|
let cmd = Auth {
|
||||||
|
r#type: AuthOption::Passcode,
|
||||||
|
passcode: Some(password.to_string()),
|
||||||
|
};
|
||||||
|
let _ = conn.tx().send(cmd);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
if on_event(event).await.is_err() {
|
if on_event(event).await.is_err() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue