/// <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
                          });
 }
 //Client moved by mod/admin (double-evented) x
 private void Notifications_ClientMoveForced(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedByClientEventArgs e)
 {
     //addonManager.addons.ForEach(f => f.onClientMoveForced(sender, e));
 }
 /// <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);
 }
        /// <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));
            }
        }
 /// <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));
 }
 /// <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)
 {
 }
 /// <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;
 }
Beispiel #8
0
 public virtual void onClientMoveForced(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedByClientEventArgs e)
 {
 }
 /// <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());
     }
 }