📄 tsremoteimport.pas
字号:
unit TsRemoteImport;
interface
{$ifdef mswindows}
Const LibName= 'TSRemote.dll';
{$endif}
{$ifdef LINUX}
Const LibName= 'libTSRemote.so.0.2';
{$endif}
const
cCodecCelp51 = 0;
cCodecCelp63 = 1;
cCodecGSM148 = 2;
cCodecGSM164 = 3;
cCodecWindowsCELP52 = 4;
//codec masks
cmCelp51 = 1 shl cCodecCelp51;
cmCelp63 = 1 shl cCodecCelp63;
cmGSM148 = 1 shl cCodecGSM148;
cmGSM164 = 1 shl cCodecGSM164;
cmWindowsCELP52 = 1 shl cCodecWindowsCELP52;
//PlayerChannelPrivileges
pcpAdmin = 1 shl 0;
pcpOperator = 1 shl 1;
pcpAutoOperator = 1 shl 2;
pcpVoiced = 1 shl 3;
pcpAutoVoice = 1 shl 4;
//PlayerPrivileges
ppSuperServerAdmin = 1 shl 0;
ppServerAdmin = 1 shl 1;
ppCanRegister = 1 shl 2;
ppRegistered = 1 shl 3;
ppUnregistered = 1 shl 4;
//player flags
pfChannelCommander = 1 shl 0;
pfWantVoice = 1 shl 1;
pfNoWhisper = 1 shl 2;
pfAway = 1 shl 3;
pfInputMuted = 1 shl 4;
pfOutputMuted = 1 shl 5;
pfRecording = 1 shl 6;
//channel flags
cfRegistered = 1 shl 0;
cfUnregistered = 1 shl 1;
cfModerated = 1 shl 2;
cfPassword = 1 shl 3;
cfHierarchical = 1 shl 4;
cfDefault = 1 shl 5;
//ServerType Flags
stClan = 1 shl 0;
stPublic = 1 shl 1;
stFreeware = 1 shl 2;
stCommercial = 1 shl 3;
grRevoke = 0;
grGrant = 1;
Type
PtsrPlayerInfo = ^TtsrPlayerInfo;
TtsrPlayerInfo = packed record
PlayerID : Integer;
ChannelID : Integer;
NickName : Array [0..29] of Char;
PlayerChannelPrivileges : Integer;
PlayerPrivileges : Integer;
PlayerFlags : Integer;
end;
PtsrChannelInfo = ^TtsrChannelInfo;
TtsrChannelInfo = packed record
ChannelID : Integer;
ChannelParentID : Integer;
PlayerCountInChannel : Integer;
ChannelFlags : Integer;
Codec : Integer;
Name : Array [0..29] of Char;
end;
PtsrVersion = ^TtsrVersion;
TtsrVersion = packed record
Major : Integer;
Minor : Integer;
Release : Integer;
Build : Integer;
end;
PtsrServerInfo = ^TtsrServerInfo;
TtsrServerInfo = packed record
ServerName : Array [0..29] of Char;
WelcomeMessage : Array [0..255] of Char;
ServerVMajor : Integer;
ServerVMinor : Integer;
ServerVRelease : Integer;
ServerVBuild : Integer;
ServerPlatform : Array [0..29] of Char;
ServerIp : Array [0..29] of Char;
ServerHost : Array [0..99] of Char;
ServerType : Integer;
ServerMaxUsers : Integer;
SupportedCodecs : Integer;
ChannelCount : Integer;
PlayerCount : Integer;
end;
PtsrUserInfo = ^TtsrUserInfo;
TtsrUserInfo = packed record
Player : TtsrPlayerInfo;
Channel : TtsrChannelInfo;
ParentChannel : TtsrChannelInfo;
end;
//##############################################################################
//#
//# Function InitTsRemoteLibrary(TryLocal: Boolean): Integer;
//#
//# Description:
//# Loads and binds the TSRemote library
//#
//# Input:
//# TryLocal: if true, it will try to load the library from the same dir
//# as the program location. If that fails it will fall back to
//# the default locations.
//#
//# Output:
//# Result: (0=ok, -1= library already initialized,
//# -2=error loading library
//# -3=error during binding functions
//#
//##############################################################################
Function InitTsRemoteLibrary(TryLocal: Boolean): Integer;
//##############################################################################
//#
//# Function CloseTsRemoteLibrary: integer
//#
//# Description:
//# Frees the hawkvoice library loaded by InitTsRemoteLibrary
//#
//# Input:
//# None
//#
//# Output:
//# Result: (0=ok, -1= library not initialized, -2=error during FreeLibrary
//#
//##############################################################################
Function CloseTsRemoteLibrary: Integer;
//##############################################################################
//#
//# Procedure tsrGetLastError(pchBuffer : PChar; BufferLength: Integer)
//#
//# Description:
//# Get the full error message that was send with the last error
//#
//# Input:
//# pchBuffer: A pointer to a nulterminated string where the error message
//# will be copied to.
//# BufferLength: The size of pchBuffer
//#
//# Output:
//# None
//#
//##############################################################################
type TtsrGetLastError = Procedure (pchBuffer : PChar; BufferLength: Integer);{$ifdef linux}cdecl;{$endif}{$ifdef mswindows}stdcall;{$endif}
var tsrGetLastError : TtsrGetLastError;
const fn_tsrGetLastError='tsrGetLastError';
//##############################################################################
//#
//# Function tsrConnect(URL :Pchar): integer
//#
//# Description:
//# Connect the ts to a new server as described in the URL. Will disconnect
//# if the client is currently connected. The Url is the same format as the
//# normal starup link ("teamspeak://voice.teamspeak.org:9500" etc)
//#
//# Input:
//# URL: A pointer to a null terminated string containing the url for the
//# server.
//#
//# Output:
//# Result: 0 = OK, else the error number
//#
//##############################################################################
type TtsrConnect = Function (URL :Pchar): Integer;{$ifdef linux}cdecl;{$endif}{$ifdef mswindows}stdcall;{$endif}
var tsrConnect : TtsrConnect;
const fn_tsrConnect='tsrConnect';
//##############################################################################
//#
//# Function tsrDisconnect: integer
//#
//# Description:
//# Disconnects the client from the current server.
//#
//# Input:
//# None
//#
//# Output:
//# Result: 0 = OK, else the error number
//#
//##############################################################################
type TtsrDisconnect = Function: Integer;{$ifdef linux}cdecl;{$endif}{$ifdef mswindows}stdcall;{$endif}
var tsrDisconnect : TtsrDisconnect;
const fn_tsrDisconnect='tsrDisconnect';
//##############################################################################
//#
//# Function tsrQuit: integer
//#
//# Description:
//# Disconnect, Close and terminate the client.
//#
//# Input:
//# None
//#
//# Output:
//# Result: 0 = OK, else the error number
//#
//##############################################################################
type TtsrQuit = Function: Integer;{$ifdef linux}cdecl;{$endif}{$ifdef mswindows}stdcall;{$endif}
var tsrQuit : TtsrQuit;
const fn_tsrQuit='tsrQuit';
//##############################################################################
//#
//# Function tsrSwitchChannelName( ChannelName: PChar;
//# ChannelPassword: PChar): Integer;
//#
//# Description:
//# Switch to the channel with the name "Channelname"
//# Not that tsrSwitchChannelID is preferred.
//#
//# Input:
//# ChannelName: Name of the channel to switch to
//# ChannelPassword: Password for the channel. May be nil
//#
//# Output:
//# Result: 0 = OK, else the error number
//#
//##############################################################################
type TtsrSwitchChannelName = Function( ChannelName: Pchar;
ChannelPassword: PChar): Integer;
{$ifdef linux}cdecl;{$endif}{$ifdef mswindows}stdcall;{$endif}
var tsrSwitchChannelName : TtsrSwitchChannelName;
const fn_tsrSwitchChannelName='tsrSwitchChannelName';
//##############################################################################
//#
//# Function tsrSwitchChannelID( ChannelID : Integer;
//# ChannelPassword: PChar): Integer;
//#
//# Description:
//# Switch to the channel with the id "channelID"
//#
//# Input:
//# ChannelID : ID of the channel to switch to
//# ChannelPassword: Password for the channel. May be nil
//#
//# Output:
//# Result: 0 = OK, else the error number
//#
//##############################################################################
type TtsrSwitchChannelID = Function( ChannelID: Integer;
ChannelPassword: PChar): Integer;
{$ifdef linux}cdecl;{$endif}{$ifdef mswindows}stdcall;{$endif}
var tsrSwitchChannelID : TtsrSwitchChannelID;
const fn_tsrSwitchChannelID='tsrSwitchChannelID';
//##############################################################################
//#
//# Function tsrGetVersion( tsrVersion: PtsrVersion ): Integer;
//#
//# Description:
//# Get the version of the ts client
//#
//# Input:
//# Pointer to a TtsrVersion record
//#
//# Output:
//# Result: 0 = OK, else the error number
//# if result = 0 then tsrVersion is filled with the client version
//#
//##############################################################################
type TtsrGetVersion = Function( tsrVersion: PtsrVersion ): Integer;
{$ifdef linux}cdecl;{$endif}{$ifdef mswindows}stdcall;{$endif}
var tsrGetVersion : TtsrGetVersion;
const fn_tsrGetVersion='tsrGetVersion';
//##############################################################################
//#
//# Function TtsrGetServerInfo( tsrServerInfo: PtsrServerInfo ): Integer;
//#
//# Description:
//# Get the Info on the server (name, channelcount, playercount etc etc)
//#
//# Input:
//# Pointer to a TtsrServerInfo record
//#
//# Output:
//# Result: 0 = OK, else the error number
//# if result = 0 then tsrServerInfo is filled with the server info
//#
//##############################################################################
type TtsrGetServerInfo = Function ( tsrServerInfo: PtsrServerInfo ): Integer;
{$ifdef linux}cdecl;{$endif} {$ifdef mswindows}stdcall;{$endif}
var tsrGetServerInfo : TtsrGetServerInfo;
Const fn_tsrGetServerInfo='tsrGetServerInfo';
//##############################################################################
//#
//# Function tsrGetUserInfo( tsrUserInfo: PtsrUserInfo ): Integer;
//#
//# Description:
//# Get the Info on the user (name, channel, flags etc etc)
//#
//# Input:
//# Pointer to a TtsrUserInfo record
//#
//# Output:
//# Result: 0 = OK, else the error number
//# if result = 0 then tsrUserInfo is filled with the user info
//#
//##############################################################################
type TtsrGetUserInfo = Function ( tsrUserInfo: PtsrUserInfo ): Integer;
{$ifdef linux}cdecl;{$endif} {$ifdef mswindows}stdcall;{$endif}
var tsrGetUserInfo : TtsrGetUserInfo;
Const fn_tsrGetUserInfo='tsrGetUserInfo';
//##############################################################################
//#
//# Function tsrGetChannelInfoByID( ChannelID: Integer;
//# tsrChannelInfo: PtsrChannelInfo;
//# tsrPlayerInfo : PtsrPlayerInfo; PlayerRecords : PInteger) : integer;
//#
//# Description:
//# Get the Info on the channel specified by ChannelID and optionally also
//# get the users from that channel
//#
//# Input:
//# ChannelID: The ID of the channel you want the info from
//# tsrChannelInfo: pointer to a TtsrChannelInfo record;
//# tsrPlayerInfo: This is the pointer to an array of TtsrPlayerInfo records
//# If it is NIL, no player records will be retrieved
//# PlayerRecords: Pointer to an integer. It must contain how many records
//# tsrPlayerInfo has room for. (records, not bytes)
//#
//# Output:
//# Result: 0 = OK, else the error number
//# if result = 0 then tsrChannelInfo is filled with the channel info.
//# If tsrPlayerInfo was not NIL then the player records are
//# filled. PlayerRecords indicates how many records were filled
//#
//##############################################################################
type TtsrGetChannelInfoByID = Function ( ChannelID: Integer; tsrChannelInfo: PtsrChannelInfo;
tsrPlayerInfo : PtsrPlayerInfo; PlayerRecords : PInteger) : integer;
{$ifdef linux}cdecl;{$endif} {$ifdef mswindows}stdcall;{$endif}
var tsrGetChannelInfoByID : TtsrGetChannelInfoByID;
Const fn_tsrGetChannelInfoByID='tsrGetChannelInfoByID';
//##############################################################################
//#
//# Function tsrGetChannelInfoByName( ChannelName: PChar;
//# tsrChannelInfo: PtsrChannelInfo;
//# tsrPlayerInfo : PtsrPlayerInfo; PlayerRecords : PInteger) : integer;
//#
//# Description:
//# Get the Info on the channel specified by ChannelName and optionally also
//# get the users from that channel
//#
//# Input:
//# ChannelName: The Name of the channel you want the info from
//# tsrChannelInfo: pointer to a TtsrChannelInfo record;
//# tsrPlayerInfo: This is the pointer to an array of TtsrPlayerInfo records
//# If it is NIL, no player records will be retrieved
//# PlayerRecords: Pointer to an integer. It must contain how many records
//# tsrPlayerInfo has room for. (records, not bytes)
//#
//# Output:
//# Result: 0 = OK, else the error number
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -