Update Estate.cs
adds update-banlist
This commit is contained in:
parent
dcc4544355
commit
2110987f73
1 changed files with 42 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ using EmbedIO;
|
|||
using EmbedIO.Routing;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace BetterSecondBot.HttpService
|
||||
{
|
||||
|
|
@ -28,5 +29,46 @@ namespace BetterSecondBot.HttpService
|
|||
}
|
||||
return BasicReply("Token not accepted");
|
||||
}
|
||||
|
||||
[About("Attempts to add/remove the avatar to/from the Estate banlist")]
|
||||
[ReturnHints("Request accepted")]
|
||||
[ReturnHints("Unable to find avatar UUID")]
|
||||
[ReturnHints("Unable to process global value please use true or false")]
|
||||
[ReturnHints("Not an estate manager on region {REGIONNAME}")]
|
||||
[ArgHints("avatar", "uuid", "the avatar you wish to ban")]
|
||||
[ArgHints("mode", "add|remove", "What action would you like to take<br/>Defaults to remove if not given \"add\"")]
|
||||
[ArgHints("global", "true|false", "if true this the ban/unban will be applyed to all estates the bot has access to")]
|
||||
[Route(HttpVerbs.Get, "/update-banlist/{avatar}/{mode}/{global}/{token}")]
|
||||
|
||||
public Object UpdateBanlist(string avatar, string mode, string global, string token)
|
||||
{
|
||||
if (tokens.Allow(token, "estate", "banlist-add", getClientIP()) == true)
|
||||
{
|
||||
if(bot.GetClient.Network.CurrentSim.IsEstateManager == false)
|
||||
{
|
||||
return BasicReply("Not an estate manager on region "+ bot.GetClient.Network.CurrentSim.Name);
|
||||
}
|
||||
UUID avataruuid = UUID.Zero;
|
||||
if(UUID.TryParse(avatar,out avataruuid) == false)
|
||||
{
|
||||
return BasicReply("Unable to find avatar UUID");
|
||||
}
|
||||
bool globalban = false;
|
||||
if(bool.TryParse(global,out globalban) == false)
|
||||
{
|
||||
return BasicReply("Unable to process global value please use true or false");
|
||||
}
|
||||
if(mode != "add")
|
||||
{
|
||||
bot.GetClient.Estate.UnbanUser(avataruuid, globalban);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot.GetClient.Estate.BanUser(avataruuid, globalban);
|
||||
}
|
||||
return BasicReply("Request accepted");
|
||||
}
|
||||
return BasicReply("Token not accepted");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue