hidden contact invite
This commit is contained in:
1 parent
ce44ee48b3
commit
7eace57528
6 files changed
+172
-37
No files matched your search
@@ -154,6 +154,10 @@ struct ServerSel {
|
||||
/// Comma-separated server URLs or names (default: all my servers).
|
||||
#[arg(short, long, value_delimiter = ',')]
|
||||
servers: Vec<String>,
|
||||
/// Create the contact directly in the hidden space opened by this password
|
||||
/// (created if needed). Unlock it with -u for the next steps.
|
||||
#[arg(long)]
|
||||
space_password: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@@ -386,6 +390,7 @@ async fn run() -> Result<()> {
|
||||
&message,
|
||||
&invitation_password,
|
||||
DEFAULT_INVITATION_TTL,
|
||||
sel.space_password.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
println!("{url}");
|
||||
@@ -398,7 +403,13 @@ async fn run() -> Result<()> {
|
||||
}) => {
|
||||
let mut c = ctx.open().await?;
|
||||
let who = c
|
||||
.accept_published_invitation(&url, &invitation_password, name.as_deref(), &sel.servers)
|
||||
.accept_published_invitation(
|
||||
&url,
|
||||
&invitation_password,
|
||||
name.as_deref(),
|
||||
&sel.servers,
|
||||
sel.space_password.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
println!("answered invitation from {who}");
|
||||
}
|
||||
@@ -497,7 +508,13 @@ async fn invitation(ctx: &Ctx, cmd: InvitationCmd) -> Result<()> {
|
||||
} => {
|
||||
let mut c = ctx.open().await?;
|
||||
let offer = c
|
||||
.create_invitation(&contact, &sel.servers, &message, DEFAULT_INVITATION_TTL)
|
||||
.create_invitation(
|
||||
&contact,
|
||||
&sel.servers,
|
||||
&message,
|
||||
DEFAULT_INVITATION_TTL,
|
||||
sel.space_password.as_deref(),
|
||||
)
|
||||
.await?;
|
||||
let out = out.unwrap_or_else(|| PathBuf::from(format!("{}-{contact}.mwiv2", c.nickname())));
|
||||
std::fs::write(&out, offer)?;
|
||||
@@ -522,7 +539,9 @@ async fn invitation(ctx: &Ctx, cmd: InvitationCmd) -> Result<()> {
|
||||
let mut c = ctx.open().await?;
|
||||
let offer = std::fs::read(&file)?;
|
||||
let initiator = c.inspect_invitation(&offer)?.initiator_name;
|
||||
let answer = c.answer_invitation(&offer, name.as_deref(), &sel.servers).await?;
|
||||
let answer = c
|
||||
.answer_invitation(&offer, name.as_deref(), &sel.servers, sel.space_password.as_deref())
|
||||
.await?;
|
||||
let out = out.unwrap_or_else(|| PathBuf::from(format!("{}-{initiator}.mwiv2", c.nickname())));
|
||||
std::fs::write(&out, answer)?;
|
||||
println!("{}", out.display());
|
||||
|
||||
Reference in new issue
Block a user