mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
Fix unused variable warning and run cargo fmt
Co-authored-by: link2xt <18373967+link2xt@users.noreply.github.com>
This commit is contained in:
11
src/calls.rs
11
src/calls.rs
@@ -434,7 +434,8 @@ impl Context {
|
|||||||
|
|
||||||
// Store SDP answer in calls table for outgoing calls
|
// Store SDP answer in calls table for outgoing calls
|
||||||
// (for incoming calls, we've already replaced our offer with our answer in accept_incoming_call)
|
// (for incoming calls, we've already replaced our offer with our answer in accept_incoming_call)
|
||||||
if let Some(answer_sdp) = mime_message.get_header(HeaderDef::ChatWebrtcAccepted) {
|
if let Some(answer_sdp) = mime_message.get_header(HeaderDef::ChatWebrtcAccepted)
|
||||||
|
{
|
||||||
self.sql
|
self.sql
|
||||||
.execute(
|
.execute(
|
||||||
"INSERT OR REPLACE INTO calls (msg_id, sdp) VALUES (?, ?)",
|
"INSERT OR REPLACE INTO calls (msg_id, sdp) VALUES (?, ?)",
|
||||||
@@ -539,11 +540,9 @@ impl Context {
|
|||||||
// For outgoing calls (after acceptance), the SDP is the answer from the other side.
|
// For outgoing calls (after acceptance), the SDP is the answer from the other side.
|
||||||
let sdp = self
|
let sdp = self
|
||||||
.sql
|
.sql
|
||||||
.query_row_optional(
|
.query_row_optional("SELECT sdp FROM calls WHERE msg_id=?", (call.id,), |row| {
|
||||||
"SELECT sdp FROM calls WHERE msg_id=?",
|
row.get::<_, String>(0)
|
||||||
(call.id,),
|
})
|
||||||
|row| row.get::<_, String>(0),
|
|
||||||
)
|
|
||||||
.await?
|
.await?
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
|||||||
@@ -680,7 +680,6 @@ async fn test_housekeeping_deletes_old_call_sdps() -> Result<()> {
|
|||||||
use crate::sql::housekeeping;
|
use crate::sql::housekeeping;
|
||||||
|
|
||||||
let alice = TestContext::new_alice().await;
|
let alice = TestContext::new_alice().await;
|
||||||
let bob = alice.create_chat_with_contact("", "bob@example.net").await;
|
|
||||||
|
|
||||||
// Simulate receiving an incoming call from Bob
|
// Simulate receiving an incoming call from Bob
|
||||||
let received_call = receive_imf(
|
let received_call = receive_imf(
|
||||||
@@ -703,11 +702,9 @@ async fn test_housekeeping_deletes_old_call_sdps() -> Result<()> {
|
|||||||
// Verify SDP is stored in calls table for incoming call
|
// Verify SDP is stored in calls table for incoming call
|
||||||
let sdp_before: Option<String> = alice
|
let sdp_before: Option<String> = alice
|
||||||
.sql
|
.sql
|
||||||
.query_row_optional(
|
.query_row_optional("SELECT sdp FROM calls WHERE msg_id=?", (call_id,), |row| {
|
||||||
"SELECT sdp FROM calls WHERE msg_id=?",
|
row.get(0)
|
||||||
(call_id,),
|
})
|
||||||
|row| row.get(0),
|
|
||||||
)
|
|
||||||
.await?;
|
.await?;
|
||||||
assert!(sdp_before.is_some());
|
assert!(sdp_before.is_some());
|
||||||
|
|
||||||
@@ -721,11 +718,9 @@ async fn test_housekeeping_deletes_old_call_sdps() -> Result<()> {
|
|||||||
// SDP should still be there after ending
|
// SDP should still be there after ending
|
||||||
let sdp_after_end: Option<String> = alice
|
let sdp_after_end: Option<String> = alice
|
||||||
.sql
|
.sql
|
||||||
.query_row_optional(
|
.query_row_optional("SELECT sdp FROM calls WHERE msg_id=?", (call_id,), |row| {
|
||||||
"SELECT sdp FROM calls WHERE msg_id=?",
|
row.get(0)
|
||||||
(call_id,),
|
})
|
||||||
|row| row.get(0),
|
|
||||||
)
|
|
||||||
.await?;
|
.await?;
|
||||||
assert!(sdp_after_end.is_some());
|
assert!(sdp_after_end.is_some());
|
||||||
|
|
||||||
@@ -738,11 +733,9 @@ async fn test_housekeeping_deletes_old_call_sdps() -> Result<()> {
|
|||||||
// Verify SDP has been deleted from calls table
|
// Verify SDP has been deleted from calls table
|
||||||
let sdp_after_housekeeping: Option<String> = alice
|
let sdp_after_housekeeping: Option<String> = alice
|
||||||
.sql
|
.sql
|
||||||
.query_row_optional(
|
.query_row_optional("SELECT sdp FROM calls WHERE msg_id=?", (call_id,), |row| {
|
||||||
"SELECT sdp FROM calls WHERE msg_id=?",
|
row.get(0)
|
||||||
(call_id,),
|
})
|
||||||
|row| row.get(0),
|
|
||||||
)
|
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq!(sdp_after_housekeeping, None);
|
assert_eq!(sdp_after_housekeeping, None);
|
||||||
|
|
||||||
|
|||||||
@@ -1704,7 +1704,9 @@ impl MimeFactory {
|
|||||||
)
|
)
|
||||||
.await?
|
.await?
|
||||||
.flatten()
|
.flatten()
|
||||||
.or_else(|| msg.param.get(Param::WebrtcAccepted).map(|s| s.to_string()));
|
.or_else(|| {
|
||||||
|
msg.param.get(Param::WebrtcAccepted).map(|s| s.to_string())
|
||||||
|
});
|
||||||
|
|
||||||
if let Some(answer_sdp) = answer_sdp {
|
if let Some(answer_sdp) = answer_sdp {
|
||||||
headers.push((
|
headers.push((
|
||||||
|
|||||||
Reference in New Issue
Block a user