Add todos

This commit is contained in:
Joscha 2022-08-30 17:04:03 +02:00
parent 03ddc5eb9b
commit 5eeabea2de
8 changed files with 45 additions and 0 deletions

View file

@ -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,
}

View file

@ -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

View file

@ -1,3 +1,7 @@
// TODO Implement thread view
// TODO Implement flat (chronological?) view
// TODO Implement message search?
mod blocks;
mod tree;

View file

@ -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 {

View file

@ -39,6 +39,7 @@ enum State {
Nick(EditorState),
Account(AccountUiState),
Links(LinksState),
// TODO Inspect messages and users
}
#[allow(clippy::large_enum_variant)]

View file

@ -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()),

View file

@ -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;

View file

@ -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
}