Add connection spam throttling to gui (need to actually implement)

This commit is contained in:
UnknownShadow200 2017-01-16 13:50:37 +11:00
parent 7ac7dc5bae
commit e63dd98176
3 changed files with 236 additions and 48 deletions

View File

@ -333,6 +333,16 @@ namespace MCGalaxy.Gui
this.tabPage11 = new System.Windows.Forms.TabPage(); this.tabPage11 = new System.Windows.Forms.TabPage();
this.propsZG = new System.Windows.Forms.PropertyGrid(); this.propsZG = new System.Windows.Forms.PropertyGrid();
this.pageSecurity = new System.Windows.Forms.TabPage(); this.pageSecurity = new System.Windows.Forms.TabPage();
this.sec_gbIP = new System.Windows.Forms.GroupBox();
this.sec_cbIPAuto = new System.Windows.Forms.CheckBox();
this.sec_lblIPOnMute = new System.Windows.Forms.Label();
this.sec_numIPMsgs = new System.Windows.Forms.NumericUpDown();
this.sec_lblIPOnMsgs = new System.Windows.Forms.Label();
this.sec_numIPSecs = new System.Windows.Forms.NumericUpDown();
this.sec_lblIPOnSecs = new System.Windows.Forms.Label();
this.sec_lblIPForMute = new System.Windows.Forms.Label();
this.sec_numIPMute = new System.Windows.Forms.NumericUpDown();
this.sec_lblIPForSecs = new System.Windows.Forms.Label();
this.sec_gbBlocks = new System.Windows.Forms.GroupBox(); this.sec_gbBlocks = new System.Windows.Forms.GroupBox();
this.sec_cbBlocksAuto = new System.Windows.Forms.CheckBox(); this.sec_cbBlocksAuto = new System.Windows.Forms.CheckBox();
this.sec_lblBlocksOnMute = new System.Windows.Forms.Label(); this.sec_lblBlocksOnMute = new System.Windows.Forms.Label();
@ -423,6 +433,10 @@ namespace MCGalaxy.Gui
this.groupBox30.SuspendLayout(); this.groupBox30.SuspendLayout();
this.tabPage11.SuspendLayout(); this.tabPage11.SuspendLayout();
this.pageSecurity.SuspendLayout(); this.pageSecurity.SuspendLayout();
this.sec_gbIP.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.sec_numIPMsgs)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sec_numIPSecs)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sec_numIPMute)).BeginInit();
this.sec_gbBlocks.SuspendLayout(); this.sec_gbBlocks.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.sec_numBlocksMsgs)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.sec_numBlocksMsgs)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sec_numBlocksSecs)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.sec_numBlocksSecs)).BeginInit();
@ -3553,6 +3567,7 @@ namespace MCGalaxy.Gui
// pageSecurity // pageSecurity
// //
this.pageSecurity.BackColor = System.Drawing.SystemColors.Control; this.pageSecurity.BackColor = System.Drawing.SystemColors.Control;
this.pageSecurity.Controls.Add(this.sec_gbIP);
this.pageSecurity.Controls.Add(this.sec_gbBlocks); this.pageSecurity.Controls.Add(this.sec_gbBlocks);
this.pageSecurity.Controls.Add(this.sec_gbCmd); this.pageSecurity.Controls.Add(this.sec_gbCmd);
this.pageSecurity.Controls.Add(this.sec_gbOther); this.pageSecurity.Controls.Add(this.sec_gbOther);
@ -3564,6 +3579,131 @@ namespace MCGalaxy.Gui
this.pageSecurity.TabIndex = 7; this.pageSecurity.TabIndex = 7;
this.pageSecurity.Text = "Security"; this.pageSecurity.Text = "Security";
// //
// sec_gbIP
//
this.sec_gbIP.Controls.Add(this.sec_cbIPAuto);
this.sec_gbIP.Controls.Add(this.sec_lblIPOnMute);
this.sec_gbIP.Controls.Add(this.sec_numIPMsgs);
this.sec_gbIP.Controls.Add(this.sec_lblIPOnMsgs);
this.sec_gbIP.Controls.Add(this.sec_numIPSecs);
this.sec_gbIP.Controls.Add(this.sec_lblIPOnSecs);
this.sec_gbIP.Controls.Add(this.sec_lblIPForMute);
this.sec_gbIP.Controls.Add(this.sec_numIPMute);
this.sec_gbIP.Controls.Add(this.sec_lblIPForSecs);
this.sec_gbIP.Location = new System.Drawing.Point(14, 240);
this.sec_gbIP.Name = "sec_gbIP";
this.sec_gbIP.Size = new System.Drawing.Size(238, 110);
this.sec_gbIP.TabIndex = 37;
this.sec_gbIP.TabStop = false;
this.sec_gbIP.Text = "Connection spam control";
//
// sec_cbIPAuto
//
this.sec_cbIPAuto.AutoSize = true;
this.sec_cbIPAuto.Location = new System.Drawing.Point(10, 20);
this.sec_cbIPAuto.Name = "sec_cbIPAuto";
this.sec_cbIPAuto.Size = new System.Drawing.Size(149, 17);
this.sec_cbIPAuto.TabIndex = 24;
this.sec_cbIPAuto.Text = "Enable automatic blocking";
this.sec_cbIPAuto.UseVisualStyleBackColor = true;
this.sec_cbIPAuto.CheckedChanged += new System.EventHandler(this.sec_cbIPAuto_Checked);
//
// sec_lblIPOnMute
//
this.sec_lblIPOnMute.AutoSize = true;
this.sec_lblIPOnMute.Location = new System.Drawing.Point(6, 48);
this.sec_lblIPOnMute.Name = "sec_lblIPOnMute";
this.sec_lblIPOnMute.Size = new System.Drawing.Size(46, 13);
this.sec_lblIPOnMute.TabIndex = 25;
this.sec_lblIPOnMute.Text = "Block on";
//
// sec_numIPMsgs
//
this.sec_numIPMsgs.Location = new System.Drawing.Point(53, 45);
this.sec_numIPMsgs.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.sec_numIPMsgs.Name = "sec_numIPMsgs";
this.sec_numIPMsgs.Size = new System.Drawing.Size(37, 21);
this.sec_numIPMsgs.TabIndex = 30;
this.sec_numIPMsgs.Value = new decimal(new int[] {
25,
0,
0,
0});
//
// sec_lblIPOnMsgs
//
this.sec_lblIPOnMsgs.AutoSize = true;
this.sec_lblIPOnMsgs.Location = new System.Drawing.Point(91, 48);
this.sec_lblIPOnMsgs.Name = "sec_lblIPOnMsgs";
this.sec_lblIPOnMsgs.Size = new System.Drawing.Size(75, 13);
this.sec_lblIPOnMsgs.TabIndex = 31;
this.sec_lblIPOnMsgs.Text = "connections in";
//
// sec_numIPSecs
//
this.sec_numIPSecs.Location = new System.Drawing.Point(166, 45);
this.sec_numIPSecs.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.sec_numIPSecs.Name = "sec_numIPSecs";
this.sec_numIPSecs.Size = new System.Drawing.Size(42, 21);
this.sec_numIPSecs.TabIndex = 34;
this.sec_numIPSecs.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// sec_lblIPOnSecs
//
this.sec_lblIPOnSecs.AutoSize = true;
this.sec_lblIPOnSecs.Location = new System.Drawing.Point(209, 48);
this.sec_lblIPOnSecs.Name = "sec_lblIPOnSecs";
this.sec_lblIPOnSecs.Size = new System.Drawing.Size(28, 13);
this.sec_lblIPOnSecs.TabIndex = 33;
this.sec_lblIPOnSecs.Text = "secs";
//
// sec_lblIPForMute
//
this.sec_lblIPForMute.AutoSize = true;
this.sec_lblIPForMute.Location = new System.Drawing.Point(6, 83);
this.sec_lblIPForMute.Name = "sec_lblIPForMute";
this.sec_lblIPForMute.Size = new System.Drawing.Size(47, 13);
this.sec_lblIPForMute.TabIndex = 25;
this.sec_lblIPForMute.Text = "Block for";
//
// sec_numIPMute
//
this.sec_numIPMute.Location = new System.Drawing.Point(53, 79);
this.sec_numIPMute.Maximum = new decimal(new int[] {
1000,
0,
0,
0});
this.sec_numIPMute.Name = "sec_numIPMute";
this.sec_numIPMute.Size = new System.Drawing.Size(42, 21);
this.sec_numIPMute.TabIndex = 32;
this.sec_numIPMute.Value = new decimal(new int[] {
300,
0,
0,
0});
//
// sec_lblIPForSecs
//
this.sec_lblIPForSecs.AutoSize = true;
this.sec_lblIPForSecs.Location = new System.Drawing.Point(96, 83);
this.sec_lblIPForSecs.Name = "sec_lblIPForSecs";
this.sec_lblIPForSecs.Size = new System.Drawing.Size(46, 13);
this.sec_lblIPForSecs.TabIndex = 33;
this.sec_lblIPForSecs.Text = "seconds";
//
// sec_gbBlocks // sec_gbBlocks
// //
this.sec_gbBlocks.Controls.Add(this.sec_cbBlocksAuto); this.sec_gbBlocks.Controls.Add(this.sec_cbBlocksAuto);
@ -3603,7 +3743,7 @@ namespace MCGalaxy.Gui
// //
this.sec_numBlocksMsgs.Location = new System.Drawing.Point(46, 45); this.sec_numBlocksMsgs.Location = new System.Drawing.Point(46, 45);
this.sec_numBlocksMsgs.Maximum = new decimal(new int[] { this.sec_numBlocksMsgs.Maximum = new decimal(new int[] {
500, 1000,
0, 0,
0, 0,
0}); 0});
@ -3629,7 +3769,7 @@ namespace MCGalaxy.Gui
// //
this.sec_numBlocksSecs.Location = new System.Drawing.Point(142, 45); this.sec_numBlocksSecs.Location = new System.Drawing.Point(142, 45);
this.sec_numBlocksSecs.Maximum = new decimal(new int[] { this.sec_numBlocksSecs.Maximum = new decimal(new int[] {
128, 1000,
0, 0,
0, 0,
0}); 0});
@ -3693,7 +3833,7 @@ namespace MCGalaxy.Gui
// //
this.sec_numCmdMsgs.Location = new System.Drawing.Point(53, 45); this.sec_numCmdMsgs.Location = new System.Drawing.Point(53, 45);
this.sec_numCmdMsgs.Maximum = new decimal(new int[] { this.sec_numCmdMsgs.Maximum = new decimal(new int[] {
128, 1000,
0, 0,
0, 0,
0}); 0});
@ -3719,7 +3859,7 @@ namespace MCGalaxy.Gui
// //
this.sec_numCmdSecs.Location = new System.Drawing.Point(161, 45); this.sec_numCmdSecs.Location = new System.Drawing.Point(161, 45);
this.sec_numCmdSecs.Maximum = new decimal(new int[] { this.sec_numCmdSecs.Maximum = new decimal(new int[] {
128, 1000,
0, 0,
0, 0,
0}); 0});
@ -3754,7 +3894,7 @@ namespace MCGalaxy.Gui
// //
this.sec_numCmdMute.Location = new System.Drawing.Point(53, 79); this.sec_numCmdMute.Location = new System.Drawing.Point(53, 79);
this.sec_numCmdMute.Maximum = new decimal(new int[] { this.sec_numCmdMute.Maximum = new decimal(new int[] {
128, 1000,
0, 0,
0, 0,
0}); 0});
@ -3830,7 +3970,7 @@ namespace MCGalaxy.Gui
// //
this.sec_numChatMsgs.Location = new System.Drawing.Point(53, 45); this.sec_numChatMsgs.Location = new System.Drawing.Point(53, 45);
this.sec_numChatMsgs.Maximum = new decimal(new int[] { this.sec_numChatMsgs.Maximum = new decimal(new int[] {
128, 1000,
0, 0,
0, 0,
0}); 0});
@ -3856,7 +3996,7 @@ namespace MCGalaxy.Gui
// //
this.sec_numChatSecs.Location = new System.Drawing.Point(156, 45); this.sec_numChatSecs.Location = new System.Drawing.Point(156, 45);
this.sec_numChatSecs.Maximum = new decimal(new int[] { this.sec_numChatSecs.Maximum = new decimal(new int[] {
128, 1000,
0, 0,
0, 0,
0}); 0});
@ -3891,7 +4031,7 @@ namespace MCGalaxy.Gui
// //
this.sec_numChatMute.Location = new System.Drawing.Point(53, 79); this.sec_numChatMute.Location = new System.Drawing.Point(53, 79);
this.sec_numChatMute.Maximum = new decimal(new int[] { this.sec_numChatMute.Maximum = new decimal(new int[] {
128, 1000,
0, 0,
0, 0,
0}); 0});
@ -4024,6 +4164,11 @@ namespace MCGalaxy.Gui
this.groupBox30.ResumeLayout(false); this.groupBox30.ResumeLayout(false);
this.tabPage11.ResumeLayout(false); this.tabPage11.ResumeLayout(false);
this.pageSecurity.ResumeLayout(false); this.pageSecurity.ResumeLayout(false);
this.sec_gbIP.ResumeLayout(false);
this.sec_gbIP.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.sec_numIPMsgs)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sec_numIPSecs)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sec_numIPMute)).EndInit();
this.sec_gbBlocks.ResumeLayout(false); this.sec_gbBlocks.ResumeLayout(false);
this.sec_gbBlocks.PerformLayout(); this.sec_gbBlocks.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.sec_numBlocksMsgs)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.sec_numBlocksMsgs)).EndInit();
@ -4042,6 +4187,16 @@ namespace MCGalaxy.Gui
((System.ComponentModel.ISupportInitialize)(this.sec_numChatMute)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.sec_numChatMute)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
private System.Windows.Forms.Label sec_lblIPForSecs;
private System.Windows.Forms.NumericUpDown sec_numIPMute;
private System.Windows.Forms.Label sec_lblIPForMute;
private System.Windows.Forms.Label sec_lblIPOnSecs;
private System.Windows.Forms.NumericUpDown sec_numIPSecs;
private System.Windows.Forms.Label sec_lblIPOnMsgs;
private System.Windows.Forms.NumericUpDown sec_numIPMsgs;
private System.Windows.Forms.Label sec_lblIPOnMute;
private System.Windows.Forms.CheckBox sec_cbIPAuto;
private System.Windows.Forms.GroupBox sec_gbIP;
private System.Windows.Forms.Label sec_lblCmdForSecs; private System.Windows.Forms.Label sec_lblCmdForSecs;
private System.Windows.Forms.NumericUpDown sec_numCmdMute; private System.Windows.Forms.NumericUpDown sec_numCmdMute;
private System.Windows.Forms.Label sec_lblCmdForMute; private System.Windows.Forms.Label sec_lblCmdForMute;

