Permalink
Browse files

Minor cleanups in terrain and groups.

  • Loading branch information...
1 parent fd36281 commit b61147611d1d611f49bdf306e8c36ba7c99bed63 @RevolutionSmythe RevolutionSmythe committed Mar 29, 2013
Showing with 292 additions and 2,002 deletions.
  1. +2 −1 Aurora/AuroraDotNetEngine/APIs/OSSL_Api.cs
  2. +189 −0 Aurora/Framework/DatabaseInterfaces/IGroupsServiceConnector.cs
  3. +1 −0 Aurora/Framework/Modules/IGroupsModule.cs
  4. +5 −57 Aurora/Framework/SceneInfo/TerrainUtil.cs
  5. +0 −290 Aurora/Framework/Services/IGroupsServicesConnector.cs
  6. +0 −92 Aurora/Framework/Utilities/WebUtils.cs
  7. +0 −361 Aurora/Modules/Avatar/Groups/AuroraDataGroupsServicesConnectorModule.cs
  8. +25 −24 Aurora/Modules/Avatar/Groups/GroupsModule.cs
  9. +0 −1,092 Aurora/Modules/Avatar/Groups/XmlRpcGroupsServicesConnectorModule.cs
  10. +22 −28 Aurora/Modules/World/Estate/EstateService.cs
  11. +7 −7 Aurora/Modules/World/Monitoring/MonitorModule.cs
  12. +4 −4 Aurora/Modules/World/Startup/RegisterRegionWithGrid.cs
  13. +1 −1 Aurora/Modules/World/Terrain/FloodBrushes/SmoothArea.cs
  14. +1 −1 Aurora/Modules/World/Terrain/ITerrainPaintableEffect.cs
  15. +1 −1 Aurora/Modules/World/Terrain/PaintBrushes/ErodeSphere.cs
  16. +1 −1 Aurora/Modules/World/Terrain/PaintBrushes/FlattenSphere.cs
  17. +1 −1 Aurora/Modules/World/Terrain/PaintBrushes/LowerSphere.cs
  18. +2 −2 Aurora/Modules/World/Terrain/PaintBrushes/NoiseSphere.cs
  19. +1 −1 Aurora/Modules/World/Terrain/PaintBrushes/OlsenSphere.cs
  20. +1 −1 Aurora/Modules/World/Terrain/PaintBrushes/RaiseSphere.cs
  21. +1 −3 Aurora/Modules/World/Terrain/PaintBrushes/RevertSphere.cs
  22. +2 −2 Aurora/Modules/World/Terrain/PaintBrushes/SmoothSphere.cs
  23. +1 −1 Aurora/Modules/World/Terrain/PaintBrushes/WeatherSphere.cs
  24. +14 −22 Aurora/Modules/World/Terrain/TerrainModule.cs
  25. +1 −0 Aurora/Modules/World/WorldMap/WarpTileRenderer.cs
  26. +5 −5 Aurora/Services/GenericServices/InstantMessagingService/InstantMessagingService.cs
  27. +2 −2 .../Services/GenericServices/MessagingService/SyncMessagingServices/LocalSyncMessagePosterService.cs
  28. 0 Aurora/Services/{RedisServices → NoSQLServices}/FileBased/AssetService/FileBasedAssetService.cs
  29. 0 Aurora/Services/{RedisServices → NoSQLServices}/Redis/AssetService/RedisAssetService.cs
  30. 0 Aurora/Services/{RedisServices → NoSQLServices}/Redis/Helpers/RedisConnectionHelper.cs
  31. +1 −1 prebuild.xml
  32. +1 −1 runprebuild.command
