Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin: 'static + Send {
Show 47 methods // Required method fn new(api: &TsApi) -> Result<Box<Self>, InitError> where Self: Sized; // Provided methods fn name() -> String where Self: Sized { ... } fn version() -> String where Self: Sized { ... } fn author() -> String where Self: Sized { ... } fn description() -> String where Self: Sized { ... } fn command() -> Option<String> where Self: Sized { ... } fn configurable() -> ConfigureOffer where Self: Sized { ... } fn autoload() -> bool where Self: Sized { ... } fn connect_status_change( &mut self, api: &TsApi, server: &Server<'_>, status: ConnectStatus, error: Error, ) { ... } fn configure(&mut self, api: &TsApi) { ... } fn server_stop(&mut self, api: &TsApi, server: &Server<'_>, message: String) { ... } fn server_error( &mut self, api: &TsApi, server: &Server<'_>, error: Error, message: String, return_code: String, extra_message: String, ) -> bool { ... } fn server_edited( &mut self, api: &TsApi, server: &Server<'_>, invoker: Option<&Invoker<'_>>, ) { ... } fn server_connection_info(&mut self, api: &TsApi, server: &Server<'_>) { ... } fn connection_info( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, ) { ... } fn connection_properties_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, old_connection: &Connection<'_>, changes: ConnectionChanges<'_>, invoker: &Invoker<'_>, ) { ... } fn connection_announced( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, appeared: bool, ) { ... } fn connection_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, connected: bool, message: String, ) { ... } fn connection_move( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, old_channel: &Channel<'_>, new_channel: &Channel<'_>, visibility: Visibility, ) { ... } fn connection_moved( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, old_channel: &Channel<'_>, new_channel: &Channel<'_>, visibility: Visibility, invoker: &Invoker<'_>, ) { ... } fn connection_timeout( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, ) { ... } fn channel_announced( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, ) { ... } fn channel_description_updated( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, ) { ... } fn channel_updated( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, old_channel: &Channel<'_>, ) { ... } fn channel_created( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, invoker: Option<&Invoker<'_>>, ) { ... } fn channel_deleted( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, invoker: Option<&Invoker<'_>>, ) { ... } fn channel_edited( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, old_channel: &Channel<'_>, invoker: &Invoker<'_>, ) { ... } fn channel_password_updated( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, ) { ... } fn channel_moved( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, new_parent_channel: &Channel<'_>, invoker: Option<&Invoker<'_>>, ) { ... } fn message( &mut self, api: &TsApi, server: &Server<'_>, invoker: &Invoker<'_>, target: MessageReceiver, message: String, ignored: bool, ) -> bool { ... } fn poke( &mut self, api: &TsApi, server: &Server<'_>, invoker: &Invoker<'_>, message: String, ignored: bool, ) -> bool { ... } fn channel_kick( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, old_channel: &Channel<'_>, new_channel: &Channel<'_>, visibility: Visibility, invoker: &Invoker<'_>, message: String, ) { ... } fn server_kick( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, invoker: &Invoker<'_>, message: String, ) { ... } fn server_ban( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, invoker: &Invoker<'_>, message: String, time: u64, ) { ... } fn talking_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, talking: TalkStatus, whispering: bool, ) { ... } fn avatar_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, path: Option<String>, ) { ... } fn connection_channel_group_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, channel_group: &ChannelGroup, channel: &Channel<'_>, invoker: &Invoker<'_>, ) { ... } fn connection_server_group_added( &mut self, api: &TsApi, server: &Server<'_>, connection: &Invoker<'_>, server_group: &ServerGroup, invoker: &Invoker<'_>, ) { ... } fn connection_server_group_removed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Invoker<'_>, server_group: &ServerGroup, invoker: &Invoker<'_>, ) { ... } fn playback_voice_data( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, samples: &mut [i16], channels: i32, ) { ... } fn post_process_voice_data( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, samples: &mut [i16], channels: i32, channel_speaker_array: &[Speaker], channel_fill_mask: &mut u32, ) { ... } fn mixed_playback_voice_data( &mut self, api: &TsApi, server: &Server<'_>, samples: &mut [i16], channels: i32, channel_speaker_array: &[Speaker], channel_fill_mask: &mut u32, ) { ... } fn captured_voice_data( &mut self, api: &TsApi, server: &Server<'_>, samples: &mut [i16], channels: i32, send: &mut bool, ) -> bool { ... } fn permission_error( &mut self, api: &TsApi, server: &Server<'_>, permission: &Permission, error: Error, message: String, return_code: String, ) -> bool { ... } fn plugin_message( &mut self, api: &TsApi, server: &Server<'_>, plugin: String, message: String, invoker: Option<&Invoker<'_>>, ) { ... } fn process_command( &mut self, api: &TsApi, server: &Server<'_>, command: String, ) -> bool { ... } fn shutdown(&mut self, api: &TsApi) { ... }
}
Expand description

