From 5a4cef6b362ebea22e240e1e0b48c14ac2d817d5 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 4 May 2010 21:16:20 +0200 Subject: make the events more useful by providing the source region --- OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 4 ++-- OpenSim/Region/Framework/Interfaces/IEstateModule.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 92e9eed..dcc66ca 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -1167,7 +1167,7 @@ namespace OpenSim.Region.CoreModules.World.Estate ChangeDelegate change = OnRegionInfoChange; if (change != null) - change(); + change(m_scene.RegionInfo.RegionID); } protected void TriggerEstateInfoChange() @@ -1175,7 +1175,7 @@ namespace OpenSim.Region.CoreModules.World.Estate ChangeDelegate change = OnEstateInfoChange; if (change != null) - change(); + change(m_scene.RegionInfo.RegionID); } } } diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index b2135d2..329c3f5 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public delegate void ChangeDelegate(); + public delegate void ChangeDelegate(UUID regionID); public interface IEstateModule : IRegionModule { -- cgit v1.1 From 3761f7997134f3515421e9cf19ebb775f296bef2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 4 May 2010 23:45:59 +0200 Subject: Strip estate message sending out from the estate management module and the dialog module. Convert it to an event on the estate module interface. The old implementation did the same as message to region, a button that is right next to it on the UI. This implementation prevented people from adding a more sane one in a module. --- OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 8 -------- .../CoreModules/World/Estate/EstateManagementModule.cs | 14 ++++++++++---- OpenSim/Region/Framework/Interfaces/IDialogModule.cs | 13 ------------- OpenSim/Region/Framework/Interfaces/IEstateModule.cs | 2 ++ 4 files changed, 12 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index c31266c..da38ede 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -132,14 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); } - public void SendNotificationToUsersInEstate( - UUID fromAvatarID, string fromAvatarName, string message) - { - // TODO: This does not yet do what it says on the tin - it only sends the message to users in the same - // region as the sending avatar. - SendNotificationToUsersInRegion(fromAvatarID, fromAvatarName, message); - } - public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) { UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index dcc66ca..abd0fcb 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Estate public event ChangeDelegate OnRegionInfoChange; public event ChangeDelegate OnEstateInfoChange; + public event MessageDelegate OnEstateMessage; #region Packet Data Responders @@ -440,10 +441,7 @@ namespace OpenSim.Region.CoreModules.World.Estate private void SendEstateBlueBoxMessage( IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) { - IDialogModule dm = m_scene.RequestModuleInterface(); - - if (dm != null) - dm.SendNotificationToUsersInEstate(senderID, senderName, message); + TriggerEstateMessage(senderID, senderName, message); } private void handleEstateDebugRegionRequest(IClientAPI remote_client, UUID invoice, UUID senderID, bool scripted, bool collisionEvents, bool physics) @@ -1177,5 +1175,13 @@ namespace OpenSim.Region.CoreModules.World.Estate if (change != null) change(m_scene.RegionInfo.RegionID); } + + protected void TriggerEstateMessage(UUID fromID, string fromName, string message) + { + MessageDelegate onmessage = OnEstateMessage; + + if (onmessage != null) + onmessage(m_scene.RegionInfo.RegionID, fromID, fromName, message); + } } } diff --git a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs index 35b4b63..be9764a 100644 --- a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs @@ -120,19 +120,6 @@ namespace OpenSim.Region.Framework.Interfaces void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message); /// - /// Send a notification to all users in the estate. This notification should remain around until the - /// user explicitly dismisses it. - /// - /// - /// On the Linden Labs Second Client (as of 1.21), this is a big blue box message on the upper right of the - /// screen. - /// - /// The user sending the message - /// The name of the user doing the sending - /// The message being sent to the user - void SendNotificationToUsersInEstate(UUID fromAvatarID, string fromAvatarName, string message); - - /// /// Send a textbox entry for the client to respond to /// void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 329c3f5..c850f7f 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -30,11 +30,13 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { public delegate void ChangeDelegate(UUID regionID); + public delegate void MessageDelegate(UUID regionID, UUID fromID, string fromName, string message); public interface IEstateModule : IRegionModule { event ChangeDelegate OnRegionInfoChange; event ChangeDelegate OnEstateInfoChange; + event MessageDelegate OnEstateMessage; uint GetRegionFlags(); bool IsManager(UUID avatarID); -- cgit v1.1 From 34d882b70d0374a445b3f6b1cf4931ef322d9587 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 5 May 2010 01:32:55 +0200 Subject: Add perms check to the teleport home client command handlers. --- OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index abd0fcb..940b535 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -470,6 +470,9 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) { + if (!m_scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) + return; + if (prey != UUID.Zero) { ScenePresence s = m_scene.GetScenePresence(prey); @@ -483,6 +486,9 @@ namespace OpenSim.Region.CoreModules.World.Estate private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID) { + if (!m_scene.Permissions.CanIssueEstateCommand(remover_client.AgentId, false)) + return; + m_scene.ForEachScenePresence(delegate(ScenePresence sp) { if (sp.UUID != senderID) -- cgit v1.1 From 8187fccd258bf0936d3db8663844e07a7b81e9fc Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 5 May 2010 16:12:52 +0100 Subject: Patch from mcortez: Update groups, add ALPHA Siman grid connector for groups Signed-off-by: Melanie --- .../Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 274 +++++++++---------- .../Avatar/XmlRpcGroups/GroupsModule.cs | 65 ++--- .../XmlRpcGroups/IGroupsServicesConnector.cs | 6 - .../SimianGroupsServicesConnectorModule.cs | 292 +++++++-------------- .../XmlRpcGroupsServicesConnectorModule.cs | 217 ++++----------- 5 files changed, 312 insertions(+), 542 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 185d44d..00fe5df 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -28,30 +28,41 @@ using System; using System.Collections.Generic; using System.Reflection; + + using log4net; using Mono.Addins; using Nini.Config; + using OpenMetaverse; using OpenMetaverse.StructuredData; + using OpenSim.Framework; using OpenSim.Region.CoreModules.Framework.EventQueue; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; + using Caps = OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class GroupsMessagingModule : ISharedRegionModule, IGroupsMessagingModule + public class GroupsMessagingModule : ISharedRegionModule { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private List m_sceneList = new List(); private IMessageTransferModule m_msgTransferModule = null; - private IGroupsServicesConnector m_groupData = null; + private IGroupsModule m_groupsModule = null; + + // TODO: Move this off to the Groups Server + public Dictionary> m_agentsInGroupSession = new Dictionary>(); + public Dictionary> m_agentsDroppedSession = new Dictionary>(); + // Config Options private bool m_groupMessagingEnabled = false; @@ -97,12 +108,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public void AddRegion(Scene scene) { - if (!m_groupMessagingEnabled) - return; - - scene.RegisterModuleInterface(this); + // NoOp } - public void RegionLoaded(Scene scene) { if (!m_groupMessagingEnabled) @@ -110,12 +117,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - m_groupData = scene.RequestModuleInterface(); + m_groupsModule = scene.RequestModuleInterface(); // No groups module, no groups messaging - if (m_groupData == null) + if (m_groupsModule == null) { - m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled."); + m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsModule, GroupsMessagingModule is now disabled."); Close(); m_groupMessagingEnabled = false; return; @@ -137,7 +144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; - scene.EventManager.OnClientLogin += OnClientLogin; + } public void RemoveRegion(Scene scene) @@ -165,7 +172,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_sceneList.Clear(); - m_groupData = null; + m_groupsModule = null; m_msgTransferModule = null; } @@ -190,84 +197,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups #endregion - /// - /// Not really needed, but does confirm that the group exists. - /// - public bool StartGroupChatSession(UUID agentID, UUID groupID) - { - if (m_debugEnabled) - m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - - GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null); - - if (groupInfo != null) - { - return true; - } - else - { - return false; - } - } - - public void SendMessageToGroup(GridInstantMessage im, UUID groupID) - { - if (m_debugEnabled) - m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - - - foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID)) - { - if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID)) - { - // Don't deliver messages to people who have dropped this session - if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); - continue; - } - - // Copy Message - GridInstantMessage msg = new GridInstantMessage(); - msg.imSessionID = groupID.Guid; - msg.fromAgentName = im.fromAgentName; - msg.message = im.message; - msg.dialog = im.dialog; - msg.offline = im.offline; - msg.ParentEstateID = im.ParentEstateID; - msg.Position = im.Position; - msg.RegionID = im.RegionID; - msg.binaryBucket = im.binaryBucket; - msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); - - msg.fromAgentID = im.fromAgentID; - msg.fromGroup = true; - - msg.toAgentID = member.AgentID.Guid; - - IClientAPI client = GetActiveClient(member.AgentID); - if (client == null) - { - // If they're not local, forward across the grid - if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); - m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); - } - else - { - // Deliver locally, directly - if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); - ProcessMessageFromGroupSession(msg); - } - } - } - #region SimGridEventHandlers - void OnClientLogin(IClientAPI client) - { - if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); - - - } - private void OnNewClient(IClientAPI client) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: OnInstantMessage registered for {0}", client.Name); @@ -305,46 +236,42 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID); - UUID AgentID = new UUID(msg.fromAgentID); - UUID GroupID = new UUID(msg.imSessionID); - switch (msg.dialog) { case (byte)InstantMessageDialog.SessionAdd: - m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); + AddAgentToGroupSession(msg.fromAgentID, msg.imSessionID); break; case (byte)InstantMessageDialog.SessionDrop: - m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); + RemoveAgentFromGroupSession(msg.fromAgentID, msg.imSessionID); break; case (byte)InstantMessageDialog.SessionSend: - if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID) - && !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID) - ) + if (!m_agentsInGroupSession.ContainsKey(msg.toAgentID) + && !m_agentsDroppedSession.ContainsKey(msg.toAgentID)) { // Agent not in session and hasn't dropped from session // Add them to the session for now, and Invite them - m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); + AddAgentToGroupSession(msg.toAgentID, msg.imSessionID); UUID toAgentID = new UUID(msg.toAgentID); IClientAPI activeClient = GetActiveClient(toAgentID); if (activeClient != null) { - GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); + UUID groupID = new UUID(msg.fromAgentID); + + GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID); if (groupInfo != null) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message"); // Force? open the group session dialog??? - // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); IEventQueue eq = activeClient.Scene.RequestModuleInterface(); eq.ChatterboxInvitation( - GroupID + groupID , groupInfo.GroupName , new UUID(msg.fromAgentID) - , msg.message - , new UUID(msg.toAgentID) + , msg.message, new UUID(msg.toAgentID) , msg.fromAgentName , msg.dialog , msg.timestamp @@ -358,7 +285,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups ); eq.ChatterBoxSessionAgentListUpdates( - new UUID(GroupID) + new UUID(groupID) , new UUID(msg.fromAgentID) , new UUID(msg.toAgentID) , false //canVoiceChat @@ -368,7 +295,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } } } - else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)) + else if (!m_agentsDroppedSession.ContainsKey(msg.toAgentID)) { // User hasn't dropped, so they're in the session, // maybe we should deliver it. @@ -394,8 +321,56 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups #endregion - #region ClientEvents + + private void RemoveAgentFromGroupSession(Guid agentID, Guid sessionID) + { + if (m_agentsInGroupSession.ContainsKey(sessionID)) + { + // If in session remove + if (m_agentsInGroupSession[sessionID].Contains(agentID)) + { + m_agentsInGroupSession[sessionID].Remove(agentID); + } + + // If not in dropped list, add + if (!m_agentsDroppedSession[sessionID].Contains(agentID)) + { + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Dropped {1} from session {0}", sessionID, agentID); + m_agentsDroppedSession[sessionID].Add(agentID); + } + } + } + + private void AddAgentToGroupSession(Guid agentID, Guid sessionID) + { + // Add Session Status if it doesn't exist for this session + CreateGroupSessionTracking(sessionID); + + // If nessesary, remove from dropped list + if (m_agentsDroppedSession[sessionID].Contains(agentID)) + { + m_agentsDroppedSession[sessionID].Remove(agentID); + } + + // If nessesary, add to in session list + if (!m_agentsInGroupSession[sessionID].Contains(agentID)) + { + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Added {1} to session {0}", sessionID, agentID); + m_agentsInGroupSession[sessionID].Add(agentID); + } + } + + private void CreateGroupSessionTracking(Guid sessionID) + { + if (!m_agentsInGroupSession.ContainsKey(sessionID)) + { + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Creating session tracking for : {0}", sessionID); + m_agentsInGroupSession.Add(sessionID, new List()); + m_agentsDroppedSession.Add(sessionID, new List()); + } + } + private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) { if (m_debugEnabled) @@ -408,23 +383,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Start group IM session if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) { - if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); + UUID groupID = new UUID(im.toAgentID); - UUID GroupID = new UUID(im.imSessionID); - UUID AgentID = new UUID(im.fromAgentID); - - GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); - + GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID); if (groupInfo != null) { - m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Start Group Session for {0}", groupInfo.GroupName); + + AddAgentToGroupSession(im.fromAgentID, im.imSessionID); - ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); + ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, groupID); IEventQueue queue = remoteClient.Scene.RequestModuleInterface(); queue.ChatterBoxSessionAgentListUpdates( - GroupID - , AgentID + new UUID(groupID) + , new UUID(im.fromAgentID) , new UUID(im.toAgentID) , false //canVoiceChat , false //isModerator @@ -436,21 +409,64 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // Send a message from locally connected client to a group if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) { - UUID GroupID = new UUID(im.imSessionID); - UUID AgentID = new UUID(im.fromAgentID); - - if (m_debugEnabled) - m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); + UUID groupID = new UUID(im.toAgentID); - //If this agent is sending a message, then they want to be in the session - m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", groupID, im.imSessionID.ToString()); - SendMessageToGroup(im, GroupID); + SendMessageToGroup(im, groupID); } } #endregion + private void SendMessageToGroup(GridInstantMessage im, UUID groupID) + { + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); + + foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID)) + { + if (!m_agentsDroppedSession.ContainsKey(im.imSessionID) || m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid)) + { + // Don't deliver messages to people who have dropped this session + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); + continue; + } + + // Copy Message + GridInstantMessage msg = new GridInstantMessage(); + msg.imSessionID = im.imSessionID; + msg.fromAgentName = im.fromAgentName; + msg.message = im.message; + msg.dialog = im.dialog; + msg.offline = im.offline; + msg.ParentEstateID = im.ParentEstateID; + msg.Position = im.Position; + msg.RegionID = im.RegionID; + msg.binaryBucket = im.binaryBucket; + msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); + + // Updat Pertinate fields to make it a "group message" + msg.fromAgentID = groupID.Guid; + msg.fromGroup = true; + + msg.toAgentID = member.AgentID.Guid; + + IClientAPI client = GetActiveClient(member.AgentID); + if (client == null) + { + // If they're not local, forward across the grid + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Delivering to {0} via Grid", member.AgentID); + m_msgTransferModule.SendInstantMessage(msg, delegate(bool success) { }); + } + else + { + // Deliver locally, directly + if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Passing to ProcessMessageFromGroupSession to deliver to {0} locally", client.Name); + ProcessMessageFromGroupSession(msg); + } + } + } + void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); @@ -502,8 +518,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// private IClientAPI GetActiveClient(UUID agentID) { - if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID); - IClientAPI child = null; // Try root avatar first @@ -515,26 +529,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups ScenePresence user = (ScenePresence)scene.Entities[agentID]; if (!user.IsChildAgent) { - if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", user.ControllingClient.Name); return user.ControllingClient; } else { - if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", user.ControllingClient.Name); child = user.ControllingClient; } } } // If we didn't find a root, then just return whichever child we found, or null if none - if (child == null) - { - if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Could not find local client for agent : {0}", agentID); - } - else - { - if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Returning child agent for client : {0}", child.Name); - } return child; } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 56c0d98..6b942cb 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -176,6 +176,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; + // The InstantMessageModule itself doesn't do this, // so lets see if things explode if we don't do it // scene.EventManager.OnClientClosed += OnClientClosed; @@ -509,7 +510,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups IClientAPI ejectee = GetActiveClient(ejecteeID); if (ejectee != null) { - UUID groupID = new UUID(im.imSessionID); + UUID groupID = new UUID(im.fromAgentID); ejectee.SendAgentDropGroup(groupID); } } @@ -600,14 +601,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public List GroupMembersRequest(IClientAPI remoteClient, UUID groupID) { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - List data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); - - if (m_debugEnabled) - { - foreach (GroupMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: Member({0}) - IsOwner({1})", member.AgentID, member.IsOwner); - } + List data = m_groupData.GetGroupMembers(GetRequestingAgentID(remoteClient), groupID); + + if (m_debugEnabled) + { + foreach (GroupMembersData member in data) + { + m_log.DebugFormat("[GROUPS]: Member({0}) - IsOwner({1})", member.AgentID, member.IsOwner); + } } return data; @@ -627,14 +628,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); - List data = m_groupData.GetGroupRoleMembers(GetRequestingAgentID(remoteClient), groupID); - - if (m_debugEnabled) - { - foreach (GroupRoleMembersData member in data) - { - m_log.DebugFormat("[GROUPS]: Member({0}) - Role({1})", member.MemberID, member.RoleID); - } + List data = m_groupData.GetGroupRoleMembers(GetRequestingAgentID(remoteClient), groupID); + + if (m_debugEnabled) + { + foreach (GroupRoleMembersData member in data) + { + m_log.DebugFormat("[GROUPS]: Member({0}) - Role({1})", member.MemberID, member.RoleID); + } } return data; } @@ -1143,11 +1144,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups OSDMap llDataStruct = new OSDMap(3); llDataStruct.Add("AgentData", AgentData); llDataStruct.Add("GroupData", GroupData); - llDataStruct.Add("NewGroupData", NewGroupData); - - if (m_debugEnabled) - { - m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct)); + llDataStruct.Add("NewGroupData", NewGroupData); + + if (m_debugEnabled) + { + m_log.InfoFormat("[GROUPS]: {0}", OSDParser.SerializeJsonString(llDataStruct)); } IEventQueue queue = remoteClient.Scene.RequestModuleInterface(); @@ -1307,16 +1308,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups // } - #endregion - - private UUID GetRequestingAgentID(IClientAPI client) - { - UUID requestingAgentID = UUID.Zero; - if (client != null) - { - requestingAgentID = client.AgentId; - } - return requestingAgentID; + #endregion + + private UUID GetRequestingAgentID(IClientAPI client) + { + UUID requestingAgentID = UUID.Zero; + if (client != null) + { + requestingAgentID = client.AgentId; + } + return requestingAgentID; } } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs index a046e09..6487967 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/IGroupsServicesConnector.cs @@ -71,12 +71,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket); GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID); List GetGroupNotices(UUID RequestingAgentID, UUID GroupID); - - void ResetAgentGroupChatSessions(UUID agentID); - bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID); - bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID); - void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID); - void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID); } public class GroupInviteInfo diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 9363205..590753e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -55,9 +55,6 @@ using OpenSim.Services.Interfaces; * UserID -> Group -> ActiveGroup * + GroupID * - * UserID -> GroupSessionDropped -> GroupID - * UserID -> GroupSessionInvited -> GroupID - * * UserID -> GroupMember -> GroupID * + SelectedRoleID [UUID] * + AcceptNotices [bool] @@ -66,7 +63,6 @@ using OpenSim.Services.Interfaces; * * UserID -> GroupRole[GroupID] -> RoleID * - * * GroupID -> Group -> GroupName * + Charter * + ShowInList @@ -163,13 +159,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private bool m_connectorEnabled = false; - private string m_groupsServerURI = string.Empty; + private string m_serviceURL = string.Empty; private bool m_debugEnabled = false; - private ExpiringCache m_memoryCache; - private int m_cacheTimeout = 30; - // private IUserAccountService m_accountService = null; @@ -206,33 +199,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return; } - m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]: Initializing {0}", this.Name); + m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); - m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); - if ((m_groupsServerURI == null) || - (m_groupsServerURI == string.Empty)) + m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); + if ((m_serviceURL == null) || + (m_serviceURL == string.Empty)) { - m_log.ErrorFormat("Please specify a valid Simian Server for GroupsServerURI in OpenSim.ini, [Groups]"); + m_log.ErrorFormat("Please specify a valid Simian Server URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); m_connectorEnabled = false; return; } - - m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30); - if (m_cacheTimeout == 0) - { - m_log.WarnFormat("[SIMIAN-GROUPS-CONNECTOR] Groups Cache Disabled."); - } - else - { - m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Groups Cache Timeout set to {0}.", m_cacheTimeout); - } - - - - m_memoryCache = new ExpiringCache(); - - // If we got all the config options we need, lets start'er'up m_connectorEnabled = true; @@ -243,7 +220,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public void Close() { - m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR]: Closing {0}", this.Name); + m_log.InfoFormat("[GROUPS-CONNECTOR]: Closing {0}", this.Name); } public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) @@ -311,8 +288,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap)) { - AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); - AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); + AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); + AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID); @@ -436,7 +413,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } } else if ((groupName != null) && (groupName != string.Empty)) - { + { if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap)) { return null; @@ -445,7 +422,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups GroupRecord GroupInfo = new GroupRecord(); - GroupInfo.GroupID = groupID; + GroupInfo.GroupID = groupID; GroupInfo.GroupName = groupName; GroupInfo.Charter = GroupInfoMap["Charter"].AsString(); GroupInfo.ShowInList = GroupInfoMap["ShowInList"].AsBoolean(); @@ -676,7 +653,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups }; - OSDMap response = CachedPostRequest(requestArgs); + OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs); if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) { OSDArray entryArray = (OSDArray)response["Entries"]; @@ -774,9 +751,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup)) { GroupID = UserActiveGroup["GroupID"].AsUUID(); - } - - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Active GroupID : {0}", GroupID.ToString()); + } + + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Active GroupID : {0}", GroupID.ToString()); return GetAgentGroupMembership(requestingAgentID, agentID, GroupID); } @@ -804,24 +781,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups List Roles = new List(); - Dictionary GroupRoles; - if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) - { - Dictionary MemberRoles; - if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles)) - { - foreach (KeyValuePair kvp in MemberRoles) - { - GroupRolesData data = new GroupRolesData(); - data.RoleID = UUID.Parse(kvp.Key); - data.Name = GroupRoles[kvp.Key]["Name"].AsString(); - data.Description = GroupRoles[kvp.Key]["Description"].AsString(); - data.Title = GroupRoles[kvp.Key]["Title"].AsString(); - data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong(); - - Roles.Add(data); - } - } + Dictionary GroupRoles; + if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) + { + Dictionary MemberRoles; + if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles)) + { + foreach (KeyValuePair kvp in MemberRoles) + { + GroupRolesData data = new GroupRolesData(); + data.RoleID = UUID.Parse(kvp.Key); + data.Name = GroupRoles[kvp.Key]["Name"].AsString(); + data.Description = GroupRoles[kvp.Key]["Description"].AsString(); + data.Title = GroupRoles[kvp.Key]["Title"].AsString(); + data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong(); + + Roles.Add(data); + } + } } return Roles; } @@ -935,8 +912,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { foreach( KeyValuePair GroupRoleMember in GroupRoleMembers ) { - GroupRoleMembersData data = new GroupRoleMembersData(); - + GroupRoleMembersData data = new GroupRoleMembersData(); + data.MemberID = GroupRoleMember.Key; data.RoleID = UUID.Parse(Role.Key); @@ -1021,52 +998,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } #endregion - #region GroupSessionTracking - - public void ResetAgentGroupChatSessions(UUID agentID) - { - Dictionary agentSessions; - - if (SimianGetGenericEntries(agentID, "GroupSessionDropped", out agentSessions)) - { - foreach (string GroupID in agentSessions.Keys) - { - SimianRemoveGenericEntry(agentID, "GroupSessionDropped", GroupID); - } - } - - if (SimianGetGenericEntries(agentID, "GroupSessionInvited", out agentSessions)) - { - foreach (string GroupID in agentSessions.Keys) - { - SimianRemoveGenericEntry(agentID, "GroupSessionInvited", GroupID); - } - } - } - - public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID) - { - OSDMap session; - return SimianGetGenericEntry(agentID, "GroupSessionDropped", groupID.ToString(), out session); - } - - public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID) - { - SimianAddGeneric(agentID, "GroupSessionDropped", groupID.ToString(), new OSDMap()); - } - - public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID) - { - SimianAddGeneric(agentID, "GroupSessionInvited", groupID.ToString(), new OSDMap()); - } - - public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID) - { - OSDMap session; - return SimianGetGenericEntry(agentID, "GroupSessionDropped", groupID.ToString(), out session); - } - - #endregion private void EnsureRoleNotSelectedByMember(UUID groupID, UUID roleID, UUID userID) { @@ -1105,7 +1036,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups }; - OSDMap Response = CachedPostRequest(RequestArgs); + OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); if (Response["Success"].AsBoolean()) { return true; @@ -1132,23 +1063,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups }; - OSDMap Response = CachedPostRequest(RequestArgs); + OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) { - OSDArray entryArray = (OSDArray)Response["Entries"]; - if (entryArray.Count >= 1) - { - OSDMap entryMap = entryArray[0] as OSDMap; - key = entryMap["Key"].AsString(); - map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); - - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); - - return true; - } - else - { - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); + OSDArray entryArray = (OSDArray)Response["Entries"]; + if (entryArray.Count >= 1) + { + OSDMap entryMap = entryArray[0] as OSDMap; + key = entryMap["Key"].AsString(); + map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); + + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); + + return true; + } + else + { + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); } } else @@ -1172,23 +1103,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups }; - OSDMap Response = CachedPostRequest(RequestArgs); + OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) { - OSDArray entryArray = (OSDArray)Response["Entries"]; - if (entryArray.Count >= 1) - { - OSDMap entryMap = entryArray[0] as OSDMap; - ownerID = entryMap["OwnerID"].AsUUID(); - map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); - - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); - - return true; - } - else - { - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); + OSDArray entryArray = (OSDArray)Response["Entries"]; + if (entryArray.Count >= 1) + { + OSDMap entryMap = entryArray[0] as OSDMap; + ownerID = entryMap["OwnerID"].AsUUID(); + map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); + + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); + + return true; + } + else + { + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); } } else @@ -1213,7 +1144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups }; - OSDMap Response = CachedPostRequest(RequestArgs); + OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs); if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray) { OSDArray entryArray = (OSDArray)Response["Entries"]; @@ -1221,16 +1152,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups { OSDMap entryMap = entryArray[0] as OSDMap; key = entryMap["Key"].AsString(); - map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); - - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); - + map = (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()); + + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); + return true; - } - else - { - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); - } + } + else + { + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); + } } else { @@ -1253,20 +1184,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups - OSDMap response = CachedPostRequest(requestArgs); + OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs); if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) { maps = new Dictionary(); OSDArray entryArray = (OSDArray)response["Entries"]; foreach (OSDMap entryMap in entryArray) - { - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); + { + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); } - if(maps.Count == 0) - { - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); + if(maps.Count == 0) + { + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); } return true; @@ -1291,21 +1222,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups - OSDMap response = CachedPostRequest(requestArgs); + OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs); if (response["Success"].AsBoolean() && response["Entries"] is OSDArray) { maps = new Dictionary(); OSDArray entryArray = (OSDArray)response["Entries"]; foreach (OSDMap entryMap in entryArray) - { + { if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); maps.Add(entryMap["OwnerID"].AsUUID(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); - } - if (maps.Count == 0) - { - if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); - } + } + if (maps.Count == 0) + { + if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); + } return true; } else @@ -1329,7 +1260,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups }; - OSDMap response = CachedPostRequest(requestArgs); + OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs); if (response["Success"].AsBoolean()) { return true; @@ -1341,49 +1272,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } } #endregion - - #region CheesyCache - OSDMap CachedPostRequest(NameValueCollection requestArgs) - { - // Immediately forward the request if the cache is disabled. - if (m_cacheTimeout == 0) - { - return WebUtil.PostToService(m_groupsServerURI, requestArgs); - } - - // Check if this is an update or a request - if ( requestArgs["RequestMethod"] == "RemoveGeneric" - || requestArgs["RequestMethod"] == "AddGeneric" - ) - - { - // Any and all updates cause the cache to clear - m_memoryCache.Clear(); - - // Send update to server, return the response without caching it - return WebUtil.PostToService(m_groupsServerURI, requestArgs); - - } - - // If we're not doing an update, we must be requesting data - - // Create the cache key for the request and see if we have it cached - string CacheKey = WebUtil.BuildQueryString(requestArgs); - OSDMap response = null; - if (!m_memoryCache.TryGetValue(CacheKey, out response)) - { - // if it wasn't in the cache, pass the request to the Simian Grid Services - response = WebUtil.PostToService(m_groupsServerURI, requestArgs); - - // and cache the response - m_memoryCache.AddOrUpdate(CacheKey, response, TimeSpan.FromSeconds(m_cacheTimeout)); - } - - // return cached response - return response; - } - #endregion - } } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 79b9a16..ab343c8 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -29,7 +29,6 @@ using System; using System.Collections; using System.Collections.Generic; using System.Reflection; -using System.Text; using Nwc.XmlRpc; @@ -62,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private bool m_connectorEnabled = false; - private string m_groupsServerURI = string.Empty; + private string m_serviceURL = string.Empty; private bool m_disableKeepAlive = false; @@ -70,17 +69,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private string m_groupWriteKey = string.Empty; private IUserAccountService m_accountService = null; - - private ExpiringCache m_memoryCache; - private int m_cacheTimeout = 30; - - // Used to track which agents are have dropped from a group chat session - // Should be reset per agent, on logon - // TODO: move this to Flotsam XmlRpc Service - // SessionID, List - private Dictionary> m_groupsAgentsDroppedFromChatSession = new Dictionary>(); - private Dictionary> m_groupsAgentsInvitedToChatSession = new Dictionary>(); - + #region IRegionModuleBase Members @@ -115,13 +104,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return; } - m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Initializing {0}", this.Name); + m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name); - m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty); - if ((m_groupsServerURI == null) || - (m_groupsServerURI == string.Empty)) + m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty); + if ((m_serviceURL == null) || + (m_serviceURL == string.Empty)) { - m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]"); + m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]"); m_connectorEnabled = false; return; } @@ -131,26 +120,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_groupReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", string.Empty); m_groupWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", string.Empty); + - m_cacheTimeout = groupsConfig.GetInt("GroupsCacheTimeout", 30); - if (m_cacheTimeout == 0) - { - m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: Groups Cache Disabled."); - } - else - { - m_log.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(); m_connectorEnabled = true; } } public void Close() { - m_log.InfoFormat("[XMLRPC-GROUPS-CONNECTOR]: Closing {0}", this.Name); + m_log.InfoFormat("[GROUPS-CONNECTOR]: Closing {0}", this.Name); } public void AddRegion(OpenSim.Region.Framework.Scenes.Scene scene) @@ -776,69 +756,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param); } - - - - #endregion - - #region GroupSessionTracking - - public void ResetAgentGroupChatSessions(UUID agentID) - { - foreach (List agentList in m_groupsAgentsDroppedFromChatSession.Values) - { - agentList.Remove(agentID); - } - } - - public bool hasAgentBeenInvitedToGroupChatSession(UUID agentID, UUID groupID) - { - // If we're tracking this group, and we can find them in the tracking, then they've been invited - return m_groupsAgentsInvitedToChatSession.ContainsKey(groupID) - && m_groupsAgentsInvitedToChatSession[groupID].Contains(agentID); - } - - public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID) - { - // If we're tracking drops for this group, - // and we find them, well... then they've dropped - return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID) - && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID); - } - - public void AgentDroppedFromGroupChatSession(UUID agentID, UUID groupID) - { - if (m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) - { - // If not in dropped list, add - if (!m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) - { - m_groupsAgentsDroppedFromChatSession[groupID].Add(agentID); - } - } - } - - public void AgentInvitedToGroupChatSession(UUID agentID, UUID groupID) - { - // Add Session Status if it doesn't exist for this session - CreateGroupChatSessionTracking(groupID); - - // If nessesary, remove from dropped list - if (m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID)) - { - m_groupsAgentsDroppedFromChatSession[groupID].Remove(agentID); - } - } - - private void CreateGroupChatSessionTracking(UUID groupID) - { - if (!m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID)) - { - m_groupsAgentsDroppedFromChatSession.Add(groupID, new List()); - m_groupsAgentsInvitedToChatSession.Add(groupID, new List()); - } - - } #endregion #region XmlRpcHashtableMarshalling @@ -932,84 +849,50 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// 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(); - } - else - { - StringBuilder sb = new StringBuilder(requestingAgentID + function); - foreach (object key in param.Keys) - { - if (param[key] != null) - { - sb.AppendFormat(",{0}:{1}", key.ToString(), param[key].ToString()); - } - } - - CacheKey = sb.ToString(); - m_memoryCache.TryGetValue(CacheKey, out resp); - } - - } + string UserService; + UUID SessionID; + GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); + param.Add("requestingAgentID", requestingAgentID.ToString()); + param.Add("RequestingAgentUserService", UserService); + param.Add("RequestingSessionID", SessionID.ToString()); - if( resp == null ) - { - string UserService; - UUID SessionID; - GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); - param.Add("requestingAgentID", requestingAgentID.ToString()); - param.Add("RequestingAgentUserService", UserService); - param.Add("RequestingSessionID", SessionID.ToString()); + param.Add("ReadKey", m_groupReadKey); + param.Add("WriteKey", m_groupWriteKey); - param.Add("ReadKey", m_groupReadKey); - param.Add("WriteKey", m_groupWriteKey); + IList parameters = new ArrayList(); + parameters.Add(param); - IList parameters = new ArrayList(); - parameters.Add(param); - - ConfigurableKeepAliveXmlRpcRequest req; - req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); + ConfigurableKeepAliveXmlRpcRequest req; + req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive); + XmlRpcResponse resp = null; - try - { - resp = req.Send(m_groupsServerURI, 10000); + try + { + resp = req.Send(m_serviceURL, 10000); + } + catch (Exception e) + { + - if ((m_cacheTimeout > 0) && (CacheKey != null)) - { - m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout)); - } + m_log.ErrorFormat("[XMLRPCGROUPDATA]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); + m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", e.ToString()); + foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine },StringSplitOptions.None)) + { + m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} ", ResponseLine); } - catch (Exception e) + + foreach (string key in param.Keys) { - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method: {0}", function); - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", e.ToString()); - - foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) - { - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} ", ResponseLine); - } - - foreach (string key in param.Keys) - { - m_log.WarnFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", key, param[key].ToString()); - } - - Hashtable respData = new Hashtable(); - respData.Add("error", e.ToString()); - return respData; + m_log.WarnFormat("[XMLRPCGROUPDATA]: {0} :: {1}", key, param[key].ToString()); } + + Hashtable respData = new Hashtable(); + respData.Add("error", e.ToString()); + return respData; } if (resp.Value is Hashtable) @@ -1023,21 +906,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return respData; } - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString()); + m_log.ErrorFormat("[XMLRPCGROUPDATA]: The XmlRpc server returned a {1} instead of a hashtable for {0}", function, resp.Value.GetType().ToString()); if (resp.Value is ArrayList) { ArrayList al = (ArrayList)resp.Value; - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Contains {0} elements", al.Count); + m_log.ErrorFormat("[XMLRPCGROUPDATA]: Contains {0} elements", al.Count); foreach (object o in al) { - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0} :: {1}", o.GetType().ToString(), o.ToString()); + m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0} :: {1}", o.GetType().ToString(), o.ToString()); } } else { - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Function returned: {0}", resp.Value.ToString()); + m_log.ErrorFormat("[XMLRPCGROUPDATA]: Function returned: {0}", resp.Value.ToString()); } Hashtable error = new Hashtable(); @@ -1047,16 +930,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private void LogRespDataToConsoleError(Hashtable respData) { - m_log.Error("[XMLRPC-GROUPS-CONNECTOR]: Error:"); + m_log.Error("[XMLRPCGROUPDATA]: Error:"); foreach (string key in respData.Keys) { - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: Key: {0}", key); + m_log.ErrorFormat("[XMLRPCGROUPDATA]: Key: {0}", key); string[] lines = respData[key].ToString().Split(new char[] { '\n' }); foreach (string line in lines) { - m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line); + m_log.ErrorFormat("[XMLRPCGROUPDATA]: {0}", line); } } @@ -1065,8 +948,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// /// Group Request Tokens are an attempt to allow the groups service to authenticate - /// requests. - /// TODO: This broke after the big grid refactor, either find a better way, or discard this + /// requests. Currently uses UserService, AgentID, and SessionID + /// TODO: Find a better way to do this. /// /// /// -- cgit v1.1 From 7aed89a8d099f3eecdaec10ec0cb6cd546d3bd3b Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 5 May 2010 21:12:02 +0200 Subject: Removed a test for a "can't happen" case. ParentGroup is never null anymore. --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3ccbb3a..b2eb585 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1890,14 +1890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y); bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true); - if (part.ParentGroup == null) - { - if ((targetPos.z < ground) && disable_underground_movement) - targetPos.z = ground; - LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); - part.UpdateOffSet(new Vector3((float)real_vec.x, (float)real_vec.y, (float)real_vec.z)); - } - else if (part.ParentGroup.RootPart == part) + if (part.ParentGroup.RootPart == part) { if ((targetPos.z < ground) && disable_underground_movement) targetPos.z = ground; @@ -1907,7 +1900,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - //it's late... i think this is right ? if (llVecDist(new LSL_Vector(0,0,0), targetPos) <= 10.0f) { part.OffsetPosition = new Vector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z); -- cgit v1.1 From 2ebe1482664533bb9b9040134fe4a23fbc939d51 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 6 May 2010 00:34:49 +0200 Subject: Plumb the viewer version string through into AgentCircuitData. Now all that is left os to figure out what black magic turns AgentCircuitData into AgentData and then copy that into the ScenePresence, where m_Viewer is already added with this commit and waits for the data. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3efb45f..b4bbbe3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -218,6 +218,7 @@ namespace OpenSim.Region.Framework.Scenes private bool m_followCamAuto; private int m_movementUpdateCount; + private string m_Viewer = String.Empty; private const int NumMovementsBetweenRayCast = 5; @@ -651,6 +652,11 @@ namespace OpenSim.Region.Framework.Scenes set { m_flyDisabled = value; } } + public string Viewer + { + get { return m_Viewer; } + } + #endregion #region Constructor(s) -- cgit v1.1 From e45f5ac12653f2ca5cef495db1607bea699ceb76 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 6 May 2010 00:54:21 +0200 Subject: Plumb Viewer version into ScenePresence for initial login. It's still not carried along --- OpenSim/Region/Framework/Scenes/Scene.cs | 1 + OpenSim/Region/Framework/Scenes/ScenePresence.cs | 1 + 2 files changed, 2 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1a46837..2579e9d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2652,6 +2652,7 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = CreateAndAddScenePresence(client); if (aCircuit != null) sp.Appearance = aCircuit.Appearance; + sp.Viewer = aCircuit.Viewer; // HERE!!! Do the initial attachments right here // first agent upon login is a root agent by design. diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b4bbbe3..fb66fcd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -655,6 +655,7 @@ namespace OpenSim.Region.Framework.Scenes public string Viewer { get { return m_Viewer; } + set { m_Viewer = value; } } #endregion -- cgit v1.1 From ad2039a8c49cbdbee719fa6578365391f6acfc7e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 5 May 2010 22:48:05 +0100 Subject: Stab a test fail --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2579e9d..fff024f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2651,8 +2651,10 @@ namespace OpenSim.Region.Framework.Scenes ScenePresence sp = CreateAndAddScenePresence(client); if (aCircuit != null) + { sp.Appearance = aCircuit.Appearance; - sp.Viewer = aCircuit.Viewer; + sp.Viewer = aCircuit.Viewer; + } // HERE!!! Do the initial attachments right here // first agent upon login is a root agent by design. -- cgit v1.1