Skip to content

Commit 37dde81

Browse files
committed
add device-msg 'consider enabling bcc_self' if bcc_self is disabled and an autocrypt-setup-message is received
1 parent 0d3f1b6 commit 37dde81

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/imex.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ fn do_initiate_key_transfer(context: &Context) -> Result<String> {
155155
}
156156
}
157157
}
158+
// no maybe_add_bcc_self_device_msg() here.
159+
// the ui shows the dialog with the setup code on this device,
160+
// it would be too much noise to have two things popping up at the same time.
161+
// maybe_add_bcc_self_device_msg() is called on the other device
162+
// once the transfer is completed.
158163
Ok(setup_code)
159164
}
160165

@@ -230,6 +235,21 @@ pub fn create_setup_code(_context: &Context) -> String {
230235
ret
231236
}
232237

238+
fn maybe_add_bcc_self_device_msg(context: &Context) -> Result<()> {
239+
if !context.sql.get_raw_config_bool(context, "bcc_self") {
240+
let mut msg = Message::new(Viewtype::Text);
241+
// TODO: define this as a stockstring once the wording is settled.
242+
msg.text = Some(
243+
"It seems you are using multiple devices with Delta Chat. Great!\n\n\
244+
If you also want to synchronize outgoing messages accross all devices, \
245+
go to the settings and enable \"Send copy to self\"."
246+
.to_string(),
247+
);
248+
chat::add_device_msg(context, &mut msg)?;
249+
}
250+
Ok(())
251+
}
252+
233253
pub fn continue_key_transfer(context: &Context, msg_id: MsgId, setup_code: &str) -> Result<()> {
234254
ensure!(!msg_id.is_special(), "wrong id");
235255

@@ -244,6 +264,7 @@ pub fn continue_key_transfer(context: &Context, msg_id: MsgId, setup_code: &str)
244264
let sc = normalize_setup_code(setup_code);
245265
let armored_key = decrypt_setup_file(context, &sc, file)?;
246266
set_self_key(context, &armored_key, true, true)?;
267+
maybe_add_bcc_self_device_msg(context)?;
247268

248269
Ok(())
249270
} else {

0 commit comments

Comments
 (0)