Keep hold of the Accounts struct
This commit is contained in:
@@ -39,11 +39,12 @@ pub fn run(tx: FdSender<SystemMessage>, rx: Receiver<PurpleMessage>) {
|
|||||||
pub struct DeltaSystem {
|
pub struct DeltaSystem {
|
||||||
tx: FdSender<SystemMessage>,
|
tx: FdSender<SystemMessage>,
|
||||||
rx: Receiver<PurpleMessage>,
|
rx: Receiver<PurpleMessage>,
|
||||||
|
accounts: Option<Accounts>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DeltaSystem {
|
impl DeltaSystem {
|
||||||
fn new(tx: FdSender<SystemMessage>, rx: Receiver<PurpleMessage>) -> Self {
|
fn new(tx: FdSender<SystemMessage>, rx: Receiver<PurpleMessage>) -> Self {
|
||||||
Self { tx, rx }
|
Self { tx, rx, accounts: None }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn user_dir() -> async_std::path::PathBuf {
|
fn user_dir() -> async_std::path::PathBuf {
|
||||||
@@ -62,7 +63,7 @@ impl DeltaSystem {
|
|||||||
let mut config_dir = DeltaSystem::user_dir();
|
let mut config_dir = DeltaSystem::user_dir();
|
||||||
config_dir.push("purple-plugin-delta");
|
config_dir.push("purple-plugin-delta");
|
||||||
|
|
||||||
Accounts::new("purple-plugin-delta".into(), config_dir).await.unwrap();
|
self.accounts = Some(Accounts::new("purple-plugin-delta".into(), config_dir).await.unwrap());
|
||||||
|
|
||||||
log::info!("Looping on messages");
|
log::info!("Looping on messages");
|
||||||
loop {
|
loop {
|
||||||
@@ -84,6 +85,7 @@ impl DeltaSystem {
|
|||||||
if let Err(error) = result {
|
if let Err(error) = result {
|
||||||
log::error!("Error handling message: {}", error);
|
log::error!("Error handling message: {}", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
logging::flush();
|
logging::flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user