예제 #1
0
 /// <summary>
 /// Determines whether this instance can invoke the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedByClientEventArgs"/> instance containing the event data.</param>
 /// <returns>
 ///   <c>true</c> if this instance can invoke the specified e; otherwise, <c>false</c>.
 /// </returns>
 public override bool CanInvoke(ClientMovedByClientEventArgs e)
 {
     return(CanInvoke(new ISettings[]
     {
         Repository.Settings.Sticky
     }));
 }
예제 #2
0
        /// <summary>
        /// Stickies the channel.
        /// </summary>
        /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedByClientEventArgs"/> instance containing the event data.</param>
        protected void StickyChannel(ClientMovedByClientEventArgs e)
        {
            if (!Repository.Settings.Sticky.Enabled ||
                e.InvokerClientId == Self.ClientId ||
                e.InvokerClientId == SelfWorker.ClientId)
            {
                return;
            }

            var clientEntry  = Repository.Client.GetClientInfo(e.ClientId);
            var invokerEntry = Repository.Client.GetClientInfo(e.InvokerClientId);

            if (!PermissionHelper.IsGranted(Repository.Settings.Sticky, clientEntry.ServerGroups))
            {
                return;
            }

            if (Repository.Settings.Sticky.Channel == e.TargetChannelId)
            {
                Repository.Channel.AddStickyClients(clientEntry.DatabaseId, e.TargetChannelId, Repository.Settings.Sticky.StickTime.GetValueOrDefault());

                Log(Repository.Settings.Sticky,
                    string.Format("Client '{0}'(id:{1}) were added to sticky (id:{4}) by '{2}'(id:{3})",
                                  clientEntry.Nickname, clientEntry.DatabaseId, invokerEntry.Nickname, invokerEntry.DatabaseId, e.TargetChannelId));
            }
            else
            {
                Repository.Channel.RemoveStickyClients(clientEntry.DatabaseId, Repository.Settings.Sticky.Channel.GetValueOrDefault());

                Log(Repository.Settings.Sticky,
                    string.Format("Client '{0}'(id:{1}) were removed from sticky (id:{4}) by '{2}'(id:{3})",
                                  clientEntry.Nickname, clientEntry.DatabaseId, invokerEntry.Nickname, invokerEntry.DatabaseId, e.TargetChannelId));
            }
        }
예제 #3
0
 /// <summary>
 /// Handles the ClientMoveForced 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.ClientMovedByClientEventArgs"/> instance containing the event data.</param>
 public void Notifications_ClientMoveForced(object sender, ClientMovedByClientEventArgs e)
 {
     try
     {
         ManagerFactory.Invoke(e);
     }
     catch (Exception ex)
     {
         LogService.Error(ex.ToString());
     }
 }
예제 #4
0
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedByClientEventArgs"/> instance containing the event data.</param>
 public virtual void Invoke(ClientMovedByClientEventArgs e)
 {
     Manager.Where(m => m.CanInvoke(e)).ForEach(m => m.Invoke(e));
 }
예제 #5
0
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedByClientEventArgs"/> instance containing the event data.</param>
 public override void Invoke(ClientMovedByClientEventArgs e)
 {
     StickyChannel(e);
 }
예제 #6
0
 private static void ClientMoved_JoiningChannelForced(object sender, ClientMovedByClientEventArgs e)
 {
     ClientJoinToChannel(sender, e);
 }
예제 #7
0
 /// <summary>
 /// Determines whether this instance can invoke the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedByClientEventArgs"/> 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(ClientMovedByClientEventArgs e)
 {
     return(false);
 }
예제 #8
0
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedByClientEventArgs"/> instance containing the event data.</param>
 public virtual void Invoke(ClientMovedByClientEventArgs e)
 {
 }