Crate ts3plugin [] [src]

A crate to create TeamSpeak3 plugins.

Example

A fully working example that creates a plugin that does nothing:

#[macro_use]
extern crate ts3plugin;
#[macro_use]
extern crate lazy_static;

use ts3plugin::*;

struct MyTsPlugin;

impl Plugin for MyTsPlugin {
    fn new(api: &mut TsApi) -> Result<Box<MyTsPlugin>, InitError> {
        api.log_or_print("Inited", "MyTsPlugin", LogLevel::Info);
        Ok(Box::new(MyTsPlugin))
        // Or return Err(InitError::Failure) on failure
    }

    // Implement callbacks here

    fn shutdown(&mut self, api: &mut TsApi) {
        api.log_or_print("Shutdown", "MyTsPlugin", LogLevel::Info);
    }
}

create_plugin!(
    "My Ts Plugin", "0.1.0", "My name", "A wonderful tiny example plugin",
    ConfigureOffer::No, false, MyTsPlugin);

You also need to add lazy_static to your crates dependencies.

Reexports

pub use ts3plugin_sys::clientlib_publicdefinitions::*;
pub use ts3plugin_sys::plugin_definitions::*;
pub use ts3plugin_sys::public_definitions::*;
pub use plugin::*;

Modules

plugin
ts3interface

Macros

create_plugin

Create a plugin. This macro has to be called once per library to create the function interface that is used by TeamSpeak.

Structs

Channel
ChannelGroupId
ChannelId

A wrapper for a channel id.

Connection
ConnectionId

A wrapper for a connection id.

Invoker

A struct for convenience. The invoker is maybe not visible to the user, but we can get events caused by him, so some information about him are passed along with his id.

OptionalChannelData

Channel properties that have to be fetched explicitely

OptionalConnectionData
OptionalServerData

Server properties that have to be fetched explicitely

OutdatedServerData

Server properties that are available at the start but not updated

OwnConnectionData
PermissionId
Permissions

Permissions - TODO not yet implemented

Server
ServerGroupId
ServerId

A wrapper for a server id.

ServerqueryConnectionData
Ts3Functions

Functions exported to plugin from main binary

TsApi

The main struct that contains all permanently save data.

Enums

Error
MessageReceiver

The possible receivers of a message. A message can be sent to a specific connection, to the current channel chat or to the server chat.