mirror of
https://github.com/chatmail/core.git
synced 2026-07-23 03:13:06 +03:00
Compare commits
12 Commits
local_hpk_
...
remove_got
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea7da1661b | ||
|
|
144858b318 | ||
|
|
be605d8ea5 | ||
|
|
4d8d5f4e1e | ||
|
|
750d6e99a8 | ||
|
|
a67892d414 | ||
|
|
1cd2a62caf | ||
|
|
6772d6f66c | ||
|
|
89531dfb62 | ||
|
|
ba02406cb0 | ||
|
|
32fd3242e9 | ||
|
|
ff3f96df48 |
@@ -76,11 +76,6 @@ pub unsafe fn dc_e2ee_encrypt(
|
||||
let mut peerstates: Vec<Peerstate> = Vec::new();
|
||||
*helper = Default::default();
|
||||
|
||||
info!(
|
||||
context,
|
||||
0, "dc_e2ee_encrypt guaruanteed={}", e2ee_guaranteed
|
||||
);
|
||||
|
||||
if !(recipients_addr.is_null()
|
||||
|| in_out_message.is_null()
|
||||
|| !(*in_out_message).mm_parent.is_null()
|
||||
@@ -111,10 +106,6 @@ pub unsafe fn dc_e2ee_encrypt(
|
||||
iter1 = (*recipients_addr).first;
|
||||
while !iter1.is_null() {
|
||||
let recipient_addr = to_string((*iter1).data as *const libc::c_char);
|
||||
info!(
|
||||
context,
|
||||
0, "dc_e2ee_encrypt recipient_addr {}", recipient_addr
|
||||
);
|
||||
if recipient_addr != addr {
|
||||
let peerstate =
|
||||
Peerstate::from_addr(context, &context.sql, &recipient_addr);
|
||||
@@ -594,7 +585,6 @@ pub unsafe fn dc_e2ee_decrypt(
|
||||
}
|
||||
} else if let Some(ref header) = autocryptheader {
|
||||
let p = Peerstate::from_header(context, header, message_time);
|
||||
info!(context, 0, "setting peerstate from header for {:?}", p.addr);
|
||||
assert!(p.save_to_db(&context.sql, true));
|
||||
peerstate = Some(p);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ use crate::dc_tools::*;
|
||||
use crate::stock::StockMessage;
|
||||
use crate::types::*;
|
||||
use crate::x::*;
|
||||
use std::ffi::CString;
|
||||
use std::ptr;
|
||||
|
||||
/* * Structure behind dc_lot_t */
|
||||
#[derive(Copy, Clone)]
|
||||
@@ -171,14 +169,15 @@ pub unsafe fn dc_lot_fill(
|
||||
}
|
||||
}
|
||||
|
||||
let msgtext_c = (*msg)
|
||||
.text
|
||||
.as_ref()
|
||||
.map(|s| CString::yolo(String::as_str(s)));
|
||||
let msgtext_ptr = msgtext_c.map_or(ptr::null(), |s| s.as_ptr());
|
||||
let message_text = (*msg).text.as_ref().unwrap();
|
||||
|
||||
(*lot).text2 =
|
||||
dc_msg_get_summarytext_by_raw((*msg).type_0, msgtext_ptr, &mut (*msg).param, 160, context);
|
||||
(*lot).text2 = dc_msg_get_summarytext_by_raw(
|
||||
(*msg).type_0,
|
||||
message_text.strdup(),
|
||||
&mut (*msg).param,
|
||||
160,
|
||||
context,
|
||||
);
|
||||
|
||||
(*lot).timestamp = dc_msg_get_timestamp(msg);
|
||||
(*lot).state = (*msg).state;
|
||||
|
||||
@@ -1041,11 +1041,6 @@ pub unsafe fn dc_mimefactory_render(mut factory: *mut dc_mimefactory_t) -> libc:
|
||||
&mut e2ee_helper,
|
||||
);
|
||||
}
|
||||
info!(
|
||||
(*factory).context,
|
||||
0, "encryption successful {}", e2ee_helper.encryption_successfull
|
||||
);
|
||||
|
||||
if 0 != e2ee_helper.encryption_successfull {
|
||||
(*factory).out_encrypted = 1;
|
||||
if 0 != do_gossip {
|
||||
|
||||
@@ -786,7 +786,7 @@ pub unsafe fn dc_msg_get_summary<'a>(
|
||||
msg: *mut dc_msg_t<'a>,
|
||||
mut chat: *const Chat<'a>,
|
||||
) -> *mut dc_lot_t {
|
||||
let current_block: u64;
|
||||
let mut ok_to_continue = true;
|
||||
let ret: *mut dc_lot_t = dc_lot_new();
|
||||
let mut chat_to_delete: *mut Chat = 0 as *mut Chat;
|
||||
|
||||
@@ -794,27 +794,23 @@ pub unsafe fn dc_msg_get_summary<'a>(
|
||||
if chat.is_null() {
|
||||
chat_to_delete = dc_get_chat((*msg).context, (*msg).chat_id);
|
||||
if chat_to_delete.is_null() {
|
||||
current_block = 15204159476013091401;
|
||||
} else {
|
||||
chat = chat_to_delete;
|
||||
current_block = 7815301370352969686;
|
||||
ok_to_continue = false;
|
||||
}
|
||||
} else {
|
||||
current_block = 7815301370352969686;
|
||||
ok_to_continue = false;
|
||||
}
|
||||
match current_block {
|
||||
15204159476013091401 => {}
|
||||
_ => {
|
||||
let contact = if (*msg).from_id != DC_CONTACT_ID_SELF as libc::c_uint
|
||||
&& ((*chat).type_0 == 120 || (*chat).type_0 == 130)
|
||||
{
|
||||
Contact::get_by_id((*chat).context, (*msg).from_id).ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if ok_to_continue == false {
|
||||
let contact = if (*msg).from_id != DC_CONTACT_ID_SELF as libc::c_uint
|
||||
&& ((*chat).type_0 == 120 || (*chat).type_0 == 130)
|
||||
{
|
||||
Contact::get_by_id((*chat).context, (*msg).from_id).ok()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
dc_lot_fill(ret, msg, chat, contact.as_ref(), (*msg).context);
|
||||
}
|
||||
dc_lot_fill(ret, msg, chat, contact.as_ref(), (*msg).context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -166,7 +166,6 @@ impl<'a> Peerstate<'a> {
|
||||
|
||||
pub fn from_addr(context: &'a Context, _sql: &Sql, addr: &str) -> Option<Self> {
|
||||
let query = "SELECT addr, last_seen, last_seen_autocrypt, prefer_encrypted, public_key, gossip_timestamp, gossip_key, public_key_fingerprint, gossip_key_fingerprint, verified_key, verified_key_fingerprint FROM acpeerstates WHERE addr=? COLLATE NOCASE;";
|
||||
info!(context, 0, "peerstate.from_addr {}", addr);
|
||||
Self::from_stmt(context, query, &[addr])
|
||||
}
|
||||
|
||||
@@ -188,7 +187,6 @@ impl<'a> Peerstate<'a> {
|
||||
P: IntoIterator,
|
||||
P::Item: rusqlite::ToSql,
|
||||
{
|
||||
info!(context, 0, "from_stmt query {:?}", query);
|
||||
context
|
||||
.sql
|
||||
.query_row(query, params, |row| {
|
||||
@@ -200,28 +198,38 @@ impl<'a> Peerstate<'a> {
|
||||
let mut res = Self::new(context);
|
||||
|
||||
res.addr = Some(row.get(0)?);
|
||||
info!(context, 0, "from_stmt res.addr {:?} starting", res.addr);
|
||||
res.last_seen = row.get(1)?;
|
||||
res.last_seen_autocrypt = row.get(2)?;
|
||||
res.prefer_encrypt = EncryptPreference::from_i32(row.get(3)?).unwrap_or_default();
|
||||
res.gossip_timestamp = row.get(5)?;
|
||||
let pkf: String = row.get(7)?;
|
||||
res.public_key_fingerprint = if pkf.is_empty() { None } else { Some(pkf) };
|
||||
|
||||
let t: Result<String, rusqlite::Error> = row.get(8);
|
||||
let gkf: String = match t {
|
||||
Err(_) => String::from(""),
|
||||
Ok(res) => res,
|
||||
};
|
||||
res.gossip_key_fingerprint = if gkf.is_empty() { None } else { Some(gkf) };
|
||||
|
||||
let t: Result<String, rusqlite::Error> = row.get(10);
|
||||
let vkf: String = match t {
|
||||
Err(_) => String::from(""),
|
||||
Ok(res) => res,
|
||||
};
|
||||
res.verified_key_fingerprint = if vkf.is_empty() { None } else { Some(vkf) };
|
||||
|
||||
res.public_key_fingerprint = row.get(7)?;
|
||||
if res
|
||||
.public_key_fingerprint
|
||||
.as_ref()
|
||||
.map(|s| s.is_empty())
|
||||
.unwrap_or_default()
|
||||
{
|
||||
res.public_key_fingerprint = None;
|
||||
}
|
||||
res.gossip_key_fingerprint = row.get(8)?;
|
||||
if res
|
||||
.gossip_key_fingerprint
|
||||
.as_ref()
|
||||
.map(|s| s.is_empty())
|
||||
.unwrap_or_default()
|
||||
{
|
||||
res.gossip_key_fingerprint = None;
|
||||
}
|
||||
res.verified_key_fingerprint = row.get(10)?;
|
||||
if res
|
||||
.verified_key_fingerprint
|
||||
.as_ref()
|
||||
.map(|s| s.is_empty())
|
||||
.unwrap_or_default()
|
||||
{
|
||||
res.verified_key_fingerprint = None;
|
||||
}
|
||||
res.public_key = row
|
||||
.get(4)
|
||||
.ok()
|
||||
@@ -234,6 +242,7 @@ impl<'a> Peerstate<'a> {
|
||||
.get(9)
|
||||
.ok()
|
||||
.and_then(|blob: Vec<u8>| Key::from_slice(&blob, KeyType::Public));
|
||||
|
||||
res.verified_key = if vk == res.gossip_key && res.gossip_key.is_some() {
|
||||
VerifiedKey::Gossip
|
||||
} else if vk == res.public_key {
|
||||
@@ -417,10 +426,6 @@ impl<'a> Peerstate<'a> {
|
||||
}
|
||||
|
||||
if self.to_save == Some(ToSave::All) || create {
|
||||
info!(
|
||||
self.context,
|
||||
0, "update acpeerstates with peerstate {:?}", self
|
||||
);
|
||||
success = sql::execute(
|
||||
self.context,
|
||||
sql,
|
||||
|
||||
Reference in New Issue
Block a user