This trait that has to be implemented by a plugin. To enhance a library to a working TeamSpeak plugin you have to call the macro create_plugin! afterwards.

Required Methods§

Source

fn new(api: &TsApi) -> Result<Box<Self>, InitError>
where Self: Sized,

Called when the plugin is loaded by TeamSpeak.

Provided Methods§

Source

fn name() -> String
where Self: Sized,

The name of the plugin as displayed in TeamSpeak.

The default value is the crate name.

Source

fn version() -> String
where Self: Sized,

The version of the plugin as displayed in TeamSpeak.

The default value is the crate version.

Source

fn author() -> String
where Self: Sized,

The author of the plugin as displayed in TeamSpeak.

The default value is the crate author.

Source

fn description() -> String
where Self: Sized,

The description of the plugin as displayed in TeamSpeak.

The default value is the crate description.

Source

fn command() -> Option<String>
where Self: Sized,

The command prefix that can be used by users in the chat, defaults to None.

Source

fn configurable() -> ConfigureOffer
where Self: Sized,

If the plugin offers the possibility to be configured, defaults to ConfigureOffer::No.

Source

fn autoload() -> bool
where Self: Sized,

If the plugin should be loaded by default or only if activated manually, defaults to false.

Source

fn connect_status_change( &mut self, api: &TsApi, server: &Server<'_>, status: ConnectStatus, error: Error, )

If the connection status changes. If status = ConnectStatus::Connecting, the connection is not yet registered in the TsApi.

Source

fn configure(&mut self, api: &TsApi)

Callback for when the settings menu in TS3 is pressed

Source

fn server_stop(&mut self, api: &TsApi, server: &Server<'_>, message: String)

Called if a server is stopped. The server sends also a stop message.

Source

fn server_error( &mut self, api: &TsApi, server: &Server<'_>, error: Error, message: String, return_code: String, extra_message: String, ) -> bool

Called if a server error occurs. Return false if the TeamSpeak client should handle the error normally or true if the client should ignore the error.

Source

fn server_edited( &mut self, api: &TsApi, server: &Server<'_>, invoker: Option<&Invoker<'_>>, )

Called if someone edited the server.

Source

fn server_connection_info(&mut self, api: &TsApi, server: &Server<'_>)

Called when the user requests the server info by middle-clicking on the server.

Source

fn connection_info( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, )

Source

fn connection_properties_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, old_connection: &Connection<'_>, changes: ConnectionChanges<'_>, invoker: &Invoker<'_>, )

Source

fn connection_announced( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, appeared: bool, )

If the plugin was informed about a new connection. If appeared is true, the connection was previously not known to the plugin, if appeared is false, the connection left the view of connection.

Source

fn connection_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, connected: bool, message: String, )

Called, if a connection connects to the server. This is also called for our own connection.

Source

fn connection_move( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, old_channel: &Channel<'_>, new_channel: &Channel<'_>, visibility: Visibility, )

Called if a connection switched the channel.

Source

fn connection_moved( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, old_channel: &Channel<'_>, new_channel: &Channel<'_>, visibility: Visibility, invoker: &Invoker<'_>, )

Called if a connection was moved by another connection.

Source

fn connection_timeout( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, )

Called when a connection times out.

Source

fn channel_announced( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, )

Called if a channel is announced to the client. This will be called for each channel when connecting to a server.

Source

fn channel_description_updated( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, )

Called if the channel description was changed.

Source

fn channel_updated( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, old_channel: &Channel<'_>, )

Called if the channel data are updated and available. This happens e.g. when the user clicked on the channel for the first time.

Source

fn channel_created( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, invoker: Option<&Invoker<'_>>, )

Called if a channel was created. The invoker is None if the server created the channel.

Source

fn channel_deleted( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, invoker: Option<&Invoker<'_>>, )

Called if a channel was deleted. The invoker is None if the server deleted the channel.

Source

fn channel_edited( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, old_channel: &Channel<'_>, invoker: &Invoker<'_>, )

Called if a channel was edited.

Source

fn channel_password_updated( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, )

Called if the channel password was updated.

Source

fn channel_moved( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, new_parent_channel: &Channel<'_>, invoker: Option<&Invoker<'_>>, )

The current parent id of the channel is the old one, the new parent id is given as a parameter.

Source

fn message( &mut self, api: &TsApi, server: &Server<'_>, invoker: &Invoker<'_>, target: MessageReceiver, message: String, ignored: bool, ) -> bool

A message was received. ignored describes, if the friend and fool system of TeamSpeak ignored the message. Return false if the TeamSpeak client should handle the message normally or true if the client should ignore the message.

Source

fn poke( &mut self, api: &TsApi, server: &Server<'_>, invoker: &Invoker<'_>, message: String, ignored: bool, ) -> bool

A user poked us. ignored describes, if the friend and fool system of TeamSpeak ignored the message. Return false if the TeamSpeak client should handle the poke normally or true if the client should ignore the poke.

Source

fn channel_kick( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, old_channel: &Channel<'_>, new_channel: &Channel<'_>, visibility: Visibility, invoker: &Invoker<'_>, message: String, )

Source

fn server_kick( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, invoker: &Invoker<'_>, message: String, )

Source

fn server_ban( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, invoker: &Invoker<'_>, message: String, time: u64, )

Source

fn talking_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, talking: TalkStatus, whispering: bool, )

The old values of talking and whispering are available from the connection. They will be updated after this functions returned.

Source

fn avatar_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, path: Option<String>, )

Called if the avatar of a client is updated. This also happens when the avatar is discovered for the first time. The avatar information are only fetched if requested, e.g. if the user clicks on a connection.

Source

fn connection_channel_group_changed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, channel_group: &ChannelGroup, channel: &Channel<'_>, invoker: &Invoker<'_>, )

Called if a channel group is assigned to a connection.

Source

fn connection_server_group_added( &mut self, api: &TsApi, server: &Server<'_>, connection: &Invoker<'_>, server_group: &ServerGroup, invoker: &Invoker<'_>, )

Called if a server group is added to a connection.

Source

fn connection_server_group_removed( &mut self, api: &TsApi, server: &Server<'_>, connection: &Invoker<'_>, server_group: &ServerGroup, invoker: &Invoker<'_>, )

Called if a server group is removed from a connection.

Source

fn playback_voice_data( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, samples: &mut [i16], channels: i32, )

Called when a voice packet from a client was received.

From the TeamSpeak documentation: The following event is called when a voice packet from a client (not own client) is decoded and about to be played over your sound device, but before it is 3D positioned and mixed with other sounds. You can use this function to alter the voice data (for example when you want to do effects on it) or to simply get voice data. The TeamSpeak client uses this function to record sessions.

The voice data is available as 16 bit with 48 KHz. The channels are packed (interleaved). The callbacks with audio data are called from another thread than the other functions.

Source

fn post_process_voice_data( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, samples: &mut [i16], channels: i32, channel_speaker_array: &[Speaker], channel_fill_mask: &mut u32, )

Called when a voice packet from a client was positioned.

From the TeamSpeak documentation: The following event is called when a voice packet from a client (not own client) is decoded and 3D positioned and about to be played over your sound device, but before it is mixed with other sounds. You can use this function to alter/get the voice data after 3D positioning.

The voice data is available as 16 bit with 48 KHz. The channels are packed (interleaved). The callbacks with audio data are called from another thread than the other functions.

Source

fn mixed_playback_voice_data( &mut self, api: &TsApi, server: &Server<'_>, samples: &mut [i16], channels: i32, channel_speaker_array: &[Speaker], channel_fill_mask: &mut u32, )

Called when all voice data were mixed.

From the TeamSpeak documentation: The following event is called when all sounds that are about to be played back for this server connection are mixed. This is the last chance to alter/get sound.

The voice data is available as 16 bit with 48 KHz. The channels are packed (interleaved). The callbacks with audio data are called from another thread than the other functions.

Source

fn captured_voice_data( &mut self, api: &TsApi, server: &Server<'_>, samples: &mut [i16], channels: i32, send: &mut bool, ) -> bool

The recorded sound from the current capture device.

send is set if the audio data will be send to the server. This attribute can be changed in this callback. The return value of this function describes if the sound data was altered. Return true if the sound was changed and false otherwise. The callbacks with audio data are called from another thread than the other functions.

Source

fn permission_error( &mut self, api: &TsApi, server: &Server<'_>, permission: &Permission, error: Error, message: String, return_code: String, ) -> bool

Return false if the TeamSpeak client should handle the error normally or true if the client should ignore the error.

Source

fn plugin_message( &mut self, api: &TsApi, server: &Server<'_>, plugin: String, message: String, invoker: Option<&Invoker<'_>>, )

Called when a message from another plugin is received.

Messages can be sent with Server::send_plugin_message. The message is called PluginCommand by TeamSpeak.

Source

fn process_command( &mut self, api: &TsApi, server: &Server<'_>, command: String, ) -> bool

Called when the user enters a command in the chat box.

Commands that are prefixed with the string, which is specified in Plugin::command, are redirected to this function. The command prefix is not contained in the given argument.

Return true if this function handled the command or false if not.

Source

fn shutdown(&mut self, api: &TsApi)

Called if the plugin is getting disabled (either by the user or if TeamSpeak is exiting).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§