summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoscha <joscha@plugh.de>2022-08-30 17:04:03 +0200
committerJoscha <joscha@plugh.de>2022-08-30 17:17:11 +0200
commit5eeabea2de7473ed28228dcc1a0fc13973f7e23e (patch)
tree3ae2e951d2ac18078c821dac320cce7d95fd58bf
parent03ddc5eb9badfdbd373ae9da2ab7663940f072e9 (diff)
Add todos
-rw-r--r--src/config.rs2
-rw-r--r--src/euph/room.rs29
-rw-r--r--src/ui/chat.rs4
-rw-r--r--src/ui/chat/tree.rs3
-rw-r--r--src/ui/euph/room.rs1
-rw-r--r--src/ui/util.rs3
-rw-r--r--src/ui/widgets/list.rs2
-rw-r--r--src/ui/widgets/text.rs1
8 files changed, 45 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index d02b670..e0823bb 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -8,6 +8,7 @@ use crate::macros::ok_or_return;
#[derive(Debug, Clone, Default, Deserialize)]
pub struct EuphRoom {
+ // TODO Mark favourite rooms via printable ascii characters
#[serde(default)]
pub autojoin: bool,
pub username: Option<String>,
@@ -28,6 +29,7 @@ pub struct Config {
pub ephemeral: bool,
#[serde(default)]
pub offline: bool,
+ // TODO Invoke external notification command?
pub euph: Euph,
}
diff --git a/src/euph/room.rs b/src/euph/room.rs
index 110c4ac..75a7c55 100644
--- a/src/euph/room.rs
+++ b/src/euph/room.rs
@@ -169,6 +169,7 @@ impl State {
let cookies = Self::get_cookies(vault.vault()).await;
let cookies = HeaderValue::from_str(&cookies).expect("valid cookies");
request.headers_mut().append(header::COOKIE, cookies);
+ // TODO Set user agent?
match tokio_tungstenite::connect_async(request).await {
Ok((ws, response)) => {
@@ -186,6 +187,32 @@ impl State {
}
async fn regularly_request_logs(event_tx: &mpsc::UnboundedSender<Event>) {
+ // TODO Make log downloading smarter
+
+ // Possible log-related mechanics. Some of these could also run in some
+ // sort of "repair logs" mode that can be started via some key binding.
+ // For now, this is just a list of ideas.
+ //
+ // Download room history until there are no more gaps between now and
+ // the first known message.
+ //
+ // Download room history until reaching the beginning of the room's
+ // history.
+ //
+ // Check if the last known message still exists on the server. If it
+ // doesn't, do a binary search to find the server's last message and
+ // delete all older messages.
+ //
+ // Untruncate messages in the history, as well as new messages.
+ //
+ // Try to retrieve messages that are not in the room log by retrieving
+ // them by id.
+ //
+ // Redownload messages that are already known to find any edits and
+ // deletions that happened while the client was offline.
+ //
+ // Delete messages marked as deleted as well as all their children.
+
loop {
tokio::time::sleep(LOG_INTERVAL).await;
let _ = event_tx.send(Event::RequestLogs);
@@ -255,6 +282,7 @@ impl State {
info!("e&{}: network event ({})", self.name, d.r#type);
}
Data::NickEvent(d) => {
+ // TODO Add entry in nick list (probably in euphoxide instead of here)
info!("e&{}: {:?} renamed to {:?}", self.name, d.from, d.to);
}
Data::EditMessageEvent(_) => {
@@ -265,6 +293,7 @@ impl State {
}
Data::PingEvent(_) => {}
Data::PmInitiateEvent(d) => {
+ // TODO Show info popup and automatically join PM room
info!(
"e&{}: {:?} initiated a pm from &{}",
self.name, d.from_nick, d.from_room
diff --git a/src/ui/chat.rs b/src/ui/chat.rs
index 5caaa04..6d6514f 100644
--- a/src/ui/chat.rs
+++ b/src/ui/chat.rs
@@ -1,3 +1,7 @@
+// TODO Implement thread view
+// TODO Implement flat (chronological?) view
+// TODO Implement message search?
+
mod blocks;
mod tree;
diff --git a/src/ui/chat/tree.rs b/src/ui/chat/tree.rs
index fe52b26..e9523ac 100644
--- a/src/ui/chat/tree.rs
+++ b/src/ui/chat/tree.rs
@@ -1,3 +1,5 @@
+// TODO Focusing on sub-trees
+
mod cursor;
mod layout;
mod tree_blocks;
@@ -78,6 +80,7 @@ impl<M: Msg, S: MsgStore<M>> InnerTreeViewState<M, S> {
bindings.binding("ctrl+u/d", "scroll up/down half a screen");
bindings.binding("ctrl+b/f, page up/down", "scroll up/down one screen");
bindings.binding("z", "center cursor on screen");
+ // TODO Bindings inspired by vim's ()/[]/{} bindings?
}
async fn handle_movement_input_event(&mut self, frame: &mut Frame, event: &InputEvent) -> bool {
diff --git a/src/ui/euph/room.rs b/src/ui/euph/room.rs
index 7db984d..f9a255d 100644
--- a/src/ui/euph/room.rs
+++ b/src/ui/euph/room.rs
@@ -39,6 +39,7 @@ enum State {
Nick(EditorState),
Account(AccountUiState),
Links(LinksState),
+ // TODO Inspect messages and users
}
#[allow(clippy::large_enum_variant)]
diff --git a/src/ui/util.rs b/src/ui/util.rs
index e14e5d9..0b2fed5 100644
--- a/src/ui/util.rs
+++ b/src/ui/util.rs
@@ -30,6 +30,8 @@ pub fn prompt(
}
}
+// TODO List key binding util functions
+
pub fn list_editor_key_bindings(
bindings: &mut KeyBindingsList,
char_filter: impl Fn(char) -> bool,
@@ -94,6 +96,7 @@ pub fn handle_editor_input_event(
key!(Ctrl + 'd') | key!(Delete) => editor.delete(),
key!(Ctrl + 'l') => editor.clear(),
key!(Ctrl + 'x') if can_edit_externally => editor.edit_externally(terminal, crossterm_lock),
+ // TODO Key bindings to delete words
// Cursor movement
key!(Ctrl + 'b') | key!(Left) => editor.move_cursor_left(terminal.frame()),
diff --git a/src/ui/widgets/list.rs b/src/ui/widgets/list.rs
index ab175f0..6a586a1 100644
--- a/src/ui/widgets/list.rs
+++ b/src/ui/widgets/list.rs
@@ -1,3 +1,5 @@
+// TODO Fix scrolling by focusing on the cursor like in chat::tree
+
use std::sync::Arc;
use async_trait::async_trait;
diff --git a/src/ui/widgets/text.rs b/src/ui/widgets/text.rs
index 7cab2bb..3ac47cb 100644
--- a/src/ui/widgets/text.rs
+++ b/src/ui/widgets/text.rs
@@ -18,6 +18,7 @@ impl Text {
}
pub fn wrap(mut self, active: bool) -> Self {
+ // TODO Re-think and check what behaviour this setting should entail
self.wrap = active;
self
}