Fixed wiki make I hope HTTP api "ParcelEstate" split into Parcel, Estate ready for more later Datastorage event class for stuff (currently only Estate bans) Class renamed from CliExitOnLogout to Cli. Events moved from athome to Events, and the old Athome renamed attachable
50 lines
2.2 KiB
C#
50 lines
2.2 KiB
C#
using BetterSecondBot.bottypes;
|
|
using BetterSecondBot.Static;
|
|
using EmbedIO;
|
|
using EmbedIO.Routing;
|
|
using EmbedIO.WebApi;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using OpenMetaverse;
|
|
using Newtonsoft.Json;
|
|
using static OpenMetaverse.ParcelManager;
|
|
|
|
namespace BetterSecondBot.HttpService
|
|
{
|
|
class HttpApiParcel : WebApiControllerWithTokens
|
|
{
|
|
public HttpApiParcel(SecondBot mainbot, TokenStorage setuptokens) : base(mainbot, setuptokens) { }
|
|
|
|
[About("Fetchs the parcel ban list of the parcel the bot is currently on<br/>If the name returned is lookup the bot is currently requesting the avatar name")]
|
|
[ReturnHints("array of UUID=Name")]
|
|
[ReturnHints("Error not in a sim")]
|
|
[ReturnHints("Parcel data not ready")]
|
|
[Route(HttpVerbs.Get, "/banlist/{token}")]
|
|
public object parcelbanlist(string token)
|
|
{
|
|
if (tokens.Allow(token, "parcel", "banlist", getClientIP()) == true)
|
|
{
|
|
if (bot.GetClient.Network.CurrentSim != null)
|
|
{
|
|
int localid = bot.GetClient.Parcels.GetParcelLocalID(bot.GetClient.Network.CurrentSim, bot.GetClient.Self.SimPosition);
|
|
Parcel targetparcel = null;
|
|
if (bot.GetClient.Network.CurrentSim.Parcels.ContainsKey(localid) == true)
|
|
{
|
|
targetparcel = bot.GetClient.Network.CurrentSim.Parcels[localid];
|
|
Dictionary<string, string> reply = new Dictionary<string, string>();
|
|
foreach (ParcelAccessEntry e in targetparcel.AccessBlackList)
|
|
{
|
|
string name = bot.FindAvatarKey2Name(e.AgentID);
|
|
reply.Add(e.AgentID.ToString(), name);
|
|
}
|
|
return BasicReply(JsonConvert.SerializeObject(reply));
|
|
}
|
|
return BasicReply("Parcel data not ready");
|
|
}
|
|
return BasicReply("Error not in a sim");
|
|
}
|
|
return BasicReply("Token not accepted");
|
|
}
|
|
}
|
|
}
|