/// <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 override bool CanInvoke(ClientMovedEventArgs e) { return CanInvoke(new ISettings[] { Repository.Settings.Vote }); }
/// <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()); } }
//Client moved (double-evented) x private void Notifications_ClientMoved(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs e) { //addonManager.addons.ForEach(f => f.onClientMoved(sender, e)); }
/// <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); }
/// <summary> /// Punishes the voted. /// </summary> /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs"/> instance containing the event data.</param> protected void PunishVoted(ClientMovedEventArgs e) { if (!Repository.Settings.Vote.Enabled) return; var clientEntry = Repository.Client.GetClientInfo(e.ClientId); if(!Repository.Client.IsClientVoted(clientEntry.DatabaseId)) return; var clientVoted = Repository.Client.GetClientVoted(clientEntry.DatabaseId); if (clientVoted.ChannelId.HasValue && clientVoted.ChannelId == e.TargetChannelId) { var context = new MessageContext { ClientDatabaseId = clientEntry.DatabaseId, ClientNickname = clientEntry.Nickname }; switch (Repository.Settings.Vote.Behavior) { case PunishBehavior.KickFromChannel: QueryRunner.KickClient(e.ClientId, KickReason.Channel, Repository.Settings.Vote.KickMessage.ToMessage(context)); break; } } }
/// <summary> /// Stickies the channel. /// </summary> /// <param name="e">The <see cref="TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs"/> instance containing the event data.</param> protected void StickyChannel(ClientMovedEventArgs e) { if (!Repository.Settings.Sticky.Enabled) return; var clientEntry = Repository.Client.GetClientInfo(e.ClientId); if (!PermissionHelper.IsGranted(Repository.Settings.Sticky, clientEntry.ServerGroups)) return; if (Repository.Settings.Sticky.Channel == e.TargetChannelId) { Log(Repository.Settings.Sticky, string.Format("Client '{0}'(id:{1}) added himself to sticky (id:{2})", clientEntry.Nickname, clientEntry.DatabaseId, e.TargetChannelId)); Repository.Channel.AddStickyClients(clientEntry.DatabaseId, e.TargetChannelId, Repository.Settings.Sticky.StickTime.GetValueOrDefault()); } else if (Repository.Channel.GetClientSticky(clientEntry.DatabaseId).HasValue) { MoveClientToSticky(e.ClientId, Repository.Channel.GetClientSticky(clientEntry.DatabaseId).Value); } }
/// <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); }
/// <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)); }
/// <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) { }
/// <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; }
public virtual void onClientMoved(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs e) { }
private void Notifications_ClientMoved(object sender, TS3QueryLib.Core.Server.Notification.EventArgs.ClientMovedEventArgs e) { var clientInfo = this.ServerQueryConnection.QueryRunner.GetClientInfo(e.ClientId); logger.Debug("Client changed channel! His name was {0}", clientInfo.Nickname); }