-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.rs
31 lines (25 loc) · 880 Bytes
/
test.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
extern crate rstox;
use rstox::core::*;
static BOOTSTRAP_IP: &'static str = "192.254.75.98";
static BOOTSTRAP_PORT: u16 = 33445;
static BOOTSTRAP_KEY: &'static str =
"951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F";
static BOT_NAME: &'static str = "yuppi";
fn main() {
let mut tox = Tox::new(ToxOptions::new(), None).unwrap();
tox.set_name(BOT_NAME).unwrap();
let bootstrap_key = BOOTSTRAP_KEY.parse().unwrap();
tox.bootstrap(BOOTSTRAP_IP, BOOTSTRAP_PORT, bootstrap_key).unwrap();
println!("{}", tox.get_address());
loop {
for ev in tox.iter() {
match ev {
FriendRequest(cid, _) => {
tox.add_friend_norequest(&cid).unwrap();
},
ev => { println!("Tox event: {:?}", ev); },
}
}
tox.wait();
}
}