|
|
|
@ -17,9 +17,17 @@ pub async fn body(state: State, num: Option<usize>, mut output: mpsc::Sender<Str
|
|
|
|
|
|
|
|
|
|
debug!("Taking {:?} from {:?}" ,num, string);
|
|
|
|
|
let filter = state.outbound_filter();
|
|
|
|
|
for sen in sanitise::Sentance::new_iter(&string).take(num.unwrap_or(1))
|
|
|
|
|
{
|
|
|
|
|
output.send(filter.filter_owned(sen.to_owned())).await.map_err(|e| gen::GenBodyError(e.0))?;
|
|
|
|
|
if let Some(num) = num {
|
|
|
|
|
for sen in sanitise::Sentance::new_iter(&string).take(num)
|
|
|
|
|
{
|
|
|
|
|
output.send(filter.filter_owned(sen.to_owned())).await.map_err(|e| gen::GenBodyError(e.0))?;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
output.send(filter.filter_owned(match sanitise::Sentance::new_iter(&string)
|
|
|
|
|
.max_by_key(|x| x.len()) {
|
|
|
|
|
Some(x) => x,
|
|
|
|
|
#[cold] None => return Ok(()),
|
|
|
|
|
}.to_owned())).await.map_err(|e| gen::GenBodyError(e.0))?;
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|