fix bork'd RequestBanAction
This commit is contained in:
parent
4f708621fa
commit
c0be75434c
2 changed files with 11 additions and 14 deletions
|
|
@ -1709,21 +1709,21 @@ namespace OpenMetaverse
|
||||||
/// <param name="callback">Callback</param>
|
/// <param name="callback">Callback</param>
|
||||||
public void RequestBanAction(UUID groupID, GroupBanAction action, UUID[] agents, EventHandler<EventArgs> callback)
|
public void RequestBanAction(UUID groupID, GroupBanAction action, UUID[] agents, EventHandler<EventArgs> callback)
|
||||||
{
|
{
|
||||||
Uri uri = GetGroupAPIUri(groupID);
|
Uri baseCap = GetGroupAPIUri(groupID);
|
||||||
if (uri == null) { return; }
|
if (baseCap == null)
|
||||||
|
{
|
||||||
Uri cap = Client.Network.CurrentSim.Caps.CapabilityURI("GroupBanAction");
|
Logger.Log("Unable to get Cap url for GroupAPIv1", Helpers.LogLevel.Warning, Client);
|
||||||
if (cap == null) { return; }
|
}
|
||||||
|
|
||||||
OSDMap payload = new OSDMap { ["ban_action"] = (int)action };
|
OSDMap payload = new OSDMap { ["ban_action"] = (int)action };
|
||||||
OSDArray banIDs = new OSDArray(agents.Length);
|
OSDArray banIDs = new OSDArray(agents.Length);
|
||||||
foreach (var agent in agents)
|
for (int i = 0; i < agents.Length; i++)
|
||||||
{
|
{
|
||||||
|
UUID agent = agents[i];
|
||||||
banIDs.Add(agent);
|
banIDs.Add(agent);
|
||||||
}
|
}
|
||||||
payload["ban_ids"] = banIDs;
|
payload["ban_ids"] = banIDs;
|
||||||
|
|
||||||
Task req = Client.HttpCapsClient.PostRequestAsync(cap, OSDFormat.Xml, payload, CancellationToken.None,
|
Task req = Client.HttpCapsClient.PostRequestAsync(baseCap, OSDFormat.Xml, payload, CancellationToken.None,
|
||||||
(response, data, error) =>
|
(response, data, error) =>
|
||||||
{
|
{
|
||||||
if (error != null) { return; }
|
if (error != null) { return; }
|
||||||
|
|
|
||||||
|
|
@ -75,12 +75,9 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
Action = GroupBanAction.Unban;
|
Action = GroupBanAction.Unban;
|
||||||
}
|
}
|
||||||
List<UUID> avatarstoaction =
|
GetClient().Groups.EjectUser(groupuuid, avataruuid); //Eject first
|
||||||
[
|
GetClient().Groups.RequestBanAction(groupuuid, Action, [avataruuid]);
|
||||||
avataruuid
|
return BasicReply("Accepted "+ Action.ToString()+" for "+avataruuid);
|
||||||
];
|
|
||||||
GetClient().Groups.RequestBanAction(groupuuid, Action, [.. avatarstoaction]);
|
|
||||||
return BasicReply("Accepted");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue