Added the ability to delete a ban by name in the same way as a user
This commit is contained in:
parent
ce5c659e89
commit
78cc7a6f75
1 changed files with 6 additions and 2 deletions
|
|
@ -123,11 +123,15 @@ throw new Exception("Could not find a database library (probably Sqlite3.dll)");
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool RemoveBan(string ip)
|
||||
public bool RemoveBan(string match, bool byName = false, bool casesensitive = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
return database.Query("DELETE FROM Bans WHERE IP=@0", ip) != 0;
|
||||
if (!byName)
|
||||
return database.Query("DELETE FROM Bans WHERE IP=@0", match) != 0;
|
||||
|
||||
var namecol = casesensitive ? "Name" : "UPPER(Name)";
|
||||
return database.Query("DELETE FROM Bans WHERE " + namecol + "=@0", casesensitive ? match : match.ToUpper()) != 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue