diff options
| author | Jokler <jokler.contact@gmail.com> | 2018-03-16 03:29:59 +0100 |
|---|---|---|
| committer | Jokler <jokler.contact@gmail.com> | 2018-03-16 03:29:59 +0100 |
| commit | e510da21a359ffa96843da53c464bce3ad1f7810 (patch) | |
| tree | b6415e9a84481c825b8fc492b56a3256fa9df41b | |
| parent | 54fc50c782b79c2de32dc2ce50a79ae1b471db63 (diff) | |
| download | frippy-e510da21a359ffa96843da53c464bce3ad1f7810.tar.gz frippy-e510da21a359ffa96843da53c464bce3ad1f7810.zip | |
Fix continue in tell by removing the inner loop
| -rw-r--r-- | src/plugins/tell/mod.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/tell/mod.rs b/src/plugins/tell/mod.rs index f3ca90c..e8a2bb6 100644 --- a/src/plugins/tell/mod.rs +++ b/src/plugins/tell/mod.rs @@ -65,16 +65,19 @@ impl<T: Database> Tell<T> { .list_channels() .expect("The irc crate should not be compiled with the \"nochanlists\" feature"); - for channel in channels { - if let Some(users) = client.list_users(&channel) { - if users - .iter() - .any(|u| u.get_nickname().eq_ignore_ascii_case(&receiver)) - { - online.push(receiver); - continue; - } - } + if let Some(_) = channels + .iter() + .map(|c| client.list_users(&c)) + .map(|opt| { + opt.and_then(|us| { + us.into_iter() + .find(|u| u.get_nickname().eq_ignore_ascii_case(&receiver)) + }) + }) + .find(|opt| opt.is_some()) + { + online.push(receiver); + continue; } let tm = time::now().to_timespec(); |
