Ejemplo n.º 1
0
        public void ClientMoved(ClientMovedEventArgs e)
        {
            // czy klient był na obserwowanym kanale
            if (WasOnTackedChannel(e.ClientId))
            {
                LeftTrackedChannel(e.ClientId);
            }

            if (channels.ContainsKey(e.TargetChannelId))
            {
                UpdateTimers();

                log.Info($"{DateTime.Now}: Client (clid:{e.ClientId}) moved to channel (cid:{e.TargetChannelId}).");

                ChannelData ch = channels[e.TargetChannelId];

                if (ch.WasStaff)
                {
                    return;
                }

                ClientData cd = GetClientData(e.ClientId);
                if (cd == null)
                {
                    return;
                }
                ch.Join(cd);

                if (ch.NeedHelp)
                {
                    InitializeTimer(ch);
                }
                return;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Handles the ClientMoved event of the Teamspeak Server.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs"/> instance containing the event data.</param>
 public void Notifications_ClientMoved(object sender, ClientMovedEventArgs e)
 {
     try
     {
         ManagerFactory.Invoke(e);
     }
     catch (Exception ex)
     {
         LogService.Error(ex.ToString());
     }
 }
Ejemplo n.º 3
0
        private static void ClientJoinToChannel(object sender, ClientMovedEventArgs e)
        {
            lock (eventLock)
            {
                if (events.ContainsKey(e.ClientId))
                {
                    events.Remove(e.ClientId);
                    return;
                }
                events.Add(e.ClientId, true);

                channelService.ClientMoved(e);
            }
        }
Ejemplo n.º 4
0
        private static void ClientMoved(object sender, ClientMovedEventArgs e)
        {
            if (DoubleEvent(e.ClientId))
            {
                return;
            }

            lock (ClientLock(e.ClientId))
            {
                if (clients.ContainsKey(e.ClientId))
                {
                    // TODO: pobrać więcej danych, albo oznaczyć, że wymaga aktualizacji grup kanałowych itp..
                    clients[e.ClientId].MovedToChannel(e.TargetChannelId);
                }
            }
        }
Ejemplo n.º 5
0
        public async Task RegisterOnChannel(ClientMovedEventArgs e)
        {
            try
            {
                var clientInfo = new ClientInfoCommand(e.ClientId).ExecuteAsync(Interface.XfQueryBot.QueryClient)
                                 .Result;
                if (_config.RegisterChannels.ContainsKey((int)e.TargetChannelId))
                {
                    var channelId = Convert.ToInt16(e.TargetChannelId);
                    if (clientInfo.TotalConnections < _config.RegisterChannels[channelId].ConnectionsNeeded ||
                        clientInfo.ConnectedTime.TotalSeconds < _config.RegisterChannels[channelId].SecondsNeeded ||
                        clientInfo.ServerGroups.Any(x =>
                                                    _config.RegisterChannels[channelId].RestrictedRanks.Any(y => y == x)))
                    {
                        await new ClientPokeCommand(e.ClientId, _config.KickMessage[CheckClientLang(clientInfo)])
                        .ExecuteAsync(Interface.XfQueryBot.QueryClient);

                        await new ClientKickCommand(e.ClientId, KickReason.Channel,
                                                    _config.KickMessage[CheckClientLang(clientInfo)])
                        .ExecuteAsync(Interface.XfQueryBot.QueryClient);
                    }
                    else
                    {
                        await new ServerGroupAddClientCommand(
                            (uint)_config.RegisterChannels[(int)e.TargetChannelId].RankId, clientInfo.DatabaseId)
                        .ExecuteAsync(Interface.XfQueryBot.QueryClient);

                        await new ClientPokeCommand(e.ClientId, _config.SucessMessage[CheckClientLang(clientInfo)])
                        .ExecuteAsync(Interface.XfQueryBot.QueryClient);

                        await new ClientKickCommand(e.ClientId, KickReason.Channel,
                                                    _config.SucessMessage[CheckClientLang(clientInfo)])
                        .ExecuteAsync(Interface.XfQueryBot.QueryClient);
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error($"({_addon.Name}) : {ex}");
            }
        }
Ejemplo n.º 6
0
 //Client moved by temporary channel (double-evented)
 private void Notifications_ClientMovedByTemporaryChannelCreate(object sender, ClientMovedEventArgs e)
 {
     //addonManager.addons.ForEach(f => f.onClientMovedByTemporaryChannelCreate(sender, e));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs"/> instance containing the event data.</param>
 public virtual void Invoke(ClientMovedEventArgs e)
 {
     Manager.Where(m => m.CanInvoke(e)).ForEach(m => m.Invoke(e));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs"/> instance containing the event data.</param>
 public override void Invoke(ClientMovedEventArgs e)
 {
     StickyChannel(e);
 }
Ejemplo n.º 9
0
 private static void ClientMoved_JoiningChannel(object sender, ClientMovedEventArgs e)
 {
     ClientJoinToChannel(sender, e);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Determines whether this instance can invoke the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs"/> instance containing the event data.</param>
 /// <returns>
 ///   <c>true</c> if this instance can invoke the specified e; otherwise, <c>false</c>.
 /// </returns>
 public virtual bool CanInvoke(ClientMovedEventArgs e)
 {
     return(false);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs"/> instance containing the event data.</param>
 public virtual void Invoke(ClientMovedEventArgs e)
 {
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs"/> instance containing the event data.</param>
 public override void Invoke(ClientMovedEventArgs e)
 {
     PunishVoted(e);
 }
Ejemplo n.º 13
0
 public virtual void onClientMovedByTemporaryChannelCreate(object sender, ClientMovedEventArgs e)
 {
 }
Ejemplo n.º 14
0
 private static void ClientMoved_CreatingTemporaryChannel(object sender, ClientMovedEventArgs e)
 {
     ClientMoved(sender, e);
 }