Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/iamb.1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ View a list of unread rooms.
Mark all rooms as read.
.It Sy ":welcome"
View the startup Welcome window.
.It Sy ":forget"
Remove all left rooms from the internal database.
.El

.Sh "E2EE COMMANDS"
Expand Down
2 changes: 2 additions & 0 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ pub enum HomeserverAction {
/// Create a new room with an optional localpart.
CreateRoom(Option<String>, CreateRoomType, CreateRoomFlags),
Logout(String, bool),
/// Forget all left rooms
Forget,
}

/// An action performed against the user's room keys.
Expand Down
16 changes: 16 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,17 @@ fn iamb_leave(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
return Ok(step);
}

fn iamb_forget(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
if !desc.arg.text.is_empty() {
return Result::Err(CommandError::InvalidArgument);
}

let forget = IambAction::Homeserver(HomeserverAction::Forget);
let step = CommandStep::Continue(forget.into(), ctx.context.clone());

return Ok(step);
}

fn iamb_cancel(desc: CommandDescription, ctx: &mut ProgContext) -> ProgResult {
if !desc.arg.text.is_empty() {
return Result::Err(CommandError::InvalidArgument);
Expand Down Expand Up @@ -731,6 +742,11 @@ fn add_iamb_commands(cmds: &mut ProgramCommands) {
aliases: vec![],
f: iamb_leave,
});
cmds.add_command(ProgramCommand {
name: "forget".into(),
aliases: vec![],
f: iamb_forget,
});
cmds.add_command(ProgramCommand {
name: "members".into(),
aliases: vec![],
Expand Down
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,13 @@ impl Application {

Err(UIError::NeedConfirm(prompt))
},
HomeserverAction::Forget => {
let client = &store.application.worker.client;
for room in client.left_rooms() {
room.forget().await.map_err(IambError::from)?;
}
Ok(vec![])
},
}
}

Expand Down
Loading