/// <summary>
 /// Determines whether this instance can invoke the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> 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(ClientJoinedEventArgs e)
 {
     return CanInvoke(new ISettings[]
                          {
                              Repository.Settings.Sticky
                          });
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleClientEntity"/> class.
 /// </summary>
 /// <param name="client">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
 public SimpleClientEntity(ClientJoinedEventArgs client)
 {
     this.ClientDatabaseId = client.ClientDatabaseId;
     this.ClientId = client.ClientId;
     this.Nickname = client.Nickname;
     this.ServerGroups = new List<uint>(client.ServerGroups);
     this.ChannelId = client.ChannelId;
     this.Connected = DateTime.UtcNow;
 }
 /// <summary>
 /// Handles the ClientJoined 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.ClientJoinedEventArgs"/> instance containing the event data.</param>
 public void Notifications_ClientJoined(object sender, ClientJoinedEventArgs e)
 {
     try
     {
         ManagerFactory.Invoke(e);
     }
     catch (Exception ex)
     {
         LogService.Error(ex.ToString());
     }
 }
 //Client joins server
 private void Notifications_ClientJoined(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs e)
 {
     //addonManager.addons.ForEach(f => f.onClientJoined(sender, e));
 }
        /// <summary>
        /// Stickies the channel.
        /// </summary>
        /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
        protected void StickyChannel(ClientJoinedEventArgs e)
        {
            if (!Repository.Settings.Sticky.Enabled ||
                !PermissionHelper.IsGranted(Repository.Settings.Sticky, e.ServerGroups)) return;

            var sticky = Repository.Channel.GetClientSticky(e.ClientDatabaseId);
            if (sticky != null && sticky.Value != e.ChannelId)
            {
                MoveClientToSticky(e.ClientId, sticky.Value);
            }
        }
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
 public override void Invoke(ClientJoinedEventArgs e)
 {
     StickyChannel(e);
 }
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
 public virtual void Invoke(ClientJoinedEventArgs e)
 {
     Manager.Where(m => m.CanInvoke(e)).ForEach(m => m.Invoke(e));
 }
        /// <summary>
        /// Clears the away clients.
        /// </summary>
        /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
        protected void ClearAwayClients(ClientJoinedEventArgs e)
        {
            if (!Repository.Settings.Away.Enabled) return;

            if (!e.IsClientAway && !e.IsClientInputMuted && !e.IsClientOutputMuted) Repository.Client.RemoveLastChannelByClientId(e.ClientId);
        }
 /// <summary> 
 /// Invokes the specified e. 
 /// </summary> 
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param> 
 public override void Invoke(ClientJoinedEventArgs e)
 {
     ClearAwayClients(e);
 }
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
 public virtual void Invoke(ClientJoinedEventArgs e)
 {
 }
 /// <summary>
 /// Determines whether this instance can invoke the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> 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(ClientJoinedEventArgs e)
 {
     return false;
 }
Beispiel #12
0
 public virtual void onClientJoined(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs e)
 {
 }
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
 public override void Invoke(ClientJoinedEventArgs e)
 {
     KickClientsWithBadNickname(e);
 }
        /// <summary>
        /// Kicks the clients with bad nickname.
        /// </summary>
        /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
        protected void KickClientsWithBadNickname(ClientJoinedEventArgs e)
        {
            if (!Repository.Settings.BadNickname.Enabled) return;

            if (IsBadNickname(e.Nickname))
            {
                var client = new SimpleClientEntity(e);
                if (!PermissionHelper.IsGranted(Repository.Settings.BadNickname, client.ServerGroups)) return;

                KickClientForBadNickname(client);
            }
        }
 /// <summary>
 /// Invokes the specified e.
 /// </summary>
 /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
 public override void Invoke(ClientJoinedEventArgs e)
 {
     Repository.Settings.Message.Messages.Where(m => m.Enabled && m.MessageType == MessageType.Welcome).ForEach(m => WelcomeMessage(e, m));
 }
        /// <summary>
        /// Welcomes the message.
        /// </summary>
        /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientJoinedEventArgs"/> instance containing the event data.</param>
        /// <param name="message">The message.</param>
        protected void WelcomeMessage(ClientJoinedEventArgs e, MessageDefinition message)
        {
            if (!message.Enabled) return;

            if (e.ClientType == 0)
                QueryRunner.SendTextMessage(
                    MessageTarget.Channel, message.Channel,
                    message.TextMessage.ToMessage(new MessageContext
                                                  {
                                                      ClientDatabaseId = e.ClientDatabaseId,
                                                      ClientNickname = e.Nickname
                                                  }));

            Log(message, string.Format("Welcome message successfully sent to client '{0}'(id:{1}).", e.Nickname, e.ClientDatabaseId));
        }