Fix spelling of Param::GuaranteeE2ee

This commit is contained in:
Alexander Krotov
2019-10-27 02:48:18 +03:00
committed by Floris Bruynooghe
parent ee81895e1e
commit 7916a7fa07
7 changed files with 15 additions and 15 deletions

View File

@@ -361,7 +361,7 @@ impl Chat {
} }
} }
if do_guarantee_e2ee { if do_guarantee_e2ee {
msg.param.set_int(Param::GuranteeE2ee, 1); msg.param.set_int(Param::GuaranteeE2ee, 1);
} }
// reset eg. for forwarding // reset eg. for forwarding
msg.param.remove(Param::ErroneousE2ee); msg.param.remove(Param::ErroneousE2ee);
@@ -739,7 +739,7 @@ fn last_msg_in_chat_encrypted(context: &Context, sql: &Sql, chat_id: u32) -> boo
if let Some(ref packed) = packed { if let Some(ref packed) = packed {
match packed.parse::<Params>() { match packed.parse::<Params>() {
Ok(param) => param.exists(Param::GuranteeE2ee), Ok(param) => param.exists(Param::GuaranteeE2ee),
Err(err) => { Err(err) => {
error!(context, "invalid params stored: '{}', {:?}", packed, err); error!(context, "invalid params stored: '{}', {:?}", packed, err);
false false
@@ -1763,7 +1763,7 @@ pub fn forward_msgs(context: &Context, msg_ids: &[u32], chat_id: u32) -> Result<
// however, this turned out to be to confusing and unclear. // however, this turned out to be to confusing and unclear.
msg.param.set_int(Param::Forwarded, 1); msg.param.set_int(Param::Forwarded, 1);
msg.param.remove(Param::GuranteeE2ee); msg.param.remove(Param::GuaranteeE2ee);
msg.param.remove(Param::ForcePlaintext); msg.param.remove(Param::ForcePlaintext);
msg.param.remove(Param::Cmd); msg.param.remove(Param::Cmd);

View File

@@ -803,7 +803,7 @@ impl<'a> MimeParser<'a> {
fn do_add_single_part(&mut self, mut part: Part) { fn do_add_single_part(&mut self, mut part: Part) {
if self.encrypted && self.signatures.len() > 0 { if self.encrypted && self.signatures.len() > 0 {
part.param.set_int(Param::GuranteeE2ee, 1); part.param.set_int(Param::GuaranteeE2ee, 1);
} else if self.encrypted { } else if self.encrypted {
part.param.set_int(Param::ErroneousE2ee, 0x2); part.param.set_int(Param::ErroneousE2ee, 0x2);
} }

View File

@@ -594,7 +594,7 @@ pub fn job_send_msg(context: &Context, msg_id: u32) -> Result<(), Error> {
if 0 != mimefactory if 0 != mimefactory
.msg .msg
.param .param
.get_int(Param::GuranteeE2ee) .get_int(Param::GuaranteeE2ee)
.unwrap_or_default() .unwrap_or_default()
&& !mimefactory.out_encrypted && !mimefactory.out_encrypted
{ {
@@ -607,7 +607,7 @@ pub fn job_send_msg(context: &Context, msg_id: u32) -> Result<(), Error> {
bail!( bail!(
"e2e encryption unavailable {} - {:?}", "e2e encryption unavailable {} - {:?}",
msg_id, msg_id,
mimefactory.msg.param.get_int(Param::GuranteeE2ee), mimefactory.msg.param.get_int(Param::GuaranteeE2ee),
); );
} }
if context.get_config_bool(Config::BccSelf) if context.get_config_bool(Config::BccSelf)
@@ -649,11 +649,11 @@ pub fn job_send_msg(context: &Context, msg_id: u32) -> Result<(), Error> {
&& mimefactory && mimefactory
.msg .msg
.param .param
.get_int(Param::GuranteeE2ee) .get_int(Param::GuaranteeE2ee)
.unwrap_or_default() .unwrap_or_default()
== 0 == 0
{ {
mimefactory.msg.param.set_int(Param::GuranteeE2ee, 1); mimefactory.msg.param.set_int(Param::GuaranteeE2ee, 1);
mimefactory.msg.save_param_to_disk(context); mimefactory.msg.save_param_to_disk(context);
} }
add_smtp_job(context, Action::SendMsgToSmtp, &mut mimefactory)?; add_smtp_job(context, Action::SendMsgToSmtp, &mut mimefactory)?;

View File

@@ -254,7 +254,7 @@ impl Message {
} }
pub fn get_showpadlock(&self) -> bool { pub fn get_showpadlock(&self) -> bool {
self.param.get_int(Param::GuranteeE2ee).unwrap_or_default() != 0 self.param.get_int(Param::GuaranteeE2ee).unwrap_or_default() != 0
} }
pub fn get_summary(&mut self, context: &Context, chat: Option<&Chat>) -> Lot { pub fn get_summary(&mut self, context: &Context, chat: Option<&Chat>) -> Lot {
@@ -605,7 +605,7 @@ pub fn get_msg_info(context: &Context, msg_id: u32) -> String {
if 0 != e2ee_errors & 0x2 { if 0 != e2ee_errors & 0x2 {
ret += ", Encrypted, no valid signature"; ret += ", Encrypted, no valid signature";
} }
} else if 0 != msg.param.get_int(Param::GuranteeE2ee).unwrap_or_default() { } else if 0 != msg.param.get_int(Param::GuaranteeE2ee).unwrap_or_default() {
ret += ", Encrypted"; ret += ", Encrypted";
} }

View File

@@ -256,7 +256,7 @@ impl<'a> MimeFactory<'a> {
e2ee_guaranteed = self e2ee_guaranteed = self
.msg .msg
.param .param
.get_int(Param::GuranteeE2ee) .get_int(Param::GuaranteeE2ee)
.unwrap_or_default() .unwrap_or_default()
!= 0; != 0;
} }
@@ -537,7 +537,7 @@ impl<'a> MimeFactory<'a> {
!= self != self
.msg .msg
.param .param
.get_int(Param::GuranteeE2ee) .get_int(Param::GuaranteeE2ee)
.unwrap_or_default() .unwrap_or_default()
{ {
self.context self.context

View File

@@ -25,7 +25,7 @@ pub enum Param {
/// For Messages /// For Messages
MimeType = b'm', MimeType = b'm',
/// For Messages: message is encryoted, outgoing: guarantee E2EE or the message is not send /// For Messages: message is encryoted, outgoing: guarantee E2EE or the message is not send
GuranteeE2ee = b'c', GuaranteeE2ee = b'c',
/// For Messages: decrypted with validation errors or without mutual set, if neither /// For Messages: decrypted with validation errors or without mutual set, if neither
/// 'c' nor 'e' are preset, the messages is only transport encrypted. /// 'c' nor 'e' are preset, the messages is only transport encrypted.
ErroneousE2ee = b'e', ErroneousE2ee = b'e',
@@ -331,7 +331,7 @@ mod tests {
p1.set(Param::Forwarded, "foo") p1.set(Param::Forwarded, "foo")
.set_int(Param::File, 2) .set_int(Param::File, 2)
.remove(Param::GuranteeE2ee) .remove(Param::GuaranteeE2ee)
.set_int(Param::Duration, 4); .set_int(Param::Duration, 4);
assert_eq!(p1.to_string(), "a=foo\nd=4\nf=2"); assert_eq!(p1.to_string(), "a=foo\nd=4\nf=2");

View File

@@ -278,7 +278,7 @@ fn send_handshake_msg(
ForcePlaintext::AddAutocryptHeader as i32, ForcePlaintext::AddAutocryptHeader as i32,
); );
} else { } else {
msg.param.set_int(Param::GuranteeE2ee, 1); msg.param.set_int(Param::GuaranteeE2ee, 1);
} }
// TODO. handle cleanup on error // TODO. handle cleanup on error
chat::send_msg(context, contact_chat_id, &mut msg).unwrap_or_default(); chat::send_msg(context, contact_chat_id, &mut msg).unwrap_or_default();