View File

@ -322,6 +322,11 @@ namespace MCGalaxy.Gui {
sec_cbBlocksAuto.Checked = Server.BlockSpamCheck; sec_cbBlocksAuto.Checked = Server.BlockSpamCheck;
sec_numBlocksMsgs.Value = Server.BlockSpamCount; sec_numBlocksMsgs.Value = Server.BlockSpamCount;
sec_numBlocksSecs.Value = Server.BlockSpamInterval; sec_numBlocksSecs.Value = Server.BlockSpamInterval;
sec_cbIPAuto.Checked = Server.IPSpamCheck;
sec_numIPMsgs.Value = Server.IPSpamCount;
sec_numIPSecs.Value = Server.IPSpamInterval;
sec_numIPMute.Value = Server.IPSpamBlockTime;
} }
void ParseColor(string value, ComboBox target) { void ParseColor(string value, ComboBox target) {
@ -367,16 +372,6 @@ namespace MCGalaxy.Gui {
string main = Player.ValidName(txtMain.Text) ? txtMain.Text : "main"; string main = Player.ValidName(txtMain.Text) ? txtMain.Text : "main";
Server.SetMainLevel(main); Server.SetMainLevel(main);
Server.irc = chkIRC.Checked;
Server.ircNick = txtNick.Text;
Server.ircServer = txtIRCServer.Text;
Server.ircChannel = txtChannel.Text;
Server.ircOpChannel = txtOpChannel.Text;
Server.ircPort = int.Parse(txtIRCPort.Text);
Server.ircIdentify = chkIrcId.Checked;
Server.ircPassword = txtIrcId.Text;
Server.ircPlayerTitles = irc_cbTitles.Checked;
Server.rpLimit = int.Parse(txtRP.Text); Server.rpLimit = int.Parse(txtRP.Text);
Server.rpNormLimit = int.Parse(txtRP.Text); Server.rpNormLimit = int.Parse(txtRP.Text);
Server.physicsRestart = chkPhysicsRest.Checked; Server.physicsRestart = chkPhysicsRest.Checked;
@ -405,47 +400,64 @@ namespace MCGalaxy.Gui {
zsSettings.ApplyToServer(); zsSettings.ApplyToServer();
lsSettings.ApplyToServer(); lsSettings.ApplyToServer();
Server.guestLimitNotify = chkGuestLimitNotify.Checked; Server.guestLimitNotify = chkGuestLimitNotify.Checked;
Server.backupInterval = int.Parse(txtBackup.Text); Server.backupInterval = int.Parse(txtBackup.Text);
Server.backupLocation = txtBackupLocation.Text; Server.backupLocation = txtBackupLocation.Text;
//Server.reportBack = ; //No setting for this? //Server.reportBack = ; //No setting for this?
Server.higherranktp = chkTpToHigherRanks.Checked;
Server.checkUpdates = chkUpdates.Checked;
Server.defaultRank = cmbDefaultRank.SelectedItem.ToString();
Server.hackrank_kick = hackrank_kick.Checked;
Server.hackrank_kick_time = int.Parse(hackrank_kick_time.Text);
Server.showEmptyRanks = chkShowEmptyRanks.Checked;
Server.reviewcooldown = (int)nudCooldownTime.Value;
ApplyIrcSqlProps();
ApplyChatProps();
ApplySecurityProps();
}
void ApplyIrcSqlProps() {
Server.irc = chkIRC.Checked;
Server.ircNick = txtNick.Text;
Server.ircServer = txtIRCServer.Text;
Server.ircChannel = txtChannel.Text;
Server.ircOpChannel = txtOpChannel.Text;
Server.ircPort = int.Parse(txtIRCPort.Text);
Server.ircIdentify = chkIrcId.Checked;
Server.ircPassword = txtIrcId.Text;
Server.ircPlayerTitles = irc_cbTitles.Checked;
Server.useMySQL = chkUseSQL.Checked; Server.useMySQL = chkUseSQL.Checked;
Database.Backend = Server.useMySQL ? Database.Backend = Server.useMySQL ? MySQLBackend.Instance : SQLiteBackend.Instance;
MySQLBackend.Instance : SQLiteBackend.Instance;
Server.MySQLHost = txtSQLHost.Text; Server.MySQLHost = txtSQLHost.Text;
Server.MySQLPort = txtSQLPort.Text; Server.MySQLPort = txtSQLPort.Text;
Server.MySQLUsername = txtSQLUsername.Text; Server.MySQLUsername = txtSQLUsername.Text;
Server.MySQLPassword = txtSQLPassword.Text; Server.MySQLPassword = txtSQLPassword.Text;
Server.MySQLDatabaseName = txtSQLDatabase.Text; Server.MySQLDatabaseName = txtSQLDatabase.Text;
//Server.MySQLPooling = ; // No setting for this? //Server.MySQLPooling = ; // No setting for this?
}
void ApplyChatProps() {
Server.DefaultColor = Colors.Parse(chat_cmbDefault.SelectedItem.ToString()); Server.DefaultColor = Colors.Parse(chat_cmbDefault.SelectedItem.ToString());
Server.IRCColour = Colors.Parse(chat_cmbIRC.SelectedItem.ToString()); Server.IRCColour = Colors.Parse(chat_cmbIRC.SelectedItem.ToString());
Server.HelpSyntaxColor = Colors.Parse(chat_cmbSyntax.SelectedItem.ToString()); Server.HelpSyntaxColor = Colors.Parse(chat_cmbSyntax.SelectedItem.ToString());
Server.HelpDescriptionColor = Colors.Parse(chat_cmbDesc.SelectedItem.ToString()); Server.HelpDescriptionColor = Colors.Parse(chat_cmbDesc.SelectedItem.ToString());
Server.TablistRankSorted = chat_cbTabRank.Checked; Server.TablistRankSorted = chat_cbTabRank.Checked;
Server.TablistGlobal = !chat_cbTabLevel.Checked; Server.TablistGlobal = !chat_cbTabLevel.Checked;
Server.TablistBots = chat_cbTabBots.Checked; Server.TablistBots = chat_cbTabBots.Checked;
Server.higherranktp = chkTpToHigherRanks.Checked;
Server.checkUpdates = chkUpdates.Checked;
Server.cheapMessage = chat_chkCheap.Checked; Server.cheapMessage = chat_chkCheap.Checked;
Server.cheapMessageGiven = chat_txtCheap.Text; Server.cheapMessageGiven = chat_txtCheap.Text;
Server.defaultBanMessage = chat_txtBan.Text; Server.defaultBanMessage = chat_txtBan.Text;
Server.shutdownMessage = chat_txtShutdown.Text; Server.shutdownMessage = chat_txtShutdown.Text;
Server.defaultDemoteMessage = chat_txtDemote.Text; Server.defaultDemoteMessage = chat_txtDemote.Text;
Server.defaultPromoteMessage = chat_txtPromote.Text; Server.defaultPromoteMessage = chat_txtPromote.Text;
}
Server.defaultRank = cmbDefaultRank.SelectedItem.ToString();
void ApplySecurityProps() {
Server.hackrank_kick = hackrank_kick.Checked; Server.LogNotes = sec_cbLogNotes.Checked;
Server.hackrank_kick_time = int.Parse(hackrank_kick_time.Text);
// Security tab
Server.verifyadmins = sec_cbVerifyAdmins.Checked; Server.verifyadmins = sec_cbVerifyAdmins.Checked;
Server.verifyadminsrank = Group.GroupList.Find(grp => grp.name == sec_cmbVerifyRank.SelectedItem.ToString()).Permission; Server.verifyadminsrank = Program.GetPermission(sec_cmbVerifyRank, LevelPermission.Operator);
Server.useWhitelist = sec_cbWhitelist.Checked; Server.useWhitelist = sec_cbWhitelist.Checked;
if (Server.useWhitelist && Server.whiteList == null) if (Server.useWhitelist && Server.whiteList == null)
Server.whiteList = PlayerList.Load("whitelist.txt"); Server.whiteList = PlayerList.Load("whitelist.txt");
@ -454,17 +466,20 @@ namespace MCGalaxy.Gui {
Server.spamcounter = (int)sec_numChatMsgs.Value; Server.spamcounter = (int)sec_numChatMsgs.Value;
Server.spamcountreset = (int)sec_numChatSecs.Value; Server.spamcountreset = (int)sec_numChatSecs.Value;
Server.mutespamtime = (int)sec_numChatMute.Value; Server.mutespamtime = (int)sec_numChatMute.Value;
Server.CmdSpamCheck = sec_cbCmdAuto.Checked; Server.CmdSpamCheck = sec_cbCmdAuto.Checked;
Server.CmdSpamCount = (int)sec_numCmdMsgs.Value; Server.CmdSpamCount = (int)sec_numCmdMsgs.Value;
Server.CmdSpamInterval = (int)sec_numCmdSecs.Value; Server.CmdSpamInterval = (int)sec_numCmdSecs.Value;
Server.CmdSpamBlockTime = (int)sec_numCmdMute.Value; Server.CmdSpamBlockTime = (int)sec_numCmdMute.Value;
Server.BlockSpamCheck = sec_cbBlocksAuto.Checked; Server.BlockSpamCheck = sec_cbBlocksAuto.Checked;
Server.BlockSpamCount = (int)sec_numBlocksMsgs.Value; Server.BlockSpamCount = (int)sec_numBlocksMsgs.Value;
Server.BlockSpamInterval = (int)sec_numBlocksSecs.Value; Server.BlockSpamInterval = (int)sec_numBlocksSecs.Value;
Server.LogNotes = sec_cbLogNotes.Checked; Server.IPSpamCheck = sec_cbCmdAuto.Checked;
Server.showEmptyRanks = chkShowEmptyRanks.Checked; Server.IPSpamCount = (int)sec_numCmdMsgs.Value;
Server.reviewcooldown = (int)nudCooldownTime.Value; Server.IPSpamInterval = (int)sec_numCmdSecs.Value;
Server.IPSpamBlockTime = (int)sec_numCmdMute.Value;
} }
@ -1080,7 +1095,10 @@ txtBackupLocation.Text = folderDialog.SelectedPath;
void sec_cbBlocksAuto_Checked(object sender, EventArgs e) { void sec_cbBlocksAuto_Checked(object sender, EventArgs e) {
ToggleBlocksSpamSettings(sec_cbBlocksAuto.Checked); ToggleBlocksSpamSettings(sec_cbBlocksAuto.Checked);
} }
void sec_cbIPAuto_Checked(object sender, EventArgs e) {
ToggleIPSpamSettings(sec_cbIPAuto.Checked);
}
void ToggleIrcSettings(bool enabled) { void ToggleIrcSettings(bool enabled) {
txtIRCServer.Enabled = enabled; txtIRCServer.Enabled = enabled;
@ -1117,6 +1135,12 @@ txtBackupLocation.Text = folderDialog.SelectedPath;
sec_numBlocksMsgs.Enabled = enabled; sec_numBlocksMsgs.Enabled = enabled;
sec_numBlocksSecs.Enabled = enabled; sec_numBlocksSecs.Enabled = enabled;
} }
void ToggleIPSpamSettings(bool enabled) {
sec_numIPMsgs.Enabled = enabled;
sec_numIPMute.Enabled = enabled;
sec_numIPSecs.Enabled = enabled;
}
void VerifyAdminsChecked(object sender, System.EventArgs e) { void VerifyAdminsChecked(object sender, System.EventArgs e) {
sec_cmbVerifyRank.Enabled = sec_cbVerifyAdmins.Checked; sec_cmbVerifyRank.Enabled = sec_cbVerifyAdmins.Checked;

View File

@ -193,29 +193,38 @@ namespace MCGalaxy {
//Spam Prevention //Spam Prevention
[ConfigBool("mute-on-spam", "Spam control", null, false)] [ConfigBool("mute-on-spam", "Spam control", null, false)]
public static bool checkspam = false; public static bool checkspam = false;
[ConfigInt("spam-messages", "Spam control", null, 8)] [ConfigInt("spam-messages", "Spam control", null, 8, 0, 1000)]
public static int spamcounter = 8; public static int spamcounter = 8;
[ConfigInt("spam-mute-time", "Spam control", null, 60)] [ConfigInt("spam-mute-time", "Spam control", null, 60, 0, 1000)]
public static int mutespamtime = 60; public static int mutespamtime = 60;
[ConfigInt("spam-counter-reset-time", "Spam control", null, 5)] [ConfigInt("spam-counter-reset-time", "Spam control", null, 5, 0, 1000)]
public static int spamcountreset = 5; public static int spamcountreset = 5;
[ConfigBool("cmd-spam-check", "Spam control", null, true)] [ConfigBool("cmd-spam-check", "Spam control", null, true)]
public static bool CmdSpamCheck = true; public static bool CmdSpamCheck = true;
[ConfigInt("cmd-spam-count", "Spam control", null, 25)] [ConfigInt("cmd-spam-count", "Spam control", null, 25, 0, 1000)]
public static int CmdSpamCount = 25; public static int CmdSpamCount = 25;
[ConfigInt("cmd-spam-block-time", "Spam control", null, 30)] [ConfigInt("cmd-spam-block-time", "Spam control", null, 30, 0, 1000)]
public static int CmdSpamBlockTime = 30; public static int CmdSpamBlockTime = 30;
[ConfigInt("cmd-spam-interval", "Spam control", null, 1)] [ConfigInt("cmd-spam-interval", "Spam control", null, 1, 0, 1000)]
public static int CmdSpamInterval = 1; public static int CmdSpamInterval = 1;
[ConfigBool("block-spam-check", "Spam control", null, true)] [ConfigBool("block-spam-check", "Spam control", null, true)]
public static bool BlockSpamCheck = true; public static bool BlockSpamCheck = true;
[ConfigInt("block-spam-count", "Spam control", null, 200)] [ConfigInt("block-spam-count", "Spam control", null, 200, 0, 1000)]
public static int BlockSpamCount = 200; public static int BlockSpamCount = 200;
[ConfigInt("block-spam-interval", "Spam control", null, 5)] [ConfigInt("block-spam-interval", "Spam control", null, 5, 0, 1000)]
public static int BlockSpamInterval = 5; public static int BlockSpamInterval = 5;
[ConfigBool("ip-spam-check", "Spam control", null, true)]
public static bool IPSpamCheck = true;
[ConfigInt("ip-spam-count", "Spam control", null, 25, 0, 1000)]
public static int IPSpamCount = 10;
[ConfigInt("ip-spam-block-time", "Spam control", null, 30, 0, 1000)]
public static int IPSpamBlockTime = 300;
[ConfigInt("ip-spam-interval", "Spam control", null, 1, 0, 1000)]
public static int IPSpamInterval = 60;
[ConfigString("host-state", "Other", null, "Alive")] [ConfigString("host-state", "Other", null, "Alive")]
public static string ZallState = "Alive"; public static string ZallState = "Alive";