diff --git a/src/configuration.rs b/src/configuration.rs
index 57d4b06..1dfa634 100644
--- a/src/configuration.rs
+++ b/src/configuration.rs
@@ -14,11 +14,11 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+use crate::widgets::login_screen::LoginAttempt;
use dioxus::prelude::*;
use keyring::Entry;
use log::error;
use serde_derive::{Deserialize, Serialize};
-use crate::widgets::login_screen::LoginAttempt;
/// The configuration struct containing all the configuration options.
#[derive(Serialize, Deserialize, Default)]
@@ -37,7 +37,6 @@ pub struct Configuration {
/// * `attempt` - The login attempt to store.
/// * `config` - The current app configuration; UseState should prevent race conditions in writing.
pub fn store_login_details(attempt: LoginAttempt, config: &mut UseRef) {
-
// Extract the fields from the login attempt.
let LoginAttempt {
username,
@@ -47,10 +46,11 @@ pub fn store_login_details(attempt: LoginAttempt, config: &mut UseRef Configuration {
Configuration::default()
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main.rs b/src/main.rs
index 2717174..1ac7a0d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -16,10 +16,10 @@
#![allow(non_snake_case)]
+mod configuration;
mod types;
mod widgets;
mod xmpp_interface;
-mod configuration;
use dioxus::prelude::*;
use dioxus_desktop::Config;
diff --git a/src/widgets/mod.rs b/src/widgets/mod.rs
index 777e1f0..8cfc95a 100644
--- a/src/widgets/mod.rs
+++ b/src/widgets/mod.rs
@@ -17,8 +17,8 @@
use crate::types::LoginCredentials;
use crate::widgets::login_screen::LoginAttempt;
use crate::widgets::login_screen::{LoginScreen, LoginStatus};
-use crate::widgets::room_view::RoomView;
use crate::widgets::no_room_open::NoRoomPlaceholder;
+use crate::widgets::room_view::RoomView;
use crate::widgets::sidebar::SideBar;
use crate::xmpp_interface::NetworkCommand;
use dioxus::core::{Element, Scope};
@@ -29,22 +29,21 @@ use jid::BareJid;
use log::{error, info};
use std::collections::HashMap;
-use std::str::FromStr;
-use std::string::String;
-use keyring::Entry;
use crate::configuration::load_config;
use crate::xmpp_interface;
+use keyring::Entry;
+use std::str::FromStr;
+use std::string::String;
pub mod login_screen;
+mod no_room_open;
pub mod room_join_widget;
pub mod room_list;
pub mod room_view;
pub mod send_message;
pub mod sidebar;
-mod no_room_open;
pub fn App(cx: Scope) -> Element {
-
let messages = use_ref(cx, || HashMap::new());
let current_room = use_state(cx, || None::);
let connection_status = use_state(cx, || LoginStatus::LoggedOut);
@@ -174,4 +173,4 @@ pub fn App(cx: Scope) -> Element {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/widgets/room_join_widget.rs b/src/widgets/room_join_widget.rs
index b860eac..f750063 100644
--- a/src/widgets/room_join_widget.rs
+++ b/src/widgets/room_join_widget.rs
@@ -33,7 +33,6 @@ pub struct RoomJoinProps<'a> {
///
/// Also validates the room name, and displays an error message if the room name is invalid.
pub fn RoomJoinWidget<'a>(cx: Scope<'a, RoomJoinProps>) -> Element<'a> {
-
// Store the current room name and error message in state.
let room = use_state(cx, || "".to_owned());
let error = use_state(cx, || "".to_owned());
diff --git a/src/widgets/send_message.rs b/src/widgets/send_message.rs
index 4d93b8d..3ca97fa 100644
--- a/src/widgets/send_message.rs
+++ b/src/widgets/send_message.rs
@@ -26,7 +26,6 @@ pub struct SendMessageProps<'a> {
/// A simple widget that allows the user to compose a message and a button to send it.
pub fn SendMessage<'a>(cx: Scope<'a, SendMessageProps>) -> Element<'a> {
-
// The message body being written.
let message = use_state(cx, || "".to_owned());
diff --git a/src/widgets/sidebar.rs b/src/widgets/sidebar.rs
index 8f4e397..414fa5a 100644
--- a/src/widgets/sidebar.rs
+++ b/src/widgets/sidebar.rs
@@ -14,12 +14,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+use crate::widgets::room_join_widget::RoomJoinWidget;
+use crate::widgets::room_list::RoomList;
use dioxus::core::{Element, Scope};
use dioxus::core_macro::Props;
-use jid::BareJid;
use dioxus::prelude::*;
-use crate::widgets::room_list::RoomList;
-use crate::widgets::room_join_widget::RoomJoinWidget;
+use jid::BareJid;
#[derive(Props)]
pub struct SideBarProps<'a> {
diff --git a/src/xmpp_interface.rs b/src/xmpp_interface.rs
index e81c7c9..266d1b7 100644
--- a/src/xmpp_interface.rs
+++ b/src/xmpp_interface.rs
@@ -22,17 +22,16 @@ use log::{error, info};
use std::collections::HashMap;
use std::future::Future;
+use crate::widgets::login_screen::LoginStatus;
use tokio::select;
use xmpp::parsers::message::MessageType;
use xmpp::{Agent, ClientBuilder, ClientType};
-use crate::widgets::login_screen::LoginStatus;
/// An enum of commands that can be sent to the XMPP interface.
///
/// These very loosely correspond to XMPP stanzas, but are more high level.
#[derive(Debug)]
pub enum NetworkCommand {
-
/// Start a new login attempt, resulting in either a successful login or an error.
TryLogin { credentials: LoginCredentials },
@@ -44,7 +43,6 @@ pub enum NetworkCommand {
/// Send a message to a recipient.
SendMessage { recipient: BareJid, message: String },
-
}
async fn handle_event(
@@ -108,8 +106,6 @@ async fn handle_event(
}
}
-
-
pub fn xmpp_mainloop<'a>(
agent: &'a mut Agent,
mut room_data: &'a mut UseRef>>,
@@ -163,7 +159,6 @@ pub fn xmpp_mainloop<'a>(
///
/// The future resolves to Ok(()) if the agent went online, or Err(String) if the agent disconnected.
async fn await_online(agent: &mut Agent) -> Result<(), String> {
-
// Wait for the next batch of events.
let events = agent
.wait_for_events()