Skip to content

Commit 91b43c8

Browse files
committed
factor out mark_call_as_accepted
1 parent 084eade commit 91b43c8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/calls.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ impl Context {
8787
chat.id.accept(self).await?;
8888
}
8989

90-
// mark call as "accepted" (this is just Param::Arg atm)
91-
let mut msg = call.msg.clone();
92-
msg.param.set_int(Param::Arg, 1);
93-
msg.update_param(self).await?;
90+
call.msg.clone().mark_call_as_accepted(self).await?;
9491

9592
// send an acceptance message around: to the caller as well as to the other devices of the callee
9693
let mut msg = Message {
@@ -234,6 +231,14 @@ impl Context {
234231
}
235232
}
236233

234+
impl Message {
235+
async fn mark_call_as_accepted(&mut self, context: &Context) -> Result<()> {
236+
self.param.set_int(Param::Arg, 1);
237+
self.update_param(context).await?;
238+
Ok(())
239+
}
240+
}
241+
237242
#[cfg(test)]
238243
mod tests {
239244
use super::*;

0 commit comments

Comments
 (0)