Added the ability to delete a ban by name in the same way as a user

This commit is contained in:
stevenh 2012-02-13 18:48:28 +00:00
parent ce5c659e89
commit 78cc7a6f75

View file

@ -123,11 +123,15 @@ throw new Exception("Could not find a database library (probably Sqlite3.dll)");
return false; return false;
} }
public bool RemoveBan(string ip) public bool RemoveBan(string match, bool byName = false, bool casesensitive = true)
{ {
try 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) catch (Exception ex)
{ {