public void HandleBan(IRCMessage sIRCMessage) { if (!IsAdmin(sIRCMessage.Nick, sIRCMessage.Host, AdminFlag.Operator)) { return; } var sSendMessage = sIrcBase.Networks[sIRCMessage.ServerName].sSendMessage; if (sIRCMessage.Info.Length < 5) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoBanNameOrVhost", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (sIRCMessage.Info.Length < 6) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTime", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } string args = sIRCMessage.Info.SplitToString(5, SchumixBase.Space); if (IsHourAndMinute(args)) { if (!IsHour(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("HourIsNotGiven", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!IsMinute(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("MinuteIsNotGiven", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!IsMessage(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoReason", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } int hour = GetHour(args); if (hour >= 24 || hour < 0) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ErrorHour", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } int minute = GetMinute(args); if (minute >= 60 || minute < 0) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ErrorMinute", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } sSendMessage.SendChatMessage(sIRCMessage, sBan.BanName(sIRCMessage.Info[4].ToLower(), sIRCMessage.Channel, GetMessage(args), hour, minute)); } else { if (sIRCMessage.Info.Length < 7) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoTime", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!IsYear(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("YearIsNotGiven", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!IsMonth(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("MonthIsNotGiven", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!IsDay(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("DayIsNotGiven", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!IsHour(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("HourIsNotGiven", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!IsMinute(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("MinuteIsNotGiven", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } if (!IsMessage(args)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("NoReason", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } int year = GetYear(args); if (year < 0) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ErrorYear", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } int month = GetMonth(args).GetMonthNameInInt(sLManager.GetChannelLocalization(sIRCMessage.Channel, sIRCMessage.ServerName)); if (month > 12 || month <= 0) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ErrorMonth", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } int day = GetDay(args); if (!sUtilities.IsDay(year, month, day)) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ErrorDay", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } int hour = GetHour(args); if (hour >= 24 || hour < 0) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ErrorHour", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } int minute = GetMinute(args); if (minute >= 60 || minute < 0) { sSendMessage.SendChatMessage(sIRCMessage, sLManager.GetWarningText("ErrorMinute", sIRCMessage.Channel, sIRCMessage.ServerName)); return; } sSendMessage.SendChatMessage(sIRCMessage, sBan.BanName(sIRCMessage.Info[4].ToLower(), sIRCMessage.Channel, GetMessage(args), year, month, day, hour, minute)); } }