mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 22:36:30 +03:00
Add clarifying comments and improve documentation based on code review
Co-authored-by: link2xt <18373967+link2xt@users.noreply.github.com>
This commit is contained in:
10
src/calls.rs
10
src/calls.rs
@@ -196,8 +196,10 @@ impl Context {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set a placeholder parameter so the message is recognized as a call
|
// Set a placeholder parameter so the message is recognized as a call during sending.
|
||||||
// This will be used by mimefactory until the DB entry is available
|
// This ensures mimefactory can read the SDP during the brief window between
|
||||||
|
// send_msg() starting and the calls table entry being available.
|
||||||
|
// The param will be removed after send_msg() completes.
|
||||||
call.param.set(Param::WebrtcRoom, &place_call_info);
|
call.param.set(Param::WebrtcRoom, &place_call_info);
|
||||||
call.id = send_msg(self, chat_id, &mut call).await?;
|
call.id = send_msg(self, chat_id, &mut call).await?;
|
||||||
|
|
||||||
@@ -521,7 +523,9 @@ impl Context {
|
|||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load SDP from calls table
|
// Load SDP from calls table. Returns empty strings if no record exists,
|
||||||
|
// which can happen for old messages from before the migration or for
|
||||||
|
// calls where SDPs have been cleaned up by housekeeping.
|
||||||
let (place_call_info, accept_call_info) = self
|
let (place_call_info, accept_call_info) = self
|
||||||
.sql
|
.sql
|
||||||
.query_row_optional(
|
.query_row_optional(
|
||||||
|
|||||||
@@ -921,12 +921,13 @@ pub async fn housekeeping(context: &Context) -> Result<()> {
|
|||||||
.log_err(context)
|
.log_err(context)
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
// Delete call SDPs for ended calls (older than 24 hours) or orphaned calls.
|
// Delete call SDPs for ended calls (older than 24 hours) or trashed calls.
|
||||||
// We clean up calls that ended more than 24 hours ago to protect privacy
|
// We clean up calls that ended more than 24 hours ago to protect privacy
|
||||||
// as SDPs contain IP addresses. Ended calls are identified by having
|
// as SDPs contain IP addresses. Ended calls are identified by having
|
||||||
// the CALL_ENDED_TIMESTAMP parameter (Param::Arg4) set.
|
// the CALL_ENDED_TIMESTAMP parameter (Param::Arg4='H') set.
|
||||||
// The ON DELETE CASCADE foreign key will handle orphaned entries automatically,
|
// The pattern '%H=%' matches this parameter since params are stored as
|
||||||
// but we also check for trash and old ended calls.
|
// newline-separated key=value pairs (e.g., "E=123\nH=456\n").
|
||||||
|
// The ON DELETE CASCADE foreign key handles orphaned entries automatically.
|
||||||
context
|
context
|
||||||
.sql
|
.sql
|
||||||
.execute(
|
.execute(
|
||||||
|
|||||||
Reference in New Issue
Block a user