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
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum PermissionType {
	/// Server group permission. (id1: ServerGroupId, id2: 0)

	ServerGroup,
	/// Client specific permission. (id1: ClientDbId, id2: 0)

	GlobalClient,
	/// Channel specific permission. (id1: ChannelId, id2: 0)

	Channel,
	/// Channel group permission. (id1: ChannelId, id2: ChannelGroupId)

	ChannelGroup,
	/// Channel-client specific permission. (id1: ChannelId, id2: ClientDbId)

	ChannelClient,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum TextMessageTargetMode {
	/// Maybe to all servers?

	Unknown,
	/// Send to specific client

	Client,
	/// Send to current channel

	Channel,
	/// Send to server chat

	Server,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum HostMessageMode {
	/// Dont display anything

	None,
	/// Display message inside log

	Log,
	/// Display message inside a modal dialog

	Modal,
	/// Display message inside a modal dialog and quit/close server/connection

	Modalquit,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum HostBannerMode {
	/// Do not adjust

	NoAdjust,
	/// Adjust and ignore aspect ratio

	AdjustIgnoreAspect,
	/// Adjust and keep aspect ratio

	AdjustKeepAspect,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum Codec {
	/// Mono, 16bit, 8kHz, bitrate dependent on the quality setting

	SpeexNarrowband,
	/// Mono, 16bit, 16kHz, bitrate dependent on the quality setting

	SpeexWideband,
	/// Mono, 16bit, 32kHz, bitrate dependent on the quality setting

	SpeexUltrawideband,
	/// Mono, 16bit, 48kHz, bitrate dependent on the quality setting

	CeltMono,
	/// Mono, 16bit, 48kHz, bitrate dependent on the quality setting, optimized for voice

	OpusVoice,
	/// Stereo, 16bit, 48kHz, bitrate dependent on the quality setting, optimized for music

	OpusMusic,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum CodecEncryptionMode {
	/// Voice encryption is configured per channel

	PerChannel,
	/// Voice encryption is globally off

	ForcedOff,
	/// Voice encryption is globally on

	ForcedOn,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum Reason {
	/// No reason data

	None,
	/// Has invoker

	Moved,
	/// No reason data

	Subscription,
	/// Timeout

	LostConnection,
	/// Has invoker

	KickChannel,
	/// Has invoker

	KickServer,
	/// Has invoker, bantime

	KickServerBan,

	Serverstop,

	Clientdisconnect,
	/// No reason data

	Channelupdate,
	/// Has invoker

	Channeledit,

	ClientdisconnectServerShutdown,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum GroupNamingMode {
	/// No group name is displayed.

	None,
	/// Group name is displayed before the client name.

	Before,
	/// Group name is displayed after the client name.

	After,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum GroupType {
	/// Template group (used for new virtual servers).

	Template,
	/// Regular group (used for regular clients).

	Regular,
	/// Global query group (used for server query clients).

	Query,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum LicenseType {
	/// No licence

	NoLicense,
	/// Offline/LAN license

	Offline,
	/// TeamSpeak SDK license

	Sdk,
	/// TeamSpeak SDK offline license

	SdkOffline,
	/// Non-Profit License (NPL)

	Npl,
	/// Authorised TeamSpeak Host Provider License (ATHP)

	Athp,
	/// Annual activation license (AAL)

	Aal,
	/// Default license with 32 slots

	Default,
	/// Gamer license

	Gamer,
	/// Licenses sponsored by TeamSpeak

	Sponsorship,
	/// For use inside corporates

	Commercial,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum ChannelType {
	/// Normal channel

	Permanent,
	/// Deleted when the server restarts

	SemiPermanent,
	/// Deleted when empty

	Temporary,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum TokenType {
	/// Server group token (`id1={groupId}, id2=0`)

	ServerGroup,
	/// Channel group token (`id1={groupId}, id2={channelId}`)

	ChannelGroup,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum PluginTargetMode {
	/// Send to all clients in the current channel.

	CurrentChannel,
	/// Send to all clients on the server.

	Server,
	/// Send to all given clients ids.

	Client,
	/// Send to all given clients which are subscribed to the current channel (i.e. which see the this client).

	CurrentChannelSubsribedClients,
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, FromPrimitive, Hash, PartialEq, Serialize, ToPrimitive)]
pub enum LogLevel {
	/// Everything that is really bad.

	Error = 1,
	/// Everything that might be bad.

	Warning,
	/// Output that might help find a problem.

	Debug,
	/// Informational output.

	Info,
}


bitflags! {
	/// Hints if the client has the permission to make specific actions.

	#[derive(Deserialize, Serialize)]
	pub struct ChannelPermissionHint: u64 {
		/// b_channel_join_*

		const JOIN = 1;
		/// i_channel_modify_power

		const MODIFY = 2;
		/// b_channel_delete_flag_force

		const FORCE_DELETE = 4;
		/// b_channel_delete_*

		const DELETE = 8;
		/// i_channel_subscribe_power

		const SUBSCRIBE = 16;
		/// i_channel_description_view_power

		const VIEW_DESCRIPTION = 32;
		/// i_ft_file_upload_power

		const FILE_UPLOAD = 64;
		/// i_ft_needed_file_download_power

		const FILE_DOWNLOAD = 128;
		/// i_ft_file_delete_power

		const FILE_DELETE = 256;
		/// i_ft_file_rename_power

		const FILE_RENAME = 512;
		/// i_ft_file_browse_power

		const FILE_BROWSE = 1024;
		/// i_ft_directory_create_power

		const FILE_DIRECTORY_CREATE = 2048;
		/// i_channel_permission_modify_power

		const MODIFY_PERMISSIONS = 4096;
	}
}

bitflags! {
	/// Hints if the client has the permission to make specific actions.

	#[derive(Deserialize, Serialize)]
	pub struct ClientPermissionHint: u64 {
		/// i_client_kick_from_server_power

		const KICK_SERVER = 1;
		/// i_client_kick_from_channel_power

		const KICK_CHANNEL = 2;
		/// i_client_ban_power

		const BAN = 4;
		/// i_client_move_power

		const MOVE_CLIENT = 8;
		/// i_client_private_textmessage_power

		const PRIVATE_MESSAGE = 16;
		/// i_client_poke_power

		const POKE = 32;
		/// i_client_whisper_power

		const WHISPER = 64;
		/// i_client_complain_power

		const COMPLAIN = 128;
		/// i_client_permission_modify_power

		const MODIFY_PERMISSIONS = 256;
	}
}