public Ts3Full(Ts3FullClientData tfcd) : base(ClientType.Full) { tsFullClient = (Ts3FullClient)tsBaseClient; ts3FullClientData = tfcd; tfcd.PropertyChanged += Tfcd_PropertyChanged; ffmpegProducer = new FfmpegProducer(tfcd); stallCheckPipe = new StallCheckPipe(); volumePipe = new VolumePipe(); encoderPipe = new EncoderPipe(SendCodec) { Bitrate = ts3FullClientData.AudioBitrate * 1000 }; timePipe = new PreciseTimedPipe { ReadBufferSize = encoderPipe.PacketSize }; timePipe.Initialize(encoderPipe); TargetPipe = new CustomTargetPipe(tsFullClient); timePipe.InStream = ffmpegProducer; timePipe.Chain <ActiveCheckPipe>().Chain(stallCheckPipe).Chain(volumePipe).Chain(encoderPipe).Chain(TargetPipe); identity = null; }
public void Initialize(MainBot mainBot) { bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); lib.OnConnected += Lib_OnConnected; Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public static void SetAllChannelGroup(Ts3FullClient cli, ChannelGroupIdT cgid, ClientDbIdT cldbid, List <ChannelIdT> cids) { foreach (var cid in cids) { SetClientChannelGroup(cli, cgid, cid, cldbid); } }
public CustomTargetPipe(Ts3FullClient client) { this.client = client; Util.Init(out channelSubscriptionsSetup); Util.Init(out clientSubscriptionsSetup); subscriptionSetupChanged = true; }
static void Main() { //Ts3Crypt.Test(); //return; var clients = new List <Ts3FullClient>(); //for (int i = 0; i < 50; i++) { var client = new Ts3FullClient(EventDispatchType.AutoThreadPooled); client.OnConnected += Client_OnConnected; client.OnDisconnected += Client_OnDisconnected; client.OnErrorEvent += Client_OnErrorEvent; client.OnTextMessageReceived += Client_OnTextMessageReceived; var data = Ts3Crypt.LoadIdentity("MCkDAgbAAgEgAiBPKKMIrHtAH/FBKchbm4iRWZybdRTk/ZiehtH0gQRg+A==", 64, 0); con = new ConnectionDataFull() { Address = "127.0.0.1", Username = "******", Identity = data, Password = "******", VersionSign = VersionSign.VER_WIN_3_1_7 }; client.Connect(con); clients.Add(client); } Console.WriteLine("End"); Console.ReadLine(); }
private static void CheckGroups(Ts3FullClient client) { var response = Clientlib.GetAllChannelGroups(client); foreach (ChannelGroupListResponse gCLR in response) { if (gCLR.type == PermissionGroupDatabaseType.Regular) { foreach (string name in admin_names) { if (gCLR.cgName.ToString().ToLower().Contains(name.ToLower())) { adminCGID = gCLR.cgID; continue; } } foreach (string name in mod_names) { if (gCLR.cgName.ToString().ToLower().Contains(name.ToLower())) { modCGID = gCLR.cgID; continue; } } foreach (string name in banned_names) { if (gCLR.cgName.ToString().ToLower().Contains(name.ToLower())) { banCGID = gCLR.cgID; continue; } } } } }
public Context(bool UseChat) { useTs = UseChat; if (useTs) { client = Resources.client; } }
public void Initialize(MainBot mainBot) { //bot = mainBot.Bots.GetBot(0); bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); bot.PlayManager.AfterResourceStarted += PlayManager_AfterResourceStarted; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public void Initialize(MainBot mainBot) { bot = mainBot; lib = bot.QueryConnection.GetLowLibrary <Ts3FullClient>(); mainBot.RightsManager.RegisterRights("PMRedirect.isowner"); lib.OnTextMessageReceived += Lib_OnTextMessageReceived; Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public void Initialize(Core mainBot) { bot = mainBot.Bots.GetBot(0); lib = bot.QueryConnection.GetLowLibrary <Ts3FullClient>(); mainBot.RightsManager.RegisterRights("TestPlugin.dummyperm"); //lib.OnErrorEvent() PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public CommandHandler() { client = new Ts3FullClient(EventDispatchType.DoubleThread); CommandHelper.client = client; Player.client = client; TsEventHandler.StartEventHandler(client); MusicPlayer.Init(client); Resources.client = client; }
public void Initialize(MainBot mainBot) { bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); lib.OnClientMoved += Lib_OnClientMoved; lib.OnConnected += Lib_OnConnected; Timer = TickPool.RegisterTick(Tick, TimeSpan.FromSeconds(1), false); Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public void Initialize(MainBot mainBot) { bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); //var PluginPath = Directory.GetCurrentDirectory(); //Directory.CreateDirectory(Path.Combine(PluginPath, "ClientQuery")); PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); StartTelnetServer(IPAddress.Parse(Settings.Default.HostAddress), Settings.Default.Port); }
public Client() { client = new Ts3FullClient(EventDispatchType.AutoThreadPooled); client.QuitMessage = "Teamspeak 3 Slim"; client.OnConnected += Client_OnConnected; client.OnDisconnected += Client_OnDisconnected; client.OnErrorEvent += Client_OnErrorEvent; client.OnTextMessageReceived += Client_OnTextMessageReceived; client.OnClientEnterView += Client_OnClientEnterView; client.OnClientLeftView += Client_OnClientLeftView; }
public static void StartEventHandler(Ts3FullClient clien) { client = clien; client.OnConnected += Client_OnConnected; client.OnClientEnterView += Client_OnClientEnterView; client.OnClientLeftView += Client_OnClientLeftView; client.OnTextMessageReceived += Client_OnTextMessageReceived; client.OnClientMoved += Client_OnClientMoved; client.OnErrorEvent += Client_OnErrorEvent; }
public void Initialize(MainBot mainBot) { bot = mainBot; mainBot.RightsManager.RegisterRights("TestPlugin.dummyperm"); lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); mainBot.QueryConnection.OnClientConnect += QueryConnection_OnClientConnect; mainBot.QueryConnection.OnClientDisconnect += QueryConnection_OnClientDisconnect; mainBot.QueryConnection.OnMessageReceived += QueryConnection_OnMessageReceived; mainBot.PlayManager.AfterResourceStarted += PlayManager_AfterResourceStarted; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
private static void InitTS() { var identityData = Ts3Crypt.DeobfuscateAndImportTs3Identity(config.Secret.TSIdentity); if (!string.IsNullOrEmpty(identityData.Error)) { Console.WriteLine(identityData.Error); } else { connectionData = new ConnectionDataFull() { Identity = identityData.Unwrap() }; if (!string.IsNullOrEmpty(config.Secret.TSAddress)) { connectionData.Address = config.Secret.TSAddress; } if (!string.IsNullOrEmpty(config.Secret.TSServerPassword)) { connectionData.ServerPassword = config.Secret.TSServerPassword; } if (!string.IsNullOrEmpty(config.Secret.TSUsername)) { connectionData.Username = config.Secret.TSUsername; } if (!string.IsNullOrEmpty(config.Secret.TSDefaultChannel)) { connectionData.DefaultChannel = config.Secret.TSDefaultChannel; } if (!string.IsNullOrEmpty(config.Secret.TSDefaultChannelPassword)) { connectionData.DefaultChannelPassword = config.Secret.TSDefaultChannelPassword; } client = new Ts3FullClient(EventDispatchType.AutoThreadPooled); client.OnConnected += client_OnConnected; client.OnDisconnected += client_OnDisconnected; client.OnErrorEvent += client_OnErrorEvent; client.OnEachTextMessage += client_OnEachTextMessage; client.OnClientEnterView += Client_OnClientEnterView; client.OnEachClientMoved += Client_OnEachClientMoved; client.Connect(connectionData); } }
public Context(TextMessage Message, Ts3FullClient client) { if (Message != null && client != null) { this.client = client; useTs = true; if (Message.Target == TextMessageTargetMode.Private) { usePrivate = true; sender = client.ClientList().Where((o) => Message.InvokerId == o.ClientId).FirstOrDefault(); } } }
public static IEnumerable <ResponseDictionary> SetClientChannelGroup(Ts3FullClient cli, ChannelGroupIdT cgid, ChannelIdT cid, ClientDbIdT cldbid) { Console.WriteLine($"Trying to set channelgroup {cgid} for client {cldbid} in channel {cid}"); try { return(cli.Send("setclientchannelgroup", new CommandParameter("cgid", cgid), new CommandParameter("cid", cid), new CommandParameter("cldbid", cldbid) )); } catch { return(null); } }
public void Initialize(MainBot mainBot) { bot = mainBot; //var pluginPath = mainBot.ConfigManager.GetDataStruct<PluginManagerData>("PluginManager", true).PluginPath; var pluginPath = "Plugins"; cfgfile = Path.Combine(pluginPath, $"{PluginInfo.Name}.cfg"); try { if (File.Exists(cfgfile)) { var parser = new FileIniDataParser(); cfg = parser.ReadFile(cfgfile); PluginLog(Log.Level.Debug, $"cfgfile = {cfgfile}"); if (cfg["Ignore"]["uids"].Contains(',')) { whitelistUID = cfg["Ignore"]["uids"].Split(',').ToList(); } else { whitelistUID.Add(cfg["Ignore"]["uids"]); } if (cfg["Ignore"]["sgids"].Contains(',')) { var _whitelistSGID = cfg["Ignore"]["sgids"].Split(','); foreach (var wsgid in _whitelistSGID) { whitelistSGID.Add(ServerGroupIdT.Parse(wsgid)); } } else { whitelistSGID.Add(ServerGroupIdT.Parse(cfg["Ignore"]["sgids"])); } } } catch (Exception ex) { throw new Exception($"{PluginInfo.Name} Can't load \"{cfgfile}\"! Error:\n{ex}"); cfg = new IniData(); //while (!Setup()) { } } ispfile = Path.Combine(pluginPath, "ISPs.txt"); PluginLog(Log.Level.Debug, $"ispfile = {ispfile}"); if (File.Exists(ispfile)) { isps = File.ReadAllLines(ispfile).ToList(); } lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); lib.OnClientEnterView += Lib_OnClientEnterView; lib.OnConnected += Lib_OnConnected; ClearCache = TickPool.RegisterTick(Tick, TimeSpan.FromMinutes(UInt64.Parse(cfg["General"]["clearcache"])), false); Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
static void Main() { var client = new Ts3FullClient(EventDispatchType.ExtraDispatchThread); client.OnConnected += Client_OnConnected; client.OnDisconnected += Client_OnDisconnected; client.OnErrorEvent += Client_OnErrorEvent; client.OnTextMessageReceived += Client_OnTextMessageReceived; var data = Ts3Crypt.LoadIdentity("MG8DAgeAAgEgAiEAqNonGuL0w/8kLlgLbl4UkH8DQQJ7fEu1tLt+mx1E+XkCIQDgQoIGcBVvAvNoiDT37iWbPQb2kYe0+VKLg67OH2eQQwIgTyijCKx7QB/xQSnIW5uIkVmcm3UU5P2YnobR9IEEYPg=", 64, 0); con = new ConnectionDataFull() { Hostname = "127.0.0.1", Port = 9987, Username = "******", Identity = data, Password = "******" }; client.Connect(con); Console.WriteLine("End"); Console.ReadLine(); }
public static IOrderedEnumerable <ClientInfo> ListUsers(this Ts3FullClient client) { var clientList = client.ClientList(); if (clientList.Ok) { return(clientList .Unwrap() .Where(x => x.ClientType != ClientType.Query) .Select(x => client.ClientInfo(x.ClientId)) .Where(x => x.Ok) .Select(x => x.Unwrap()) .OrderBy(x => x.ChannelId)); } else { return(Enumerable.Empty <ClientInfo>() .OrderBy(x => x)); } }
public Ts3Full(Ts3FullClientData tfcd) : base(ClientType.Full) { tsFullClient = (Ts3FullClient)tsBaseClient; ts3FullClientData = tfcd; tfcd.PropertyChanged += Tfcd_PropertyChanged; sendTick = TickPool.RegisterTick(AudioSend, sendCheckInterval, false); encoder = new AudioEncoder(SendCodec) { Bitrate = ts3FullClientData.AudioBitrate * 1000 }; audioTimer = new PreciseAudioTimer(encoder.SampleRate, encoder.BitsPerSample, encoder.Channels); isStall = false; stallCount = 0; identity = null; Util.Init(ref channelSubscriptionsSetup); Util.Init(ref clientSubscriptionsSetup); subscriptionSetupChanged = true; }
public static ChannelCreated ChannelCreate(Ts3FullClient cli, string name, string password, string neededTP, string phoname) { var cmd = new Ts3Command("channelcreate", new List <ICommandPart>() { new CommandParameter("channel_name", name), new CommandParameter("channel_password", Ts3Crypt.HashPassword(password)), new CommandParameter("channel_needed_talk_power", neededTP), new CommandParameter("channel_name_phonetic", phoname) }); var createdchan = cli.SendSpecialCommand(cmd, NotificationType.ChannelCreated).Notifications.Cast <ChannelCreated>(); foreach (var chan in createdchan) { Console.WriteLine("#{0} CID: {1} CNAME: {2}", cli.ClientId, chan.ChannelId, chan.Name); if (chan.Name == name) { return(chan); } } return(null); }
public void Initialize(MainBot mainBot) { var dbpath = Path.Combine(Directory.GetCurrentDirectory(), "RegistriertChannel.db"); var firstStart = File.Exists(dbpath); if (firstStart) { SQLiteConnection.CreateFile(dbpath); } db = new SQLiteConnection("Data Source=" + dbpath + ";Version=3;"); db.Open(); if (firstStart) { new SQLiteCommand("create table optout (uid varchar(28))", db).ExecuteNonQuery(); } bot = mainBot; lib = mainBot.QueryConnection.GetLowLibrary <Ts3FullClient>(); lib.OnClientMoved += Lib_OnClientMoved; lib.OnTextMessageReceived += Lib_OnTextMessageReceived; Enabled = true; PluginLog(Log.Level.Debug, "Plugin " + PluginInfo.Name + " v" + PluginInfo.Version + " by " + PluginInfo.Author + " loaded."); }
public Ts3Client(ConfBot config, Ts3FullClient tsFullClient, Id id) { this.id = id; Util.Init(out clientDbNames); Util.Init(out clientbuffer); dbIdCache = new LruCache <string, ulong>(1024); this.tsFullClient = tsFullClient; tsFullClient.OnEachTextMessage += ExtendedTextMessage; tsFullClient.OnErrorEvent += TsFullClient_OnErrorEvent; tsFullClient.OnConnected += TsFullClient_OnConnected; tsFullClient.OnDisconnected += TsFullClient_OnDisconnected; int ScaleBitrate(int value) => Util.Clamp(value, 1, 255) * 1000; this.config = config; this.config.Audio.Bitrate.Changed += (s, e) => encoderPipe.Bitrate = ScaleBitrate(e.NewValue); ffmpegProducer = new FfmpegProducer(config.GetParent().Tools.Ffmpeg, id); stallCheckPipe = new StallCheckPipe(); volumePipe = new VolumePipe(); Volume = config.Audio.Volume.Default; encoderPipe = new EncoderPipe(SendCodec) { Bitrate = ScaleBitrate(config.Audio.Bitrate) }; timePipe = new PreciseTimedPipe { ReadBufferSize = encoderPipe.PacketSize }; timePipe.Initialize(encoderPipe, id); TargetPipe = new CustomTargetPipe(tsFullClient); mergePipe = new PassiveMergePipe(); mergePipe.Add(ffmpegProducer); mergePipe.Into(timePipe).Chain <CheckActivePipe>().Chain(stallCheckPipe).Chain(volumePipe).Chain(encoderPipe).Chain(TargetPipe); identity = null; }
public Ts3Client(ConfBot config) { Util.Init(out clientDbNames); Util.Init(out clientbuffer); TsFullClient = new Ts3FullClient(EventDispatchType.DoubleThread); TsFullClient.OnClientLeftView += ExtendedClientLeftView; TsFullClient.OnClientEnterView += ExtendedClientEnterView; TsFullClient.OnTextMessage += ExtendedTextMessage; TsFullClient.OnErrorEvent += TsFullClient_OnErrorEvent; TsFullClient.OnConnected += TsFullClient_OnConnected; TsFullClient.OnDisconnected += TsFullClient_OnDisconnected; int ScaleBitrate(int value) => Math.Min(Math.Max(1, value), 255) * 1000; this.config = config; this.config.Audio.Bitrate.Changed += (s, e) => encoderPipe.Bitrate = ScaleBitrate(e.NewValue); ffmpegProducer = new FfmpegProducer(config.GetParent().Tools.Ffmpeg); stallCheckPipe = new StallCheckPipe(); volumePipe = new VolumePipe(); Volume = config.Audio.Volume.Default; encoderPipe = new EncoderPipe(SendCodec) { Bitrate = ScaleBitrate(config.Audio.Bitrate) }; timePipe = new PreciseTimedPipe { ReadBufferSize = encoderPipe.PacketSize }; timePipe.Initialize(encoderPipe); TargetPipe = new CustomTargetPipe(TsFullClient); mergePipe = new PassiveMergePipe(); mergePipe.Add(ffmpegProducer); mergePipe.Into(timePipe).Chain <CheckActivePipe>().Chain(stallCheckPipe).Chain(volumePipe).Chain(encoderPipe).Chain(TargetPipe); identity = null; }
static void Main3(string[] args) { // Initialize client var client = new Ts3FullClient(EventDispatchType.AutoThreadPooled); var data = Ts3Crypt.LoadIdentity("MCkDAgbAAgEgAiBPKKMIrHtAH/FBKchbm4iRWZybdRTk/ZiehtH0gQRg+A==", 64, 0).Unwrap(); //var data = Ts3Crypt.GenerateNewIdentity(); con = new ConnectionDataFull() { Address = "pow.splamy.de", Username = "******", Identity = data }; // Setup audio client // Save cpu by not processing the rest of the pipe when the // output is not read. .Chain <CheckActivePipe>() // This reads the packet meta data, checks for packet order // and manages packet merging. .Chain <AudioPacketReader>() // Teamspeak sends audio encoded. This pipe will decode it to // simple PCM. .Chain <DecoderPipe>() // This will merge multiple clients talking into one audio stream .Chain <ClientMixdown>() // Reads from the ClientMixdown buffer with a fixed timing .Into <PreciseTimedPipe>(x => x.Initialize(new SampleInfo(48_000, 2, 16))) // Reencode to the codec of our choice .Chain(new EncoderPipe(Codec.OpusMusic)) // Define where to send to. .Chain <StaticMetaPipe>(x => x.SetVoice()) // Send it with our client. .Chain(client); // Connect client.Connect(con); }
public static ChannelIdT GetMyChannelID(Ts3FullClient sender) { WhoAmI data = sender.WhoAmI(); return(data.ChannelId); }
public static ClientUidT ClientGetUidFromClid(Ts3FullClient cli, ClientIdT clid) { return(cli.Send("clientgetuidfromclid", new CommandParameter("clid", clid)).FirstOrDefault()["cluid"].Replace("\\", "")); }