View
3 Aurora/AuroraDotNetEngine/APIs/OSSL_Api.cs
@@ -60,6 +60,7 @@
using LSL_Rotation = Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Quaternion;
using LSL_String = Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.LSLString;
using LSL_Vector = Aurora.ScriptEngine.AuroraDotNetEngine.LSL_Types.Vector3;
+using Aurora.Framework.DatabaseInterfaces;
namespace Aurora.ScriptEngine.AuroraDotNetEngine.APIs
{
@@ -2444,7 +2445,7 @@ public LSL_Integer osAddAgentToGroup(LSL_Key AgentID, LSL_String GroupName, LSL_
if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "osAddAgentToGroup", m_host, "OSSL", m_itemID))
return new LSL_Integer();
- IGroupsServicesConnector m_groupData = World.RequestModuleInterface<IGroupsServicesConnector>();
+ IGroupsServiceConnector m_groupData = Aurora.Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector>();
// No groups module, no functionality
if (m_groupData == null)
View
189 Aurora/Framework/DatabaseInterfaces/IGroupsServiceConnector.cs
@@ -30,6 +30,9 @@
using Aurora.Framework.PresenceInfo;
using Aurora.Framework.Services;
using OpenMetaverse;
+using OpenMetaverse.StructuredData;
+using System;
+using Aurora.Framework.Modules;
namespace Aurora.Framework.DatabaseInterfaces
{
@@ -121,4 +124,190 @@ public interface IGroupsServiceConnector : IAuroraDataPlugin
void VoteOnActiveProposals(UUID agentID, UUID groupID, UUID proposalID, string vote);
void AddGroupProposal(UUID agentID, GroupProposalInfo info);
}
+
+ /// <summary>
+ /// Internal class for chat sessions
+ /// </summary>
+ public class ChatSession
+ {
+ public List<ChatSessionMember> Members;
+ public string Name;
+ public UUID SessionID;
+ }
+
+ //Pulled from OpenMetaverse
+ // Summary:
+ // Struct representing a member of a group chat session and their settings
+ public class ChatSessionMember
+ {
+ // Summary:
+ // The OpenMetaverse.UUID of the Avatar
+ public UUID AvatarKey;
+ //
+ // Summary:
+ // True if user has voice chat enabled
+ public bool CanVoiceChat;
+
+ /// <summary>
+ /// Whether the user has accepted being added to the group chat
+ /// </summary>
+ public bool HasBeenAdded;
+
+ /// <summary>
+ /// Whether the user has asked to be removed from the chat
+ /// </summary>
+ public bool RequestedRemoval;
+
+ //
+ // Summary:
+ // True of Avatar has moderator abilities
+ public bool IsModerator;
+ //
+ // Summary:
+ // True if a moderator has muted this avatars chat
+ public bool MuteText;
+ //
+ // Summary:
+ // True if a moderator has muted this avatars voice
+ public bool MuteVoice;
+ //
+ // Summary:
+ // True if they have been requested to join the session
+ }
+
+ public class GroupInviteInfo : IDataTransferable
+ {
+ public UUID AgentID = UUID.Zero;
+ public string FromAgentName = "";
+ public UUID GroupID = UUID.Zero;
+ public UUID InviteID = UUID.Zero;
+ public UUID RoleID = UUID.Zero;
+
+ public GroupInviteInfo()
+ {
+ }
+
+ public override OSDMap ToOSD()
+ {
+ OSDMap values = new OSDMap();
+ values["GroupID"] = GroupID;
+ values["RoleID"] = RoleID;
+ values["AgentID"] = AgentID;
+ values["InviteID"] = InviteID;
+ values["FromAgentName"] = FromAgentName;
+ return values;
+ }
+
+ public override void FromOSD(OSDMap values)
+ {
+ GroupID = values["GroupID"];
+ RoleID = values["RoleID"];
+ AgentID = values["AgentID"];
+ InviteID = values["InviteID"];
+ FromAgentName = values["FromAgentName"];
+ }
+ }
+
+ public class GroupNoticeInfo : IDataTransferable
+ {
+ public byte[] BinaryBucket = new byte[0];
+ public UUID GroupID = UUID.Zero;
+ public string Message = string.Empty;
+ public GroupNoticeData noticeData = new GroupNoticeData();
+
+ public GroupNoticeInfo()
+ {
+ }
+
+ public override OSDMap ToOSD()
+ {
+ OSDMap values = new OSDMap();
+ values["noticeData"] = noticeData.ToOSD();
+ values["GroupID"] = GroupID;
+ values["Message"] = Message;
+ values["BinaryBucket"] = BinaryBucket;
+ return values;
+ }
+
+ public override void FromOSD(OSDMap values)
+ {
+ noticeData = new GroupNoticeData();
+ noticeData.FromOSD((OSDMap)values["noticeData"]);
+ GroupID = values["GroupID"];
+ Message = values["Message"];
+ BinaryBucket = values["BinaryBucket"];
+ }
+ }
+
+ public class GroupProposalInfo : IDataTransferable
+ {
+ public int Duration;
+ public UUID GroupID = UUID.Zero;
+ public float Majority;
+ public int Quorum;
+ public UUID Session = UUID.Zero;
+ public string Text = string.Empty;
+ public UUID BallotInitiator = UUID.Zero;
+ public DateTime Created = DateTime.Now;
+ public DateTime Ending = DateTime.Now;
+ public UUID VoteID = UUID.Random();
+
+ /// <summary>
+ /// Only set when a user is calling to find out proposal info, it is what said user voted
+ /// </summary>
+ public string VoteCast = "";
+
+ /// <summary>
+ /// The result of the proposal (success or failure)
+ /// </summary>
+ public bool Result = false;
+
+ /// <summary>
+ /// The number of votes cast (so far if the proposal is still open)
+ /// </summary>
+ public int NumVotes = 0;
+
+ /// <summary>
+ /// If this is false, the result of the proposal has not been calculated and should be when it is retrieved next
+ /// </summary>
+ public bool HasCalculatedResult = false;
+
+ public override void FromOSD(OSDMap map)
+ {
+ GroupID = map["GroupID"].AsUUID();
+ Duration = map["Duration"].AsInteger();
+ Majority = (float)map["Majority"].AsReal();
+ Text = map["Text"].AsString();
+ Quorum = map["Quorum"].AsInteger();
+ Session = map["Session"].AsUUID();
+ BallotInitiator = map["BallotInitiator"];
+ Created = map["Created"];
+ Ending = map["Ending"];
+ VoteID = map["VoteID"];
+ VoteCast = map["VoteCast"];
+ Result = map["Result"];
+ NumVotes = map["NumVotes"];
+ HasCalculatedResult = map["HasCalculatedResult"];
+ }
+
+ public override OSDMap ToOSD()
+ {
+ OSDMap map = new OSDMap();
+ map["GroupID"] = GroupID;
+ map["Duration"] = Duration;
+ map["Majority"] = Majority;
+ map["Text"] = Text;
+ map["Quorum"] = Quorum;
+ map["Session"] = Session;
+ map["BallotInitiator"] = BallotInitiator;
+ map["Created"] = Created;
+ map["Ending"] = Ending;
+ map["VoteID"] = VoteID;
+ map["VoteCast"] = VoteCast;
+ map["Result"] = Result;
+ map["NumVotes"] = NumVotes;
+ map["HasCalculatedResult"] = HasCalculatedResult;
+ return map;
+ }
+ }
}
View
1 Aurora/Framework/Modules/IGroupsModule.cs
@@ -30,6 +30,7 @@
using Aurora.Framework.PresenceInfo;
using Aurora.Framework.Services;
using OpenMetaverse;
+using Aurora.Framework.DatabaseInterfaces;
namespace Aurora.Framework.Modules
{
View
62 Aurora/Framework/SceneInfo/TerrainUtil.cs
@@ -45,61 +45,19 @@ public static float SphericalFactor(float x, float y, float rx, float ry, float
return size*size - ((x - rx)*(x - rx) + (y - ry)*(y - ry));
}
- public static float GetBilinearInterpolate(float x, float y, ITerrainChannel map, List<IScene> scenes)
+ public static float GetBilinearInterpolate(float x, float y, ITerrainChannel map)
{
int w = map.Width;
int h = map.Height;
- IScene scene = null;
-
if (x > w - 2)
- {
- scene = FindScene(map, scenes, map.Scene.RegionInfo.RegionSizeX, 0);
- if (scene != null)
- {
- //Fix this position in the new heightmap
- x -= w;
- map = scene.RequestModuleInterface<ITerrainChannel>();
- }
- else //1 away from the edge if we don't have a sim on this instance
- x = w - 2;
- }
+ x = w - 2;
if (y > h - 2)
- {
- scene = FindScene(map, scenes, 0, map.Scene.RegionInfo.RegionSizeY);
- if (scene != null)
- {
- //Fix this position in the new heightmap
- y -= h;
- map = scene.RequestModuleInterface<ITerrainChannel>();
- }
- else //1 away from the edge if we don't have a sim on this instance
- y = h - 2;
- }
+ y = h - 2;
if (x < 0.0)
- {
- scene = FindScene(map, scenes, -map.Scene.RegionInfo.RegionSizeX, 0);
- if (scene != null)
- {
- //Fix this position in the new heightmap
- x += w;
- map = scene.RequestModuleInterface<ITerrainChannel>();
- }
- else //1 away from the edge if we don't have a sim on this instance
- x = 0;
- }
+ x = 1.0f;
if (y < 0.0)
- {
- scene = FindScene(map, scenes, 0, -map.Scene.RegionInfo.RegionSizeY);
- if (scene != null)
- {
- //Fix this position in the new heightmap
- y += h;
- map = scene.RequestModuleInterface<ITerrainChannel>();
- }
- else //1 away from the edge if we don't have a sim on this instance
- y = 0;
- }
+ y = 1.0f;
if (x > map.Width - 2)
x = map.Width - 2;
@@ -129,16 +87,6 @@ public static float GetBilinearInterpolate(float x, float y, ITerrainChannel map
return hi;
}
- private static IScene FindScene(ITerrainChannel map, List<IScene> scenes, int X, int Y)
- {
- int RegX = map.Scene.RegionInfo.RegionLocX + X;
- int RegY = map.Scene.RegionInfo.RegionLocY + Y;
-
- return
- scenes.FirstOrDefault(
- scene => scene.RegionInfo.RegionLocX == RegX && scene.RegionInfo.RegionLocY == RegY);
- }
-
private static float Noise(float x, float y)
{
int n = (int) x + (int) (y*749);
View
290 Aurora/Framework/Services/IGroupsServicesConnector.cs
@@ -1,290 +0,0 @@
-/*
- * Copyright (c) Contributors, http://aurora-sim.org/, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Aurora-Sim Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using System;
-using System.Collections.Generic;
-using Aurora.Framework.ClientInterfaces;
-using Aurora.Framework.Modules;
-using Aurora.Framework.PresenceInfo;
-using OpenMetaverse;
-using OpenMetaverse.StructuredData;
-
-namespace Aurora.Framework.Services
-{
- public interface IGroupsServicesConnector
- {
- UUID CreateGroup(UUID RequestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
- int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID);
-
- void UpdateGroup(UUID RequestingAgentID, UUID groupID, string charter, bool showInList, UUID insigniaID,
- int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
-
- GroupRecord GetGroupRecord(UUID RequestingAgentID, UUID GroupID, string GroupName);
- GroupProfileData GetGroupProfile(UUID RequestingAgentID, UUID GroupID);
-
- List<DirGroupsReplyData> FindGroups(UUID RequestingAgentID, string search, uint? start, uint? count,
- uint queryFlags);
-
- List<GroupMembersData> GetGroupMembers(UUID RequestingAgentID, UUID GroupID);
-
- void AddGroupRole(UUID RequestingAgentID, UUID groupID, UUID roleID, string name, string description,
- string title, ulong powers);
-
- void UpdateGroupRole(UUID RequestingAgentID, UUID groupID, UUID roleID, string name, string description,
- string title, ulong powers);
-
- void RemoveGroupRole(UUID RequestingAgentID, UUID groupID, UUID roleID);
- List<GroupRolesData> GetGroupRoles(UUID RequestingAgentID, UUID GroupID);
- List<GroupRoleMembersData> GetGroupRoleMembers(UUID RequestingAgentID, UUID GroupID);
-
- void AddAgentToGroup(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID);
- bool RemoveAgentFromGroup(UUID RequestingAgentID, UUID AgentID, UUID GroupID);
-
- void AddAgentToGroupInvite(UUID RequestingAgentID, UUID inviteID, UUID groupID, UUID roleID,
- UUID agentIDFromAgentName, string FromAgentName);
-
- GroupInviteInfo GetAgentToGroupInvite(UUID RequestingAgentID, UUID inviteID);
- void RemoveAgentToGroupInvite(UUID RequestingAgentID, UUID inviteID);
-
- void AddAgentToGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID);
- void RemoveAgentFromGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID);
- List<GroupRolesData> GetAgentGroupRoles(UUID RequestingAgentID, UUID AgentID, UUID GroupID);
-
- string SetAgentActiveGroup(UUID RequestingAgentID, UUID AgentID, UUID GroupID);
- GroupMembershipData GetAgentActiveMembership(UUID RequestingAgentID, UUID AgentID);
-
- string SetAgentActiveGroupRole(UUID RequestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID);
-
- void SetAgentGroupInfo(UUID RequestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices,
- bool ListInProfile);
-
- GroupMembershipData GetAgentGroupMembership(UUID RequestingAgentID, UUID AgentID, UUID GroupID);
- List<GroupMembershipData> GetAgentGroupMemberships(UUID RequestingAgentID, UUID AgentID);
-
- void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject,
- string message, UUID ItemID, int AssetType, string ItemName);
-
- GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID);
- List<GroupNoticeData> GetGroupNotices(UUID RequestingAgentID, UUID GroupID);
-
- List<GroupInviteInfo> GetGroupInvites(UUID requestingAgentID);
- void AddGroupProposal(UUID agentID, GroupProposalInfo info);
-
- List<GroupTitlesData> GetGroupTitles(UUID agentID, UUID groupID);
-
- List<GroupProposalInfo> GetActiveProposals(UUID agentID, UUID groupID);
- List<GroupProposalInfo> GetInactiveProposals(UUID agentID, UUID groupID);
-
- void VoteOnActiveProposals(UUID agentID, UUID groupID, UUID proposalID, string vote);
- }
-
- /// <summary>
- /// Internal class for chat sessions
- /// </summary>
- public class ChatSession
- {
- public List<ChatSessionMember> Members;
- public string Name;
- public UUID SessionID;
- }
-
- //Pulled from OpenMetaverse
- // Summary:
- // Struct representing a member of a group chat session and their settings
- public class ChatSessionMember
- {
- // Summary:
- // The OpenMetaverse.UUID of the Avatar
- public UUID AvatarKey;
- //
- // Summary:
- // True if user has voice chat enabled
- public bool CanVoiceChat;
-
- /// <summary>
- /// Whether the user has accepted being added to the group chat
- /// </summary>
- public bool HasBeenAdded;
-
- /// <summary>
- /// Whether the user has asked to be removed from the chat
- /// </summary>
- public bool RequestedRemoval;
-
- //
- // Summary:
- // True of Avatar has moderator abilities
- public bool IsModerator;
- //
- // Summary:
- // True if a moderator has muted this avatars chat
- public bool MuteText;
- //
- // Summary:
- // True if a moderator has muted this avatars voice
- public bool MuteVoice;
- //
- // Summary:
- // True if they have been requested to join the session
- }
-
- public class GroupInviteInfo : IDataTransferable
- {
- public UUID AgentID = UUID.Zero;
- public string FromAgentName = "";
- public UUID GroupID = UUID.Zero;
- public UUID InviteID = UUID.Zero;
- public UUID RoleID = UUID.Zero;
-
- public GroupInviteInfo()
- {
- }
-
- public override OSDMap ToOSD()
- {
- OSDMap values = new OSDMap();
- values["GroupID"] = GroupID;
- values["RoleID"] = RoleID;
- values["AgentID"] = AgentID;
- values["InviteID"] = InviteID;
- values["FromAgentName"] = FromAgentName;
- return values;
- }
-
- public override void FromOSD(OSDMap values)
- {
- GroupID = values["GroupID"];
- RoleID = values["RoleID"];
- AgentID = values["AgentID"];
- InviteID = values["InviteID"];
- FromAgentName = values["FromAgentName"];
- }
- }
-
- public class GroupNoticeInfo : IDataTransferable
- {
- public byte[] BinaryBucket = new byte[0];
- public UUID GroupID = UUID.Zero;
- public string Message = string.Empty;
- public GroupNoticeData noticeData = new GroupNoticeData();
-
- public GroupNoticeInfo()
- {
- }
-
- public override OSDMap ToOSD()
- {
- OSDMap values = new OSDMap();
- values["noticeData"] = noticeData.ToOSD();
- values["GroupID"] = GroupID;
- values["Message"] = Message;
- values["BinaryBucket"] = BinaryBucket;
- return values;
- }
-
- public override void FromOSD(OSDMap values)
- {
- noticeData = new GroupNoticeData();
- noticeData.FromOSD((OSDMap) values["noticeData"]);
- GroupID = values["GroupID"];
- Message = values["Message"];
- BinaryBucket = values["BinaryBucket"];
- }
- }
-
- public class GroupProposalInfo : IDataTransferable
- {
- public int Duration;
- public UUID GroupID = UUID.Zero;
- public float Majority;
- public int Quorum;
- public UUID Session = UUID.Zero;
- public string Text = string.Empty;
- public UUID BallotInitiator = UUID.Zero;
- public DateTime Created = DateTime.Now;
- public DateTime Ending = DateTime.Now;
- public UUID VoteID = UUID.Random();
-
- /// <summary>
- /// Only set when a user is calling to find out proposal info, it is what said user voted
- /// </summary>
- public string VoteCast = "";
-
- /// <summary>
- /// The result of the proposal (success or failure)
- /// </summary>
- public bool Result = false;
-
- /// <summary>
- /// The number of votes cast (so far if the proposal is still open)
- /// </summary>
- public int NumVotes = 0;
-
- /// <summary>
- /// If this is false, the result of the proposal has not been calculated and should be when it is retrieved next
- /// </summary>
- public bool HasCalculatedResult = false;
-
- public override void FromOSD(OSDMap map)
- {
- GroupID = map["GroupID"].AsUUID();
- Duration = map["Duration"].AsInteger();
- Majority = (float) map["Majority"].AsReal();
- Text = map["Text"].AsString();
- Quorum = map["Quorum"].AsInteger();
- Session = map["Session"].AsUUID();
- BallotInitiator = map["BallotInitiator"];
- Created = map["Created"];
- Ending = map["Ending"];
- VoteID = map["VoteID"];
- VoteCast = map["VoteCast"];
- Result = map["Result"];
- NumVotes = map["NumVotes"];
- HasCalculatedResult = map["HasCalculatedResult"];
- }
-
- public override OSDMap ToOSD()
- {
- OSDMap map = new OSDMap();
- map["GroupID"] = GroupID;
- map["Duration"] = Duration;
- map["Majority"] = Majority;
- map["Text"] = Text;
- map["Quorum"] = Quorum;
- map["Session"] = Session;
- map["BallotInitiator"] = BallotInitiator;
- map["Created"] = Created;
- map["Ending"] = Ending;
- map["VoteID"] = VoteID;
- map["VoteCast"] = VoteCast;
- map["Result"] = Result;
- map["NumVotes"] = NumVotes;
- map["HasCalculatedResult"] = HasCalculatedResult;
- return map;
- }
- }
-}
View
92 Aurora/Framework/Utilities/WebUtils.cs
@@ -48,14 +48,6 @@ namespace Aurora.Framework.Utilities
{
public static class WebUtils
{
- // this is the header field used to communicate the local request id
- // used for performance and debugging
- public const string OSHeaderRequestID = "opensim-request-id";
-
- // number of milliseconds a call can take before it is considered
- // a "long" call for warning & debugging purposes
- public const int LongCallTime = 500;
-
private const int m_defaultTimeout = 10000;
#if NET_4_5
@@ -102,8 +94,6 @@ public static void DeleteFromService(string url)
t.Wait();
}
- public delegate void FinishedRequest(string response);
-
public static async Task<string> ServiceOSDRequest(string url, OSDMap data, string method, int timeout)
{
string errorMessage = "", response = null;
@@ -364,11 +354,6 @@ public static string[] GetPreferredImageTypes(string accept)
return new string[0];
}
- public static OSDMap GetOSDMap(string data)
- {
- return GetOSDMap(data, true);
- }
-
public static OSDMap GetOSDMap(string data, bool doLogMessages)
{
if (data == "")
@@ -444,83 +429,6 @@ private float GetQ(Object o)
#endregion
}
- /// <summary>
- /// Class supporting the request side of an XML-RPC transaction.
- /// </summary>
- public sealed class ConfigurableKeepAliveXmlRpcRequest : XmlRpcRequest
- {
- private readonly XmlRpcResponseDeserializer _deserializer = new XmlRpcResponseDeserializer();
- private readonly bool _disableKeepAlive = true;
- private readonly Encoding _encoding = new ASCIIEncoding();
- private readonly XmlRpcRequestSerializer _serializer = new XmlRpcRequestSerializer();
-
- public string RequestResponse = String.Empty;
-
- /// <summary>
- /// Instantiate an <c>XmlRpcRequest</c> for a specified method and parameters.
- /// </summary>
- /// <param name="methodName">
- /// <c>String</c> designating the <i>object.method</i> on the server the request
- /// should be directed to.
- /// </param>
- /// <param name="parameters">
- /// <c>ArrayList</c> of XML-RPC type parameters to invoke the request with.
- /// </param>
- /// <param name="disableKeepAlive"></param>
- public ConfigurableKeepAliveXmlRpcRequest(String methodName, IList parameters, bool disableKeepAlive)
- {
- MethodName = methodName;
- _params = parameters;
- _disableKeepAlive = disableKeepAlive;
- }
-
- /// <summary>
- /// Send the request to the server.
- /// </summary>
- /// <param name="url">
- /// <c>String</c> The url of the XML-RPC server.
- /// </param>
- /// <returns>
- /// <c>XmlRpcResponse</c> The response generated.
- /// </returns>
- public XmlRpcResponse Send(String url)
- {
- HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
- if (request == null)
- throw new XmlRpcException(XmlRpcErrorCodes.TRANSPORT_ERROR,
- XmlRpcErrorCodes.TRANSPORT_ERROR_MSG + ": Could not create request with " +
- url);
- request.Method = "POST";
- request.ContentType = "text/xml";
- request.AllowWriteStreamBuffering = true;
- request.KeepAlive = !_disableKeepAlive;
-
- Stream stream = request.GetRequestStream();
- XmlTextWriter xml = new XmlTextWriter(stream, _encoding);
- _serializer.Serialize(xml, this);
- xml.Flush();
- xml.Close();
-
- HttpWebResponse response = (HttpWebResponse) request.GetResponse();
- StreamReader input = new StreamReader(response.GetResponseStream());
-
- string inputXml = input.ReadToEnd();
- XmlRpcResponse resp;
- try
- {
- resp = (XmlRpcResponse) _deserializer.Deserialize(inputXml);
- }
- catch (Exception)
- {
- RequestResponse = inputXml;
- throw;
- }
- input.Close();
- response.Close();
- return resp;
- }
- }
-
public static class XMLUtils
{
public static string BuildXmlResponse(Dictionary<string, object> data)
View
361 Aurora/Modules/Avatar/Groups/AuroraDataGroupsServicesConnectorModule.cs
@@ -1,361 +0,0 @@
-/*
- * Copyright (c) Contributors, http://aurora-sim.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Aurora-Sim Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using Aurora.Framework;
-using Aurora.Framework.ClientInterfaces;
-using Aurora.Framework.ConsoleFramework;
-using Aurora.Framework.DatabaseInterfaces;
-using Aurora.Framework.Modules;
-using Aurora.Framework.PresenceInfo;
-using Aurora.Framework.SceneInfo;
-using Aurora.Framework.Services;
-using Nini.Config;
-using OpenMetaverse;
-using System;
-using System.Collections.Generic;
-
-namespace Aurora.Modules.Groups
-{
- public class AuroraDataGroupsServicesConnectorModule : INonSharedRegionModule, IGroupsServicesConnector
- {
- private readonly Dictionary<UUID, ChatSession> ChatSessions = new Dictionary<UUID, ChatSession>();
- private IGroupsServiceConnector GroupsConnector;
- private IUserAccountService m_accountService;
-
- private bool m_connectorEnabled;
-
- #region IGroupsServicesConnector Members
-
- /// <summary>
- /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
- /// </summary>
- public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
- int membershipFee, bool openEnrollment, bool allowPublish,
- bool maturePublish, UUID founderID)
- {
- UUID GroupID = UUID.Random();
- UUID OwnerRoleID = UUID.Random();
-
- GroupsConnector.CreateGroup(GroupID, name, charter, showInList,
- insigniaID, 0, openEnrollment, allowPublish, maturePublish, founderID,
- OwnerRoleID);
-
- return GroupID;
- }
-
- public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList,
- UUID insigniaID, int membershipFee, bool openEnrollment,
- bool allowPublish, bool maturePublish)
- {
- GroupsConnector.UpdateGroup(requestingAgentID, groupID, charter,
- showInList ? 1 : 0, insigniaID, membershipFee,
- openEnrollment ? 1 : 0, allowPublish ? 1 : 0,
- maturePublish ? 1 : 0);
- }
-
- public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
- string title, ulong powers)
- {
- GroupsConnector.AddRoleToGroup(requestingAgentID, groupID, roleID, name, description, title, powers);
- }
-
- public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID)
- {
- GroupsConnector.RemoveRoleFromGroup(requestingAgentID, roleID, groupID);
- }
-
- public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
- string title, ulong powers)
- {
- GroupsConnector.UpdateRole(requestingAgentID, groupID, roleID, name, description, title, powers);
- }
-
- public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName)
- {
- return GroupsConnector.GetGroupRecord(requestingAgentID, GroupID, GroupName);
- }
-
- public string SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
- {
- return GroupsConnector.SetAgentActiveGroup(AgentID, GroupID);
- }
-
- public string SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
- {
- return GroupsConnector.SetAgentGroupSelectedRole(AgentID, GroupID, RoleID);
- }
-
- public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices,
- bool ListInProfile)
- {
- GroupsConnector.SetAgentGroupInfo(requestingAgentID, AgentID, GroupID, AcceptNotices ? 1 : 0,
- ListInProfile ? 1 : 0);
- }
-
- public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID,
- string FromAgentName)
- {
- GroupsConnector.AddAgentGroupInvite(requestingAgentID, inviteID, groupID, roleID, agentID, FromAgentName);
- }
-
- public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
- {
- return GroupsConnector.GetAgentToGroupInvite(requestingAgentID, inviteID);
- }
-
- public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
- {
- GroupsConnector.RemoveAgentInvite(requestingAgentID, inviteID);
- }
-
- public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
- {
- GroupsConnector.AddAgentToGroup(requestingAgentID, AgentID, GroupID, RoleID);
- }
-
- public bool RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
- {
- return GroupsConnector.RemoveAgentFromGroup(requestingAgentID, AgentID, GroupID);
- }
-
- public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
- {
- GroupsConnector.AddAgentToRole(requestingAgentID, AgentID, GroupID, RoleID);
- }
-
- public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
- {
- GroupsConnector.RemoveAgentFromRole(requestingAgentID, AgentID, GroupID, RoleID);
- }
-
- public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search, uint? start, uint? count,
- uint queryflags)
- {
- //TODO: Fix this.. should be in the search module
- return GroupsConnector.FindGroups(requestingAgentID, search, start, count, queryflags);
- }
-
- public GroupProfileData GetGroupProfile(UUID requestingAgentID, UUID GroupID)
- {
- return GroupsConnector.GetGroupProfile(requestingAgentID, GroupID);
- }
-
- public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID)
- {
- return GroupsConnector.GetGroupMembershipData(requestingAgentID, GroupID, AgentID);
- }
-
- public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID)
- {
- return GroupsConnector.GetGroupMembershipData(requestingAgentID,
- UUID.Zero,
- AgentID);
- }
-
- public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID)
- {
- return GroupsConnector.GetAgentGroupMemberships(requestingAgentID, AgentID);
- }
-
- public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID)
- {
- return GroupsConnector.GetAgentGroupRoles(requestingAgentID, AgentID, GroupID);
- }
-
- public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
- {
- return GroupsConnector.GetGroupRoles(requestingAgentID, GroupID);
- }
-
- public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
- {
- return GroupsConnector.GetGroupMembers(requestingAgentID, GroupID);
- }
-
- public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
- {
- return GroupsConnector.GetGroupRoleMembers(requestingAgentID, GroupID);
- }
-
- public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
- {
- return GetGroupNotices(requestingAgentID, 0, 0, GroupID);
- }
-
- public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, uint start, uint count, UUID GroupID)
- {
- return GroupsConnector.GetGroupNotices(requestingAgentID, start, count, GroupID);
- }
-
- public List<GroupTitlesData> GetGroupTitles(UUID requestingAgentID, UUID GroupID)
- {
- return GroupsConnector.GetGroupTitles(requestingAgentID, GroupID);
- }
-
- public uint GetNumberOfGroupNotices(UUID requestingAgentID, UUID GroupID)
- {
- return GroupsConnector.GetNumberOfGroupNotices(requestingAgentID, GroupID);
- }
-
- public uint GetNumberOfGroupNotices(UUID requestingAgentID, List<UUID> GroupIDs)
- {
- return GroupsConnector.GetNumberOfGroupNotices(requestingAgentID, GroupIDs);
- }
-
- public GroupNoticeData GetGroupNoticeData(UUID requestingAgentID, UUID noticeID)
- {
- return GroupsConnector.GetGroupNoticeData(requestingAgentID, noticeID);
- }
-
- public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
- {
- return GroupsConnector.GetGroupNotice(requestingAgentID, noticeID);
- }
-
- public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject,
- string message, UUID ItemID, int AssetType, string ItemName)
- {
- GroupsConnector.AddGroupNotice(requestingAgentID, groupID, noticeID, fromName, subject, message, ItemID,
- AssetType, ItemName);
- }
-
- public void AddGroupProposal(UUID agentID, GroupProposalInfo info)
- {
- GroupsConnector.AddGroupProposal(agentID, info);
- }
-
- public void VoteOnActiveProposals(UUID agentID, UUID groupID, UUID proposalID, string vote)
- {
- GroupsConnector.VoteOnActiveProposals(agentID, groupID, proposalID, vote);
- }
-
- public List<GroupInviteInfo> GetGroupInvites(UUID requestingAgentID)
- {
- return GroupsConnector.GetGroupInvites(requestingAgentID);
- }
-
- public List<GroupProposalInfo> GetActiveProposals(UUID agentID, UUID groupID)
- {
- return GroupsConnector.GetActiveProposals(agentID, groupID);
- }
-
- public List<GroupProposalInfo> GetInactiveProposals(UUID agentID, UUID groupID)
- {
- return GroupsConnector.GetInactiveProposals(agentID, groupID);
- }
-
- #endregion
-
- #region INonSharedRegionModule Members
-
- public string Name
- {
- get { return "AuroraDataGroupsServicesConnectorModule"; }
- }
-
- // this module is not intended to be replaced, but there should only be 1 of them.
- public Type ReplaceableInterface
- {
- get { return null; }
- }
-
- public void Initialise(IConfigSource config)
- {
- IConfig groupsConfig = config.Configs["Groups"];
-
- if (groupsConfig == null)
- {
- // Do not run this module by default.
- return;
- }
- else
- {
- // if groups aren't enabled, we're not needed.
- // if we're not specified as the connector to use, then we're not wanted
- if ((groupsConfig.GetBoolean("Enabled", false) == false)
- || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name))
- {
- m_connectorEnabled = false;
- return;
- }
-
- //MainConsole.Instance.InfoFormat("[AURORA-GROUPS-CONNECTOR]: Initializing {0}", this.Name);
-
- m_connectorEnabled = true;
- }
- }
-
- public void Close()
- {
- MainConsole.Instance.InfoFormat("[AURORA-GROUPS-CONNECTOR]: Closing {0}", this.Name);
- }
-
- public void AddRegion(IScene scene)
- {
- GroupsConnector = Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector>();
- if (GroupsConnector == null)
- {
- MainConsole.Instance.Warn("[AURORA-GROUPS-CONNECTOR]: GroupsConnector is null");
- m_connectorEnabled = false;
- }
- if (m_connectorEnabled)
- {
- if (m_accountService == null)
- {
- m_accountService = scene.UserAccountService;
- }
- scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
- }
- }
-
- public void RemoveRegion(IScene scene)
- {
- if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this)
- {
- scene.UnregisterModuleInterface<IGroupsServicesConnector>(this);
- }
- }
-
- public void RegionLoaded(IScene scene)
- {
- }
-
- #endregion
-
- public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
- {
- GroupMembershipData MemberInfo = GroupsConnector.GetGroupMembershipData(requestingAgentID, GroupID, AgentID);
- GroupProfileData MemberGroupProfile = GroupsConnector.GetMemberGroupProfile(requestingAgentID, GroupID,
- AgentID);
-
- MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
- MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
-
- return MemberGroupProfile;
- }
- }
-}
View
49 Aurora/Modules/Avatar/Groups/GroupsModule.cs
@@ -28,6 +28,7 @@
using Aurora.Framework;
using Aurora.Framework.ClientInterfaces;
using Aurora.Framework.ConsoleFramework;
+using Aurora.Framework.DatabaseInterfaces;
using Aurora.Framework.Modules;
using Aurora.Framework.PresenceInfo;
using Aurora.Framework.SceneInfo;
@@ -79,7 +80,7 @@ public class GroupsModule : INonSharedRegionModule, IGroupsModule
// Configuration settings
private bool m_debugEnabled = true;
- private IGroupsServicesConnector m_groupData;
+ private IGroupsServiceConnector m_groupData;
private bool m_groupNoticesEnabled = true;
private bool m_groupsEnabled;
private IMessageTransferModule m_msgTransferModule;
@@ -104,8 +105,7 @@ public void ActivateGroup(IClientAPI remoteClient, UUID groupID)
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);
- string title = m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient),
- GetRequestingAgentID(remoteClient), groupID);
+ string title = m_groupData.SetAgentActiveGroup(GetRequestingAgentID(remoteClient), groupID);
m_cachedGroupTitles.Remove(remoteClient.AgentId);
// Changing active group changes title, active powers, all kinds of things
// anyone who is in any region that can see this client, should probably be
@@ -203,8 +203,8 @@ public GroupMembershipData GetMembershipData(UUID groupID, UUID agentID)
MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);
// Note: Permissions checking for modification rights is handled by the Groups Server/Service
- m_groupData.UpdateGroup(GetRequestingAgentID(remoteClient), groupID, charter, showInList, insigniaID,
- membershipFee, openEnrollment, allowPublish, maturePublish);
+ m_groupData.UpdateGroup(GetRequestingAgentID(remoteClient), groupID, charter, showInList ? 1 : 0, insigniaID,
+ membershipFee, openEnrollment ? 1 : 0, allowPublish ? 1 : 0, maturePublish ? 1 : 0);
NullCacheInfos(groupID);
}
@@ -215,7 +215,7 @@ public void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool ac
MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);
m_groupData.SetAgentGroupInfo(GetRequestingAgentID(remoteClient), GetRequestingAgentID(remoteClient),
- groupID, acceptNotices, listInProfile);
+ groupID, acceptNotices ? 1 : 0, listInProfile ? 1 : 0);
NullCacheInfos(remoteClient.AgentId, groupID);
}
@@ -264,9 +264,10 @@ private void NullCacheInfos(UUID agentID, UUID groupID)
return UUID.Zero;
}
}
- UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList,
- insigniaID, membershipFee, openEnrollment, allowPublish,
- maturePublish, GetRequestingAgentID(remoteClient));
+ UUID groupID = UUID.Random();
+ m_groupData.CreateGroup(groupID, name, charter, showInList,
+ insigniaID, membershipFee, openEnrollment, allowPublish,
+ maturePublish, GetRequestingAgentID(remoteClient), UUID.Random());
remoteClient.SendCreateGroupReply(groupID, true, "Group created successfullly");
m_cachedGroupTitles[remoteClient.AgentId] =
@@ -284,7 +285,7 @@ public GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID g
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);
- return m_groupData.GetGroupNotices(GetRequestingAgentID(remoteClient), groupID).ToArray();
+ return m_groupData.GetGroupNotices(GetRequestingAgentID(remoteClient), 0,0, groupID).ToArray();
}
/// <summary>
@@ -300,7 +301,7 @@ public string GetGroupTitle(UUID avatarID)
if (m_cachedGroupTitles.ContainsKey(avatarID))
membership = m_cachedGroupTitles[avatarID];
else
- membership = m_groupData.GetAgentActiveMembership(avatarID, avatarID);
+ membership = m_groupData.GetGroupMembershipData(avatarID, UUID.Zero, avatarID);
if (membership != null)
{
@@ -319,8 +320,7 @@ public void GroupTitleUpdate(IClientAPI remoteClient, UUID groupID, UUID titleRo
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);
- string title = m_groupData.SetAgentActiveGroupRole(GetRequestingAgentID(remoteClient),
- GetRequestingAgentID(remoteClient), groupID, titleRoleID);
+ string title = m_groupData.SetAgentGroupSelectedRole(GetRequestingAgentID(remoteClient), groupID, titleRoleID);
m_cachedGroupTitles.Remove(remoteClient.AgentId);
// TODO: Not sure what all is needed here, but if the active group role change is for the group
// the client currently has set active, then we need to do a scene presence update too
@@ -355,12 +355,12 @@ public void UpdateUsersForExternalRoleUpdate(UUID groupID, UUID roleID, UUID reg
switch ((GroupRoleUpdate) updateType)
{
case OpenMetaverse.GroupRoleUpdate.Create:
- m_groupData.AddGroupRole(GetRequestingAgentID(remoteClient), groupID, UUID.Random(), name,
+ m_groupData.AddRoleToGroup(GetRequestingAgentID(remoteClient), groupID, UUID.Random(), name,
description, title, powers);
break;
case OpenMetaverse.GroupRoleUpdate.Delete:
- m_groupData.RemoveGroupRole(GetRequestingAgentID(remoteClient), groupID, roleID);
+ m_groupData.RemoveRoleFromGroup(GetRequestingAgentID(remoteClient), roleID, groupID);
break;
case OpenMetaverse.GroupRoleUpdate.UpdateAll:
@@ -372,7 +372,7 @@ public void UpdateUsersForExternalRoleUpdate(UUID groupID, UUID roleID, UUID reg
MainConsole.Instance.DebugFormat("[GROUPS]: Role ({0}) updated with Powers ({1}) ({2})", name,
powers.ToString(), gp.ToString());
}
- m_groupData.UpdateGroupRole(GetRequestingAgentID(remoteClient), groupID, roleID, name, description,
+ m_groupData.UpdateRole(GetRequestingAgentID(remoteClient), groupID, roleID, name, description,
title, powers);
RemoveFromGroupPowersCache(groupID);
break;
@@ -407,12 +407,12 @@ public void GroupRoleChanges(IClientAPI remoteClient, UUID groupID, UUID roleID,
{
case 0:
// Add
- m_groupData.AddAgentToGroupRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID);
+ m_groupData.AddAgentToRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID);
break;
case 1:
// Remove
- m_groupData.RemoveAgentFromGroupRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID);
+ m_groupData.RemoveAgentFromRole(GetRequestingAgentID(remoteClient), memberID, groupID, roleID);
break;
default:
@@ -717,7 +717,7 @@ public void InviteGroup(IClientAPI remoteClient, UUID agentID, UUID groupID, UUI
UUID InviteID = UUID.Random();
- m_groupData.AddAgentToGroupInvite(GetRequestingAgentID(remoteClient), InviteID, groupID, roleID,
+ m_groupData.AddAgentGroupInvite(GetRequestingAgentID(remoteClient), InviteID, groupID, roleID,
invitedAgentID, remoteClient.Name);
// Check to see if the invite went through, if it did not then it's possible
@@ -1113,7 +1113,7 @@ public void RegionLoaded(IScene scene)
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: {0} called", MethodBase.GetCurrentMethod().Name);
- m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();
+ m_groupData = Aurora.Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector>();
// No Groups Service Connector, then nothing works...
if (m_groupData == null)
@@ -1463,8 +1463,9 @@ private void OnAgentDataUpdateRequest(IClientAPI remoteClient, UUID dataForAgent
GroupMembershipData membership = m_cachedGroupTitles.ContainsKey(dataForAgentID)
? m_cachedGroupTitles[dataForAgentID]
- : m_groupData.GetAgentActiveMembership(
+ : m_groupData.GetGroupMembershipData(
GetRequestingAgentID(remoteClient),
+ UUID.Zero,
dataForAgentID);
m_cachedGroupTitles[dataForAgentID] = membership;
if (membership != null)
@@ -1569,7 +1570,7 @@ private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
UpdateAllClientsWithGroupInfo(inviteInfo.AgentID, gmd.GroupTitle);
SendAgentGroupDataUpdate(remoteClient);
- m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID);
+ m_groupData.RemoveAgentInvite(GetRequestingAgentID(remoteClient), inviteID);
}
}
@@ -1578,7 +1579,7 @@ private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
{
if (m_debugEnabled)
MainConsole.Instance.DebugFormat("[GROUPS]: Received a reject invite notice.");
- m_groupData.RemoveAgentToGroupInvite(GetRequestingAgentID(remoteClient), inviteID);
+ m_groupData.RemoveAgentInvite(GetRequestingAgentID(remoteClient), inviteID);
}
RemoveFromGroupPowersCache(remoteClient.AgentId, inviteInfo.GroupID);
}
@@ -1785,7 +1786,7 @@ private GroupMembershipData AttemptFindGroupMembershipData(UUID requestingAgentI
from d in m_cachedGroupMemberships[agentID] where d.GroupID == groupID select d)
return data;
}
- return m_groupData.GetAgentGroupMembership(requestingAgentID, agentID, groupID);
+ return m_groupData.GetGroupMembershipData(requestingAgentID, groupID, agentID);
}
private void OnGridInstantMessage(GridInstantMessage msg)
View
1,092 Aurora/Modules/Avatar/Groups/XmlRpcGroupsServicesConnectorModule.cs
@@ -1,1092 +0,0 @@
-/*
- * Copyright (c) Contributors, http://aurora-sim.org/, http://opensimulator.org/
- * See CONTRIBUTORS.TXT for a full list of copyright holders.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Aurora-Sim Project nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-using Aurora.Framework;
-using Aurora.Framework.ClientInterfaces;
-using Aurora.Framework.ConsoleFramework;
-using Aurora.Framework.Modules;
-using Aurora.Framework.PresenceInfo;
-using Aurora.Framework.SceneInfo;
-using Aurora.Framework.Services;
-using Aurora.Framework.Utilities;
-using Nini.Config;
-using Nwc.XmlRpc;
-using OpenMetaverse;
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using ChatSessionMember = Aurora.Framework.Services.ChatSessionMember;
-
-namespace Aurora.Modules.Groups
-{
- public class XmlRpcGroupsServicesConnectorModule : INonSharedRegionModule, IGroupsServicesConnector
- {
- public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome |
- GroupPowers.Accountable |
- GroupPowers.JoinChat |
- GroupPowers.AllowVoiceChat |
- GroupPowers.ReceiveNotices |
- GroupPowers.StartProposal |
- GroupPowers.VoteOnProposal;
-
- private IUserAccountService m_accountService;
- private int m_cacheTimeout = 30;
-
- private bool m_connectorEnabled;
-
- private bool m_disableKeepAlive;
-
- private string m_groupReadKey = string.Empty;
- private string m_groupWriteKey = string.Empty;
-
- // Used to track which agents are have dropped from a group chat session
- // Should be reset per agent, on logon
- // SessionID, List<AgentID>
- private Dictionary<UUID, List<UUID>> m_groupsAgentsDroppedFromChatSession = new Dictionary<UUID, List<UUID>>();
- private Dictionary<UUID, List<UUID>> m_groupsAgentsInvitedToChatSession = new Dictionary<UUID, List<UUID>>();
- private string m_groupsServerURI = string.Empty;
- private ExpiringCache<string, XmlRpcResponse> m_memoryCache;
-
- #region IGroupsServicesConnector Members
-
- /// <summary>
- /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role.
- /// </summary>
- public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID,
- int membershipFee, bool openEnrollment, bool allowPublish,
- bool maturePublish, UUID founderID)
- {
- UUID GroupID = UUID.Random();
- UUID OwnerRoleID = UUID.Random();
-
- Hashtable param = new Hashtable();
- param["GroupID"] = GroupID.ToString();
- param["Name"] = name;
- param["Charter"] = charter;
- param["ShowInList"] = showInList ? 1 : 0;
- param["InsigniaID"] = insigniaID.ToString();
- param["MembershipFee"] = 0;
- param["OpenEnrollment"] = openEnrollment ? 1 : 0;
- param["AllowPublish"] = allowPublish ? 1 : 0;
- param["MaturePublish"] = maturePublish ? 1 : 0;
- param["FounderID"] = founderID.ToString();
- param["EveryonePowers"] = ((ulong) m_DefaultEveryonePowers).ToString();
- param["OwnerRoleID"] = OwnerRoleID.ToString();
-
- // Would this be cleaner as (GroupPowers)ulong.MaxValue;
- GroupPowers OwnerPowers = GroupPowers.Accountable
- | GroupPowers.AllowEditLand
- | GroupPowers.AllowFly
- | GroupPowers.AllowLandmark
- | GroupPowers.AllowRez
- | GroupPowers.AllowSetHome
- | GroupPowers.AllowVoiceChat
- | GroupPowers.AssignMember
- | GroupPowers.AssignMemberLimited
- | GroupPowers.ChangeActions
- | GroupPowers.ChangeIdentity
- | GroupPowers.ChangeMedia
- | GroupPowers.ChangeOptions
- | GroupPowers.CreateRole
- | GroupPowers.DeedObject
- | GroupPowers.DeleteRole
- | GroupPowers.Eject
- | GroupPowers.FindPlaces
- | GroupPowers.Invite
- | GroupPowers.JoinChat
- | GroupPowers.LandChangeIdentity
- | GroupPowers.LandDeed
- | GroupPowers.LandDivideJoin
- | GroupPowers.LandEdit
- | GroupPowers.LandEjectAndFreeze
- | GroupPowers.LandGardening
- | GroupPowers.LandManageAllowed
- | GroupPowers.LandManageBanned
- | GroupPowers.LandManagePasses
- | GroupPowers.LandOptions
- | GroupPowers.LandRelease
- | GroupPowers.LandSetSale
- | GroupPowers.ModerateChat
- | GroupPowers.ObjectManipulate
- | GroupPowers.ObjectSetForSale
- | GroupPowers.ReceiveNotices
- | GroupPowers.RemoveMember
- | GroupPowers.ReturnGroupOwned
- | GroupPowers.ReturnGroupSet
- | GroupPowers.ReturnNonGroup
- | GroupPowers.RoleProperties
- | GroupPowers.SendNotices
- | GroupPowers.SetLandingPoint
- | GroupPowers.StartProposal
- | GroupPowers.VoteOnProposal;
- param["OwnersPowers"] = ((ulong) OwnerPowers).ToString();
-
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.createGroup", param);
-
- if (respData.Contains("error"))
- {
- // UUID is not nullable
-
- return UUID.Zero;
- }
-
- return UUID.Parse((string) respData["GroupID"]);
- }
-
- public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList,
- UUID insigniaID, int membershipFee, bool openEnrollment,
- bool allowPublish, bool maturePublish)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = groupID.ToString();
- param["Charter"] = charter;
- param["ShowInList"] = showInList ? 1 : 0;
- param["InsigniaID"] = insigniaID.ToString();
- param["MembershipFee"] = membershipFee;
- param["OpenEnrollment"] = openEnrollment ? 1 : 0;
- param["AllowPublish"] = allowPublish ? 1 : 0;
- param["MaturePublish"] = maturePublish ? 1 : 0;
-
- XmlRpcCall(requestingAgentID, "groups.updateGroup", param);
- }
-
- public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
- string title, ulong powers)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = groupID.ToString();
- param["RoleID"] = roleID.ToString();
- param["Name"] = name;
- param["Description"] = description;
- param["Title"] = title;
- param["Powers"] = powers.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.addRoleToGroup", param);
- }
-
- public void RemoveGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = groupID.ToString();
- param["RoleID"] = roleID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param);
- }
-
- public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description,
- string title, ulong powers)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = groupID.ToString();
- param["RoleID"] = roleID.ToString();
- if (name != null)
- {
- param["Name"] = name;
- }
- if (description != null)
- {
- param["Description"] = description;
- }
- if (title != null)
- {
- param["Title"] = title;
- }
- param["Powers"] = powers.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.updateGroupRole", param);
- }
-
- public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName)
- {
- Hashtable param = new Hashtable();
- if (GroupID != UUID.Zero)
- {
- param["GroupID"] = GroupID.ToString();
- }
- if (!string.IsNullOrEmpty(GroupName))
- {
- param["Name"] = GroupName;
- }
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param);
-
- if (respData.Contains("error"))
- {
- return null;
- }
-
- return GroupProfileHashtableToGroupRecord(respData);
- }
-
- public string SetAgentActiveGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.setAgentActiveGroup", param);
- return GetAgentGroupMembership(requestingAgentID, AgentID, GroupID).GroupTitle;
- }
-
- public string SetAgentActiveGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
- param["SelectedRoleID"] = RoleID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param);
- return GetAgentGroupMembership(requestingAgentID, AgentID, GroupID).GroupTitle;
- }
-
- public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices,
- bool ListInProfile)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
- param["AcceptNotices"] = AcceptNotices ? "1" : "0";
- param["ListInProfile"] = ListInProfile ? "1" : "0";
-
- XmlRpcCall(requestingAgentID, "groups.setAgentGroupInfo", param);
- }
-
- public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID,
- string FromAgentName)
- {
- Hashtable param = new Hashtable();
- param["InviteID"] = inviteID.ToString();
- param["AgentID"] = agentID.ToString();
- param["RoleID"] = roleID.ToString();
- param["GroupID"] = groupID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.addAgentToGroupInvite", param);
- }
-
- public GroupInviteInfo GetAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
- {
- Hashtable param = new Hashtable();
- param["InviteID"] = inviteID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentToGroupInvite", param);
-
- if (respData.Contains("error"))
- {
- return null;
- }
-
- GroupInviteInfo inviteInfo = new GroupInviteInfo
- {
- InviteID = inviteID,
- GroupID = UUID.Parse((string) respData["GroupID"]),
- RoleID = UUID.Parse((string) respData["RoleID"]),
- AgentID = UUID.Parse((string) respData["AgentID"])
- };
-
- return inviteInfo;
- }
-
- public void RemoveAgentToGroupInvite(UUID requestingAgentID, UUID inviteID)
- {
- Hashtable param = new Hashtable();
- param["InviteID"] = inviteID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.removeAgentToGroupInvite", param);
- }
-
- public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
- param["RoleID"] = RoleID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.addAgentToGroup", param);
- }
-
- public bool RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroup", param);
- return true;
- }
-
- public void AddAgentToGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
- param["RoleID"] = RoleID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.addAgentToGroupRole", param);
- }
-
- public void RemoveAgentFromGroupRole(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
- param["RoleID"] = RoleID.ToString();
-
- XmlRpcCall(requestingAgentID, "groups.removeAgentFromGroupRole", param);
- }
-
- public List<DirGroupsReplyData> FindGroups(UUID requestingAgentID, string search, uint? start, uint? count,
- uint queryflags)
- {
- Hashtable param = new Hashtable();
- param["Search"] = search;
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.findGroups", param);
-
- List<DirGroupsReplyData> findings = new List<DirGroupsReplyData>();
-
- if (!respData.Contains("error"))
- {
- Hashtable results = (Hashtable) respData["results"];
- foreach (Hashtable groupFind in results.Values)
- {
- DirGroupsReplyData data = new DirGroupsReplyData {groupID = new UUID((string) groupFind["GroupID"])};
- data.groupName = (string) groupFind["Name"];
- data.members = int.Parse((string) groupFind["Members"]);
- // data.searchOrder = order;
-
- findings.Add(data);
- }
- }
-
- return findings;
- }
-
- public GroupMembershipData GetAgentGroupMembership(UUID requestingAgentID, UUID AgentID, UUID GroupID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMembership", param);
-
- if (respData.Contains("error"))
- {
- return null;
- }
-
- GroupMembershipData data = HashTableToGroupMembershipData(respData);
-
- return data;
- }
-
- public GroupMembershipData GetAgentActiveMembership(UUID requestingAgentID, UUID AgentID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentActiveMembership", param);
-
- if (respData.Contains("error"))
- {
- return null;
- }
-
- return HashTableToGroupMembershipData(respData);
- }
-
- public List<GroupMembershipData> GetAgentGroupMemberships(UUID requestingAgentID, UUID AgentID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentGroupMemberships", param);
-
- List<GroupMembershipData> memberships = new List<GroupMembershipData>();
-
- if (!respData.Contains("error"))
- {
- memberships.AddRange(from object membership in respData.Values
- select HashTableToGroupMembershipData((Hashtable) membership));
- }
-
- return memberships;
- }
-
- public List<GroupRolesData> GetAgentGroupRoles(UUID requestingAgentID, UUID AgentID, UUID GroupID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = AgentID.ToString();
- param["GroupID"] = GroupID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getAgentRoles", param);
-
- List<GroupRolesData> Roles = new List<GroupRolesData>();
-
- if (respData.Contains("error"))
- {
- return Roles;
- }
-
- Roles.AddRange(from Hashtable role in respData.Values
- select new GroupRolesData
- {
- RoleID = new UUID((string) role["RoleID"]),
- Name = (string) role["Name"],
- Description = (string) role["Description"],
- Powers = ulong.Parse((string) role["Powers"]),
- Title = (string) role["Title"]
- });
-
- return Roles;
- }
-
- public List<GroupRolesData> GetGroupRoles(UUID requestingAgentID, UUID GroupID)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = GroupID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoles", param);
-
- List<GroupRolesData> Roles = new List<GroupRolesData>();
-
- if (respData.Contains("error"))
- {
- return Roles;
- }
-
- Roles.AddRange(from Hashtable role in respData.Values
- select new GroupRolesData
- {
- Description = (string) role["Description"],
- Members = int.Parse((string) role["Members"]),
- Name = (string) role["Name"],
- Powers = ulong.Parse((string) role["Powers"]),
- RoleID = new UUID((string) role["RoleID"]),
- Title = (string) role["Title"]
- });
-
- return Roles;
- }
-
- public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = GroupID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupMembers", param);
-
- List<GroupMembersData> members = new List<GroupMembersData>();
-
- if (respData.Contains("error"))
- {
- return members;
- }
-
- members.AddRange(from Hashtable membership in respData.Values
- select new GroupMembersData
- {
- AcceptNotices = ((string) membership["AcceptNotices"]) == "1",
- AgentID = new UUID((string) membership["AgentID"]),
- Contribution = int.Parse((string) membership["Contribution"]),
- IsOwner = ((string) membership["IsOwner"]) == "1",
- ListInProfile = ((string) membership["ListInProfile"]) == "1",
- AgentPowers = ulong.Parse((string) membership["AgentPowers"]),
- Title = (string) membership["Title"]
- });
-
- return members;
- }
-
- public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = GroupID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupRoleMembers", param);
-
- List<GroupRoleMembersData> members = new List<GroupRoleMembersData>();
-
- if (!respData.Contains("error"))
- {
- members.AddRange(from Hashtable membership in respData.Values
- select new GroupRoleMembersData
- {
- MemberID = new UUID((string) membership["AgentID"]),
- RoleID = new UUID((string) membership["RoleID"])
- });
- }
- return members;
- }
-
- public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = GroupID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotices", param);
-
- List<GroupNoticeData> values = new List<GroupNoticeData>();
-
- if (!respData.Contains("error"))
- {
- values.AddRange(from Hashtable value in respData.Values
- select new GroupNoticeData
- {
- NoticeID = UUID.Parse((string) value["NoticeID"]),
- Timestamp = uint.Parse((string) value["Timestamp"]),
- FromName = (string) value["FromName"],
- Subject = (string) value["Subject"],
- HasAttachment = false,
- AssetType = 0
- });
- }
- return values;
- }
-
- public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID)
- {
- Hashtable param = new Hashtable();
- param["NoticeID"] = noticeID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupNotice", param);
-
-
- if (respData.Contains("error"))
- {
- return null;
- }
-
- GroupNoticeInfo data = new GroupNoticeInfo
- {
- GroupID = UUID.Parse((string) respData["GroupID"]),
- Message = (string) respData["Message"],
- BinaryBucket =
- Utils.HexStringToBytes((string) respData["BinaryBucket"], true),
- noticeData =
- {
- NoticeID = UUID.Parse((string) respData["NoticeID"]),
- Timestamp = uint.Parse((string) respData["Timestamp"]),
- FromName = (string) respData["FromName"],
- Subject = (string) respData["Subject"],
- HasAttachment = false,
- AssetType = 0
- }
- };
-
- if (data.Message == null)
- {
- data.Message = string.Empty;
- }
-
- return data;
- }
-
- public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject,
- string message, UUID ItemID, int AssetType, string ItemName)
- {
- string binBucket = Utils.BytesToHexString(new byte[0], "");
-
- Hashtable param = new Hashtable();
- param["GroupID"] = groupID.ToString();
- param["NoticeID"] = noticeID.ToString();
- param["FromName"] = fromName;
- param["Subject"] = subject;
- param["Message"] = message;
- param["BinaryBucket"] = binBucket;
- param["TimeStamp"] = ((uint) Util.UnixTimeSinceEpoch()).ToString();
-
- XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
- }
-
- public List<GroupInviteInfo> GetGroupInvites(UUID requestingAgentID)
- {
- Hashtable param = new Hashtable();
- param["AgentID"] = requestingAgentID.ToString();
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroupInvites", param);
- if (!respData.Contains("error"))
- {
- List<GroupInviteInfo> GroupInvites = new List<GroupInviteInfo>();
- Hashtable results = (Hashtable) respData["results"];
- if (results != null)
- {
- GroupInvites.AddRange(from Hashtable invite in results.Values
- select new GroupInviteInfo
- {
- AgentID = new UUID((string) invite["AgentID"]),
- GroupID = new UUID((string) invite["GroupID"]),
- InviteID = new UUID((string) invite["InviteID"]),
- RoleID = new UUID((string) invite["RoleID"])
- });
- }
- return GroupInvites;
- }
- return new List<GroupInviteInfo>();
- }
-
- public void AddGroupProposal(UUID agentID, GroupProposalInfo info)
- {
- }
-
- public bool CreateSession(ChatSession chatSession)
- {
- return false;
- }
-
- public void AddMemberToGroup(ChatSessionMember chatSessionMember, UUID GroupID)
- {
- }
-
- public ChatSession GetSession(UUID SessionID)
- {
- return null;
- }
-
- public ChatSessionMember FindMember(UUID sessionid, UUID Agent)
- {
- return null;
- }
-
- public void RemoveSession(UUID sessionid)
- {
- }
-
- #endregion
-
- #region XmlRpcHashtableMarshalling
-
- private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
- {
- GroupProfileData group = new GroupProfileData();
- group.GroupID = UUID.Parse((string) groupProfile["GroupID"]);
- group.Name = (string) groupProfile["Name"];
-
- if (groupProfile["Charter"] != null)
- {
- group.Charter = (string) groupProfile["Charter"];
- }
-
- group.ShowInList = ((string) groupProfile["ShowInList"]) == "1";
- group.InsigniaID = UUID.Parse((string) groupProfile["InsigniaID"]);
- group.MembershipFee = int.Parse((string) groupProfile["MembershipFee"]);
- group.OpenEnrollment = ((string) groupProfile["OpenEnrollment"]) == "1";
- group.AllowPublish = ((string) groupProfile["AllowPublish"]) == "1";
- group.MaturePublish = ((string) groupProfile["MaturePublish"]) == "1";
- group.FounderID = UUID.Parse((string) groupProfile["FounderID"]);
- group.OwnerRole = UUID.Parse((string) groupProfile["OwnerRoleID"]);
-
- group.GroupMembershipCount = int.Parse((string) groupProfile["GroupMembershipCount"]);
- group.GroupRolesCount = int.Parse((string) groupProfile["GroupRolesCount"]);
-
- return group;
- }
-
- private GroupRecord GroupProfileHashtableToGroupRecord(Hashtable groupProfile)
- {
- GroupRecord group = new GroupRecord();
- group.GroupID = UUID.Parse((string) groupProfile["GroupID"]);
- group.GroupName = groupProfile["Name"].ToString();
- if (groupProfile["Charter"] != null)
- {
- group.Charter = (string) groupProfile["Charter"];
- }
- group.ShowInList = ((string) groupProfile["ShowInList"]) == "1";
- group.GroupPicture = UUID.Parse((string) groupProfile["InsigniaID"]);
- group.MembershipFee = int.Parse((string) groupProfile["MembershipFee"]);
- group.OpenEnrollment = ((string) groupProfile["OpenEnrollment"]) == "1";
- group.AllowPublish = ((string) groupProfile["AllowPublish"]) == "1";
- group.MaturePublish = ((string) groupProfile["MaturePublish"]) == "1";
- group.FounderID = UUID.Parse((string) groupProfile["FounderID"]);
- group.OwnerRoleID = UUID.Parse((string) groupProfile["OwnerRoleID"]);
-
- return group;
- }
-
- private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData)
- {
- GroupMembershipData data = new GroupMembershipData
- {
- AcceptNotices = ((string) respData["AcceptNotices"] == "1"),
- Contribution = int.Parse((string) respData["Contribution"]),
- ListInProfile = ((string) respData["ListInProfile"] == "1"),
- ActiveRole = new UUID((string) respData["SelectedRoleID"]),
- GroupTitle = (string) respData["Title"],
- GroupPowers = ulong.Parse((string) respData["GroupPowers"]),
- GroupID = new UUID((string) respData["GroupID"])
- };
-
-
- // Is this group the agent's active group
-
-
- UUID ActiveGroup = new UUID((string) respData["ActiveGroupID"]);
- data.Active = data.GroupID.Equals(ActiveGroup);
-
- data.AllowPublish = ((string) respData["AllowPublish"] == "1");
- if (respData["Charter"] != null)
- {
- data.Charter = (string) respData["Charter"];
- }
- data.FounderID = new UUID((string) respData["FounderID"]);
- data.GroupID = new UUID((string) respData["GroupID"]);
- data.GroupName = (string) respData["GroupName"];
- data.GroupPicture = new UUID((string) respData["InsigniaID"]);
- data.MaturePublish = ((string) respData["MaturePublish"] == "1");
- data.MembershipFee = int.Parse((string) respData["MembershipFee"]);
- data.OpenEnrollment = ((string) respData["OpenEnrollment"] == "1");
- data.ShowInList = ((string) respData["ShowInList"] == "1");
-
- return data;
- }
-
- #endregion
-
- #region INonSharedRegionModule Members
-
- public string Name
- {
- get { return "XmlRpcGroupsServicesConnector"; }
- }
-
- // this module is not intended to be replaced, but there should only be 1 of them.
- public Type ReplaceableInterface
- {
- get { return null; }
- }
-
- public void Initialise(IConfigSource config)
- {
- IConfig groupsConfig = config.Configs["Groups"];
-
- if (groupsConfig == null)
- {
- // Do not run this module by default.
- return;
- }
- else
- {
- // if groups aren't enabled, we're not needed.
- // if we're not specified as the connector to use, then we're not wanted
- if ((groupsConfig.GetBoolean("Enabled", false) == false)
- || (groupsConfig.GetString("ServicesConnectorModule", "Default") != Name))
- {
- m_connectorEnabled = false;
- return;
- }
-
- MainConsole.Instance.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name);
-
- m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
- if (string.IsNullOrEmpty(m_groupsServerURI))
- {
- MainConsole.Instance.ErrorFormat(
- "Please specify a valid URL for GroupsServerURI in Aurora.ini, [Groups]");
- m_connectorEnabled = false;
- return;
- }
-
- m_disableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);
-
- m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty);
- m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty);
-
-
- m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30);
- if (m_cacheTimeout == 0)
- {
- MainConsole.Instance.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled.");
- }
- else
- {
- MainConsole.Instance.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Timeout set to {0}.",
- m_cacheTimeout);
- }
-
- // If we got all the config options we need, lets start'er'up
- m_memoryCache = new ExpiringCache<string, XmlRpcResponse>();
- m_connectorEnabled = true;
- }
- }
-
- public void Close()
- {
- MainConsole.Instance.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name);
- }
-
- public void AddRegion(IScene scene)
- {
- if (m_connectorEnabled)
- {
- if (m_accountService == null)
- {
- m_accountService = scene.UserAccountService;
- }
-
-
- scene.RegisterModuleInterface<IGroupsServicesConnector>(this);
- }
- }
-
- public void RemoveRegion(IScene scene)
- {
- if (scene.RequestModuleInterface<IGroupsServicesConnector>() == this)
- {
- scene.UnregisterModuleInterface<IGroupsServicesConnector>(this);
- }
- }
-
- public void RegionLoaded(IScene scene)
- {
- // TODO: May want to consider listenning for Agent Connections so we can pre-cache group info
- // scene.EventManager.OnNewClient += OnNewClient;
- }
-
- #endregion
-
- public GroupProfileData GetGroupProfile(UUID requestingAgentID, UUID GroupID)
- {
- GroupProfileData profile = new GroupProfileData();
-
- GroupRecord groupInfo = GetGroupRecord(requestingAgentID, GroupID, null);
- if (groupInfo != null)
- {
- profile.AllowPublish = groupInfo.AllowPublish;
- profile.Charter = groupInfo.Charter;
- profile.FounderID = groupInfo.FounderID;
- profile.GroupID = GroupID;
- profile.GroupMembershipCount =
- GetGroupMembers(requestingAgentID, GroupID).Count;
- profile.GroupRolesCount = GetGroupRoles(requestingAgentID, GroupID).Count;
- profile.InsigniaID = groupInfo.GroupPicture;
- profile.MaturePublish = groupInfo.MaturePublish;
- profile.MembershipFee = groupInfo.MembershipFee;
- profile.Money = 0; // TODO: Get this from the currency server?
- profile.Name = groupInfo.GroupName;
- profile.OpenEnrollment = groupInfo.OpenEnrollment;
- profile.OwnerRole = groupInfo.OwnerRoleID;
- profile.ShowInList = groupInfo.ShowInList;
- }
-
- GroupMembershipData memberInfo = GetAgentGroupMembership(requestingAgentID,
- requestingAgentID,
- GroupID);
- if (memberInfo != null)
- {
- profile.MemberTitle = memberInfo.GroupTitle;
- profile.PowersMask = memberInfo.GroupPowers;
- }
-
- return profile;
- }
-
- public List<GroupTitlesData> GetGroupTitles(UUID requestingAgentID, UUID GroupID)
- {
- List<GroupRolesData> agentRoles = GetAgentGroupRoles(requestingAgentID,
- requestingAgentID, GroupID);
- GroupMembershipData agentMembership = GetAgentGroupMembership(
- requestingAgentID, requestingAgentID, GroupID);
-
- List<GroupTitlesData> titles = new List<GroupTitlesData>();
- foreach (GroupRolesData role in agentRoles)
- {
- GroupTitlesData title = new GroupTitlesData {Name = role.Title, UUID = role.RoleID};
- if (agentMembership != null)
- title.Selected = agentMembership.ActiveRole == role.RoleID;
-
- titles.Add(title);
- }
-
- return titles;
- }
-
- public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID)
- {
- Hashtable param = new Hashtable();
- param["GroupID"] = GroupID.ToString();
-
- Hashtable respData = XmlRpcCall(requestingAgentID, "groups.getGroup", param);
-
- if (respData.Contains("error"))
- {
- // GroupProfileData is not nullable
- return new GroupProfileData();
- }
-
- GroupMembershipData MemberInfo = GetAgentGroupMembership(requestingAgentID, AgentID, GroupID);
- GroupProfileData MemberGroupProfile = GroupProfileHashtableToGroupProfileData(respData);
-
- MemberGroupProfile.MemberTitle = MemberInfo.GroupTitle;
- MemberGroupProfile.PowersMask = MemberInfo.GroupPowers;
-
- return MemberGroupProfile;
- }
-
- public List<GroupProposalInfo> GetActiveProposals(UUID agentID, UUID groupID)
- {
- return new List<GroupProposalInfo>();
- }
-
- public List<GroupProposalInfo> GetInactiveProposals(UUID agentID, UUID groupID)
- {
- return new List<GroupProposalInfo>();
- }
-
- public void VoteOnActiveProposals(UUID agentID, UUID groupID, UUID proposalID, string vote)
- {
- }
-
- /// <summary>
- /// Encapsulate the XmlRpc call to standardize security and error handling.
- /// </summary>
- private Hashtable XmlRpcCall(UUID requestingAgentID, string function, Hashtable param)
- {
- XmlRpcResponse resp = null;
- string CacheKey = null;
-
- // Only bother with the cache if it isn't disabled.
- if (m_cacheTimeout > 0)
- {
- if (!function.StartsWith("groups.get"))
- {
- // Any and all updates cause the cache to clear
- m_memoryCache.Clear();
- }