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§
Provided Methods§
Sourcefn name() -> Stringwhere
Self: Sized,
fn name() -> Stringwhere
Self: Sized,
The name of the plugin as displayed in TeamSpeak.
The default value is the crate name.
Sourcefn version() -> Stringwhere
Self: Sized,
fn version() -> Stringwhere
Self: Sized,
The version of the plugin as displayed in TeamSpeak.
The default value is the crate version.
The author of the plugin as displayed in TeamSpeak.
The default value is the crate author.
Sourcefn description() -> Stringwhere
Self: Sized,
fn description() -> Stringwhere
Self: Sized,
The description of the plugin as displayed in TeamSpeak.
The default value is the crate description.
Sourcefn command() -> Option<String>where
Self: Sized,
fn command() -> Option<String>where
Self: Sized,
The command prefix that can be used by users in the chat, defaults to None.
Sourcefn configurable() -> ConfigureOfferwhere
Self: Sized,
fn configurable() -> ConfigureOfferwhere
Self: Sized,
If the plugin offers the possibility to be configured, defaults to
ConfigureOffer::No.
Sourcefn autoload() -> boolwhere
Self: Sized,
fn autoload() -> boolwhere
Self: Sized,
If the plugin should be loaded by default or only if activated manually,
defaults to false.
Sourcefn connect_status_change(
&mut self,
api: &TsApi,
server: &Server<'_>,
status: ConnectStatus,
error: Error,
)
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.
Sourcefn server_stop(&mut self, api: &TsApi, server: &Server<'_>, message: String)
fn server_stop(&mut self, api: &TsApi, server: &Server<'_>, message: String)
Called if a server is stopped. The server sends also a stop message.
Sourcefn server_error(
&mut self,
api: &TsApi,
server: &Server<'_>,
error: Error,
message: String,
return_code: String,
extra_message: String,
) -> bool
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.
Sourcefn server_edited(
&mut self,
api: &TsApi,
server: &Server<'_>,
invoker: Option<&Invoker<'_>>,
)
fn server_edited( &mut self, api: &TsApi, server: &Server<'_>, invoker: Option<&Invoker<'_>>, )
Called if someone edited the server.
Sourcefn server_connection_info(&mut self, api: &TsApi, server: &Server<'_>)
fn server_connection_info(&mut self, api: &TsApi, server: &Server<'_>)
Called when the user requests the server info by middle-clicking on the 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<'_>, )
Sourcefn connection_announced(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
appeared: bool,
)
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.
Sourcefn connection_changed(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
connected: bool,
message: String,
)
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.
Sourcefn connection_move(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
old_channel: &Channel<'_>,
new_channel: &Channel<'_>,
visibility: Visibility,
)
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.
Sourcefn connection_moved(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
old_channel: &Channel<'_>,
new_channel: &Channel<'_>,
visibility: Visibility,
invoker: &Invoker<'_>,
)
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.
Sourcefn connection_timeout(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
)
fn connection_timeout( &mut self, api: &TsApi, server: &Server<'_>, connection: &Connection<'_>, )
Called when a connection times out.
Sourcefn channel_announced(
&mut self,
api: &TsApi,
server: &Server<'_>,
channel: &Channel<'_>,
)
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.
Sourcefn channel_description_updated(
&mut self,
api: &TsApi,
server: &Server<'_>,
channel: &Channel<'_>,
)
fn channel_description_updated( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, )
Called if the channel description was changed.
Sourcefn channel_updated(
&mut self,
api: &TsApi,
server: &Server<'_>,
channel: &Channel<'_>,
old_channel: &Channel<'_>,
)
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.
Sourcefn channel_created(
&mut self,
api: &TsApi,
server: &Server<'_>,
channel: &Channel<'_>,
invoker: Option<&Invoker<'_>>,
)
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.
Sourcefn channel_deleted(
&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<'_>>, )
Called if a channel was deleted.
The invoker is None if the server deleted the channel.
Sourcefn channel_edited(
&mut self,
api: &TsApi,
server: &Server<'_>,
channel: &Channel<'_>,
old_channel: &Channel<'_>,
invoker: &Invoker<'_>,
)
fn channel_edited( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, old_channel: &Channel<'_>, invoker: &Invoker<'_>, )
Called if a channel was edited.
Sourcefn channel_password_updated(
&mut self,
api: &TsApi,
server: &Server<'_>,
channel: &Channel<'_>,
)
fn channel_password_updated( &mut self, api: &TsApi, server: &Server<'_>, channel: &Channel<'_>, )
Called if the channel password was updated.
Sourcefn channel_moved(
&mut self,
api: &TsApi,
server: &Server<'_>,
channel: &Channel<'_>,
new_parent_channel: &Channel<'_>,
invoker: Option<&Invoker<'_>>,
)
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.
Sourcefn message(
&mut self,
api: &TsApi,
server: &Server<'_>,
invoker: &Invoker<'_>,
target: MessageReceiver,
message: String,
ignored: bool,
) -> bool
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.
Sourcefn poke(
&mut self,
api: &TsApi,
server: &Server<'_>,
invoker: &Invoker<'_>,
message: String,
ignored: bool,
) -> bool
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.
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, )
Sourcefn talking_changed(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
talking: TalkStatus,
whispering: bool,
)
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.
Sourcefn avatar_changed(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
path: Option<String>,
)
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.
Sourcefn connection_channel_group_changed(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
channel_group: &ChannelGroup,
channel: &Channel<'_>,
invoker: &Invoker<'_>,
)
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.
Sourcefn connection_server_group_added(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Invoker<'_>,
server_group: &ServerGroup,
invoker: &Invoker<'_>,
)
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.
Sourcefn connection_server_group_removed(
&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<'_>, )
Called if a server group is removed from a connection.
Sourcefn playback_voice_data(
&mut self,
api: &TsApi,
server: &Server<'_>,
connection: &Connection<'_>,
samples: &mut [i16],
channels: i32,
)
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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn captured_voice_data(
&mut self,
api: &TsApi,
server: &Server<'_>,
samples: &mut [i16],
channels: i32,
send: &mut bool,
) -> bool
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.
Sourcefn permission_error(
&mut self,
api: &TsApi,
server: &Server<'_>,
permission: &Permission,
error: Error,
message: String,
return_code: String,
) -> bool
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.
Sourcefn plugin_message(
&mut self,
api: &TsApi,
server: &Server<'_>,
plugin: String,
message: String,
invoker: Option<&Invoker<'_>>,
)
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.
Sourcefn process_command(
&mut self,
api: &TsApi,
server: &Server<'_>,
command: String,
) -> bool
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".