Module tox::core [-]  [+] [src]

The core rust-tox module.

Example (a simple echo bot)

#![feature(globs)]
extern crate tox;
 
use tox::core::*;
 
fn main() {
    let tox = Tox::new(ToxOptions::new()).unwrap();
    let bootkey = box "951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F".parse().unwrap();
    tox.bootstrap_from_address("192.254.75.98".to_string(), 33445, bootkey).unwrap();
 
    println!("Bot key: {}", tox.get_address());
 
    for ev in tox.events().iter() {
        match ev {
            FriendRequest(fnum, _) => {
                tox.add_friend_norequest(fnum).unwrap();
            },
            FriendMessage(fnum, msg) => {
                tox.send_message(fnum, msg).unwrap();
            },
            _ => (),
        }
    }
}

Reexports

pub use self::Event::*;

Modules

ll

Structs

Address

A Tox address consist of ClientId, nospam and checksum

ClientId

ClientId is the main part of tox Address. Other two are nospam and checksum.

Hash

Locally-calculated cryptographic hash of the avatar data

Tox

The main tox struct. All the control goes here.

ToxOptions

ToxOptions provides options that tox will be initalized with.

Enums

AvatarFormat
ChatChange
ConnectionStatus
ControlType
Event

Tox events enum

Faerr

Faerr - Friend Add Error

GroupchatType
ProxyType
TransferType
UserStatus

Constants

ADDRESS_SIZE
AVATAR_MAX_DATA_LENGTH
HASH_LENGTH
ID_CLIENT_SIZE
MAX_MESSAGE_LENGTH
MAX_NAME_LENGTH
MAX_STATUSMESSAGE_LENGTH
TOX_MAX_FRIENDREQUEST_LENGTH