| egg-mode

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at

extern crate egg_mode;

mod common;

use common::tokio_core::reactor;
use common::futures::Stream;

use std::collections::HashSet;
use egg_mode::user;

//IMPORTANT: see for instructions on making sure this properly authenticates with
fn main() {
    let mut core = reactor::Core::new().unwrap();

    let config = common::Config::load(&mut core);
    let handle = core.handle();

    let mut friends = HashSet::new();, &config.token, &handle)
                  .map(|r| r.response)
                  .for_each(|id| { friends.insert(id); Ok(()) })).unwrap();

    let mut followers = HashSet::new();, &config.token, &handle)
                  .map(|r| r.response)
                  .for_each(|id| { followers.insert(id); Ok(()) })).unwrap();

    let reciprocals = friends.intersection(&followers).cloned().collect::<Vec<_>>();

    println!("{} accounts that you follow follow you back.", reciprocals.len());

    for user in, &config.token, &handle)).unwrap() {
        println!("{} (@{})",, user.screen_name);