Patch from mcortez. This appears to be a huge change to the groups module
and I can't say if this is beneficial or destructive due to the way it was delivered (zipfile). Pushing this on faith alone.slimupdates
parent
a004d88bf3
commit
936e08e20e
|
@ -49,14 +49,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
private List<Scene> m_sceneList = new List<Scene>();
|
private List<Scene> m_sceneList = new List<Scene>();
|
||||||
|
|
||||||
private IMessageTransferModule m_msgTransferModule = null;
|
private IMessageTransferModule m_msgTransferModule = null;
|
||||||
|
|
||||||
private IGroupsModule m_groupsModule = null;
|
private IGroupsServicesConnector m_groupData = null;
|
||||||
|
|
||||||
// TODO: Move this off to the Groups Server
|
|
||||||
public Dictionary<Guid, List<Guid>> m_agentsInGroupSession = new Dictionary<Guid, List<Guid>>();
|
|
||||||
public Dictionary<Guid, List<Guid>> m_agentsDroppedSession = new Dictionary<Guid, List<Guid>>();
|
|
||||||
|
|
||||||
|
|
||||||
// Config Options
|
// Config Options
|
||||||
private bool m_groupMessagingEnabled = false;
|
private bool m_groupMessagingEnabled = false;
|
||||||
|
@ -113,14 +108,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
if (!m_groupMessagingEnabled)
|
if (!m_groupMessagingEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
|
m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();
|
||||||
|
|
||||||
m_groupsModule = scene.RequestModuleInterface<IGroupsModule>();
|
// No groups module, no groups messaging
|
||||||
|
if (m_groupData == null)
|
||||||
// No groups module, no groups messaging
|
{
|
||||||
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();
|
Close();
|
||||||
m_groupMessagingEnabled = false;
|
m_groupMessagingEnabled = false;
|
||||||
return;
|
return;
|
||||||
|
@ -142,7 +137,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||||
|
scene.EventManager.OnClientLogin += OnClientLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
|
@ -170,7 +165,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
m_sceneList.Clear();
|
m_sceneList.Clear();
|
||||||
|
|
||||||
m_groupsModule = null;
|
m_groupData = null;
|
||||||
m_msgTransferModule = null;
|
m_msgTransferModule = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,16 +190,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Not really needed, but does confirm that the group exists.
|
||||||
|
/// </summary>
|
||||||
public bool StartGroupChatSession(UUID agentID, UUID groupID)
|
public bool StartGroupChatSession(UUID agentID, UUID groupID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled)
|
||||||
m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID);
|
GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null);
|
||||||
|
|
||||||
if (groupInfo != null)
|
if (groupInfo != null)
|
||||||
{
|
{
|
||||||
AddAgentToGroupSession(agentID.Guid, groupID.Guid);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -216,11 +213,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
|
public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled)
|
||||||
m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
|
||||||
foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID))
|
|
||||||
{
|
foreach (GroupMembersData member in m_groupData.GetGroupMembers(UUID.Zero, groupID))
|
||||||
if (!m_agentsDroppedSession.ContainsKey(im.imSessionID) || m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid))
|
{
|
||||||
|
if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID))
|
||||||
{
|
{
|
||||||
// Don't deliver messages to people who have dropped this session
|
// 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);
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID);
|
||||||
|
@ -228,8 +226,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy Message
|
// Copy Message
|
||||||
GridInstantMessage msg = new GridInstantMessage();
|
GridInstantMessage msg = new GridInstantMessage();
|
||||||
msg.imSessionID = im.imSessionID;
|
msg.imSessionID = groupID.Guid;
|
||||||
msg.fromAgentName = im.fromAgentName;
|
msg.fromAgentName = im.fromAgentName;
|
||||||
msg.message = im.message;
|
msg.message = im.message;
|
||||||
msg.dialog = im.dialog;
|
msg.dialog = im.dialog;
|
||||||
|
@ -240,8 +238,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
msg.binaryBucket = im.binaryBucket;
|
msg.binaryBucket = im.binaryBucket;
|
||||||
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
|
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
// Updat Pertinate fields to make it a "group message"
|
msg.fromAgentID = im.fromAgentID;
|
||||||
msg.fromAgentID = groupID.Guid;
|
|
||||||
msg.fromGroup = true;
|
msg.fromGroup = true;
|
||||||
|
|
||||||
msg.toAgentID = member.AgentID.Guid;
|
msg.toAgentID = member.AgentID.Guid;
|
||||||
|
@ -262,7 +259,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region SimGridEventHandlers
|
#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)
|
private void OnNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
|
@ -299,44 +303,48 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
private void ProcessMessageFromGroupSession(GridInstantMessage msg)
|
private void ProcessMessageFromGroupSession(GridInstantMessage msg)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Session message from {0} going to agent {1}", msg.fromAgentName, msg.toAgentID);
|
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)
|
switch (msg.dialog)
|
||||||
{
|
{
|
||||||
case (byte)InstantMessageDialog.SessionAdd:
|
case (byte)InstantMessageDialog.SessionAdd:
|
||||||
AddAgentToGroupSession(msg.fromAgentID, msg.imSessionID);
|
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (byte)InstantMessageDialog.SessionDrop:
|
case (byte)InstantMessageDialog.SessionDrop:
|
||||||
RemoveAgentFromGroupSession(msg.fromAgentID, msg.imSessionID);
|
m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (byte)InstantMessageDialog.SessionSend:
|
case (byte)InstantMessageDialog.SessionSend:
|
||||||
if (!m_agentsInGroupSession.ContainsKey(msg.toAgentID)
|
if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)
|
||||||
&& !m_agentsDroppedSession.ContainsKey(msg.toAgentID))
|
&& !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Agent not in session and hasn't dropped from session
|
// Agent not in session and hasn't dropped from session
|
||||||
// Add them to the session for now, and Invite them
|
// Add them to the session for now, and Invite them
|
||||||
AddAgentToGroupSession(msg.toAgentID, msg.imSessionID);
|
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||||
|
|
||||||
UUID toAgentID = new UUID(msg.toAgentID);
|
UUID toAgentID = new UUID(msg.toAgentID);
|
||||||
IClientAPI activeClient = GetActiveClient(toAgentID);
|
IClientAPI activeClient = GetActiveClient(toAgentID);
|
||||||
if (activeClient != null)
|
if (activeClient != null)
|
||||||
{
|
{
|
||||||
UUID groupID = new UUID(msg.fromAgentID);
|
GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
|
||||||
|
|
||||||
GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID);
|
|
||||||
if (groupInfo != null)
|
if (groupInfo != null)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
|
if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: Sending chatterbox invite instant message");
|
||||||
|
|
||||||
// Force? open the group session dialog???
|
// 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<IEventQueue>();
|
IEventQueue eq = activeClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||||
eq.ChatterboxInvitation(
|
eq.ChatterboxInvitation(
|
||||||
groupID
|
GroupID
|
||||||
, groupInfo.GroupName
|
, groupInfo.GroupName
|
||||||
, new UUID(msg.fromAgentID)
|
, new UUID(msg.fromAgentID)
|
||||||
, msg.message, new UUID(msg.toAgentID)
|
, msg.message
|
||||||
|
, new UUID(msg.toAgentID)
|
||||||
, msg.fromAgentName
|
, msg.fromAgentName
|
||||||
, msg.dialog
|
, msg.dialog
|
||||||
, msg.timestamp
|
, msg.timestamp
|
||||||
|
@ -349,8 +357,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
, Utils.StringToBytes(groupInfo.GroupName)
|
, Utils.StringToBytes(groupInfo.GroupName)
|
||||||
);
|
);
|
||||||
|
|
||||||
eq.ChatterBoxSessionAgentListUpdates(
|
eq.ChatterBoxSessionAgentListUpdates(
|
||||||
new UUID(groupID)
|
new UUID(GroupID)
|
||||||
, new UUID(msg.fromAgentID)
|
, new UUID(msg.fromAgentID)
|
||||||
, new UUID(msg.toAgentID)
|
, new UUID(msg.toAgentID)
|
||||||
, false //canVoiceChat
|
, false //canVoiceChat
|
||||||
|
@ -359,8 +367,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!m_agentsDroppedSession.ContainsKey(msg.toAgentID))
|
else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID))
|
||||||
{
|
{
|
||||||
// User hasn't dropped, so they're in the session,
|
// User hasn't dropped, so they're in the session,
|
||||||
// maybe we should deliver it.
|
// maybe we should deliver it.
|
||||||
|
@ -386,56 +394,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ClientEvents
|
|
||||||
|
#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<Guid>());
|
|
||||||
m_agentsDroppedSession.Add(sessionID, new List<Guid>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled)
|
||||||
|
@ -447,20 +407,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
// Start group IM session
|
// Start group IM session
|
||||||
if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
|
if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
|
||||||
{
|
{
|
||||||
UUID groupID = new UUID(im.toAgentID);
|
if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID);
|
||||||
GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID);
|
|
||||||
|
UUID GroupID = new UUID(im.imSessionID);
|
||||||
|
UUID AgentID = new UUID(im.fromAgentID);
|
||||||
|
|
||||||
|
GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
|
||||||
|
|
||||||
if (groupInfo != null)
|
if (groupInfo != null)
|
||||||
{
|
{
|
||||||
AddAgentToGroupSession(im.fromAgentID, groupInfo.GroupID.Guid);
|
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||||
|
|
||||||
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, groupID);
|
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
|
||||||
|
|
||||||
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||||
queue.ChatterBoxSessionAgentListUpdates(
|
queue.ChatterBoxSessionAgentListUpdates(
|
||||||
new UUID(groupID)
|
GroupID
|
||||||
, new UUID(im.fromAgentID)
|
, AgentID
|
||||||
, new UUID(im.toAgentID)
|
, new UUID(im.toAgentID)
|
||||||
, false //canVoiceChat
|
, false //canVoiceChat
|
||||||
, false //isModerator
|
, false //isModerator
|
||||||
|
@ -471,13 +435,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
// Send a message from locally connected client to a group
|
// Send a message from locally connected client to a group
|
||||||
if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
|
if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
|
||||||
{
|
{
|
||||||
UUID groupID = new UUID(im.toAgentID);
|
UUID GroupID = new UUID(im.imSessionID);
|
||||||
|
UUID AgentID = new UUID(im.fromAgentID);
|
||||||
|
|
||||||
if (m_debugEnabled)
|
if (m_debugEnabled)
|
||||||
m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", groupID, im.imSessionID.ToString());
|
m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
|
||||||
|
|
||||||
SendMessageToGroup(im, groupID);
|
//If this agent is sending a message, then they want to be in the session
|
||||||
|
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||||
|
|
||||||
|
SendMessageToGroup(im, GroupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +501,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
/// Try to find an active IClientAPI reference for agentID giving preference to root connections
|
/// Try to find an active IClientAPI reference for agentID giving preference to root connections
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private IClientAPI GetActiveClient(UUID agentID)
|
private IClientAPI GetActiveClient(UUID agentID)
|
||||||
{
|
{
|
||||||
|
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID);
|
||||||
|
|
||||||
IClientAPI child = null;
|
IClientAPI child = null;
|
||||||
|
|
||||||
// Try root avatar first
|
// Try root avatar first
|
||||||
|
@ -544,17 +514,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
ScenePresence user = (ScenePresence)scene.Entities[agentID];
|
ScenePresence user = (ScenePresence)scene.Entities[agentID];
|
||||||
if (!user.IsChildAgent)
|
if (!user.IsChildAgent)
|
||||||
{
|
{
|
||||||
|
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found root agent for client : {0}", user.ControllingClient.Name);
|
||||||
return user.ControllingClient;
|
return user.ControllingClient;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Found child agent for client : {0}", user.ControllingClient.Name);
|
||||||
child = user.ControllingClient;
|
child = user.ControllingClient;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we didn't find a root, then just return whichever child we found, or null if none
|
// 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;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,14 +175,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.EventManager.OnNewClient += OnNewClient;
|
scene.EventManager.OnNewClient += OnNewClient;
|
||||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||||
|
|
||||||
// The InstantMessageModule itself doesn't do this,
|
// The InstantMessageModule itself doesn't do this,
|
||||||
// so lets see if things explode if we don't do it
|
// so lets see if things explode if we don't do it
|
||||||
// scene.EventManager.OnClientClosed += OnClientClosed;
|
// scene.EventManager.OnClientClosed += OnClientClosed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
if (!m_groupsEnabled)
|
if (!m_groupsEnabled)
|
||||||
|
@ -510,7 +509,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
IClientAPI ejectee = GetActiveClient(ejecteeID);
|
IClientAPI ejectee = GetActiveClient(ejecteeID);
|
||||||
if (ejectee != null)
|
if (ejectee != null)
|
||||||
{
|
{
|
||||||
UUID groupID = new UUID(im.fromAgentID);
|
UUID groupID = new UUID(im.imSessionID);
|
||||||
ejectee.SendAgentDropGroup(groupID);
|
ejectee.SendAgentDropGroup(groupID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket);
|
void AddGroupNotice(UUID RequestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket);
|
||||||
GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID);
|
GroupNoticeInfo GetGroupNotice(UUID RequestingAgentID, UUID noticeID);
|
||||||
List<GroupNoticeData> GetGroupNotices(UUID RequestingAgentID, UUID GroupID);
|
List<GroupNoticeData> 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
|
public class GroupInviteInfo
|
||||||
|
|
|
@ -55,6 +55,9 @@ using OpenSim.Services.Interfaces;
|
||||||
* UserID -> Group -> ActiveGroup
|
* UserID -> Group -> ActiveGroup
|
||||||
* + GroupID
|
* + GroupID
|
||||||
*
|
*
|
||||||
|
* UserID -> GroupSessionDropped -> GroupID
|
||||||
|
* UserID -> GroupSessionInvited -> GroupID
|
||||||
|
*
|
||||||
* UserID -> GroupMember -> GroupID
|
* UserID -> GroupMember -> GroupID
|
||||||
* + SelectedRoleID [UUID]
|
* + SelectedRoleID [UUID]
|
||||||
* + AcceptNotices [bool]
|
* + AcceptNotices [bool]
|
||||||
|
@ -63,6 +66,7 @@ using OpenSim.Services.Interfaces;
|
||||||
*
|
*
|
||||||
* UserID -> GroupRole[GroupID] -> RoleID
|
* UserID -> GroupRole[GroupID] -> RoleID
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* GroupID -> Group -> GroupName
|
* GroupID -> Group -> GroupName
|
||||||
* + Charter
|
* + Charter
|
||||||
* + ShowInList
|
* + ShowInList
|
||||||
|
@ -159,7 +163,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
private bool m_connectorEnabled = false;
|
private bool m_connectorEnabled = false;
|
||||||
|
|
||||||
private string m_serviceURL = string.Empty;
|
private string m_groupsServerURI = string.Empty;
|
||||||
|
|
||||||
private bool m_debugEnabled = false;
|
private bool m_debugEnabled = false;
|
||||||
|
|
||||||
|
@ -199,13 +203,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
|
m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
|
||||||
|
|
||||||
m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty);
|
m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
|
||||||
if ((m_serviceURL == null) ||
|
if ((m_groupsServerURI == null) ||
|
||||||
(m_serviceURL == string.Empty))
|
(m_groupsServerURI == string.Empty))
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("Please specify a valid Simian Server URL for XmlRpcServiceURL in OpenSim.ini, [Groups]");
|
m_log.ErrorFormat("Please specify a valid Simian Server for GroupsServerURI in OpenSim.ini, [Groups]");
|
||||||
m_connectorEnabled = false;
|
m_connectorEnabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -288,8 +292,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
|
if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
|
||||||
{
|
{
|
||||||
AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers);
|
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, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers);
|
||||||
|
|
||||||
AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID);
|
AddAgentToGroup(requestingAgentID, requestingAgentID, GroupID, OwnerRoleID);
|
||||||
|
|
||||||
|
@ -413,7 +417,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((groupName != null) && (groupName != string.Empty))
|
else if ((groupName != null) && (groupName != string.Empty))
|
||||||
{
|
{
|
||||||
if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap))
|
if (!SimianGetFirstGenericEntry("Group", groupName, out groupID, out GroupInfoMap))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -422,7 +426,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
GroupRecord GroupInfo = new GroupRecord();
|
GroupRecord GroupInfo = new GroupRecord();
|
||||||
|
|
||||||
GroupInfo.GroupID = groupID;
|
GroupInfo.GroupID = groupID;
|
||||||
GroupInfo.GroupName = groupName;
|
GroupInfo.GroupName = groupName;
|
||||||
GroupInfo.Charter = GroupInfoMap["Charter"].AsString();
|
GroupInfo.Charter = GroupInfoMap["Charter"].AsString();
|
||||||
GroupInfo.ShowInList = GroupInfoMap["ShowInList"].AsBoolean();
|
GroupInfo.ShowInList = GroupInfoMap["ShowInList"].AsBoolean();
|
||||||
|
@ -653,7 +657,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs);
|
OSDMap response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray entryArray = (OSDArray)response["Entries"];
|
OSDArray entryArray = (OSDArray)response["Entries"];
|
||||||
|
@ -751,9 +755,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
|
if (SimianGetGenericEntry(agentID, "Group", "ActiveGroup", out UserActiveGroup))
|
||||||
{
|
{
|
||||||
GroupID = UserActiveGroup["GroupID"].AsUUID();
|
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);
|
return GetAgentGroupMembership(requestingAgentID, agentID, GroupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,24 +785,24 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
List<GroupRolesData> Roles = new List<GroupRolesData>();
|
List<GroupRolesData> Roles = new List<GroupRolesData>();
|
||||||
|
|
||||||
Dictionary<string, OSDMap> GroupRoles;
|
Dictionary<string, OSDMap> GroupRoles;
|
||||||
if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles))
|
if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles))
|
||||||
{
|
{
|
||||||
Dictionary<string, OSDMap> MemberRoles;
|
Dictionary<string, OSDMap> MemberRoles;
|
||||||
if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles))
|
if (SimianGetGenericEntries(agentID, "GroupRole" + groupID.ToString(), out MemberRoles))
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, OSDMap> kvp in MemberRoles)
|
foreach (KeyValuePair<string, OSDMap> kvp in MemberRoles)
|
||||||
{
|
{
|
||||||
GroupRolesData data = new GroupRolesData();
|
GroupRolesData data = new GroupRolesData();
|
||||||
data.RoleID = UUID.Parse(kvp.Key);
|
data.RoleID = UUID.Parse(kvp.Key);
|
||||||
data.Name = GroupRoles[kvp.Key]["Name"].AsString();
|
data.Name = GroupRoles[kvp.Key]["Name"].AsString();
|
||||||
data.Description = GroupRoles[kvp.Key]["Description"].AsString();
|
data.Description = GroupRoles[kvp.Key]["Description"].AsString();
|
||||||
data.Title = GroupRoles[kvp.Key]["Title"].AsString();
|
data.Title = GroupRoles[kvp.Key]["Title"].AsString();
|
||||||
data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong();
|
data.Powers = GroupRoles[kvp.Key]["Powers"].AsULong();
|
||||||
|
|
||||||
Roles.Add(data);
|
Roles.Add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Roles;
|
return Roles;
|
||||||
}
|
}
|
||||||
|
@ -912,8 +916,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
foreach( KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers )
|
foreach( KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers )
|
||||||
{
|
{
|
||||||
GroupRoleMembersData data = new GroupRoleMembersData();
|
GroupRoleMembersData data = new GroupRoleMembersData();
|
||||||
|
|
||||||
data.MemberID = GroupRoleMember.Key;
|
data.MemberID = GroupRoleMember.Key;
|
||||||
data.RoleID = UUID.Parse(Role.Key);
|
data.RoleID = UUID.Parse(Role.Key);
|
||||||
|
|
||||||
|
@ -996,9 +1000,55 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
SimianAddGeneric(groupID, "GroupNotice", noticeID.ToString(), Notice);
|
SimianAddGeneric(groupID, "GroupNotice", noticeID.ToString(), Notice);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GroupSessionTracking
|
||||||
|
|
||||||
|
public void ResetAgentGroupChatSessions(UUID agentID)
|
||||||
|
{
|
||||||
|
Dictionary<string, OSDMap> 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
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
private void EnsureRoleNotSelectedByMember(UUID groupID, UUID roleID, UUID userID)
|
private void EnsureRoleNotSelectedByMember(UUID groupID, UUID roleID, UUID userID)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
|
||||||
|
@ -1036,7 +1086,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
|
OSDMap Response = WebUtil.PostToService(m_groupsServerURI, RequestArgs);
|
||||||
if (Response["Success"].AsBoolean())
|
if (Response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -1063,23 +1113,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
|
OSDMap Response = WebUtil.PostToService(m_groupsServerURI, RequestArgs);
|
||||||
if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
|
if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray entryArray = (OSDArray)Response["Entries"];
|
OSDArray entryArray = (OSDArray)Response["Entries"];
|
||||||
if (entryArray.Count >= 1)
|
if (entryArray.Count >= 1)
|
||||||
{
|
{
|
||||||
OSDMap entryMap = entryArray[0] as OSDMap;
|
OSDMap entryMap = entryArray[0] as OSDMap;
|
||||||
key = entryMap["Key"].AsString();
|
key = entryMap["Key"].AsString();
|
||||||
map = (OSDMap)OSDParser.DeserializeJson(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());
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1103,23 +1153,23 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
|
OSDMap Response = WebUtil.PostToService(m_groupsServerURI, RequestArgs);
|
||||||
if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
|
if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray entryArray = (OSDArray)Response["Entries"];
|
OSDArray entryArray = (OSDArray)Response["Entries"];
|
||||||
if (entryArray.Count >= 1)
|
if (entryArray.Count >= 1)
|
||||||
{
|
{
|
||||||
OSDMap entryMap = entryArray[0] as OSDMap;
|
OSDMap entryMap = entryArray[0] as OSDMap;
|
||||||
ownerID = entryMap["OwnerID"].AsUUID();
|
ownerID = entryMap["OwnerID"].AsUUID();
|
||||||
map = (OSDMap)OSDParser.DeserializeJson(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());
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1144,7 +1194,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OSDMap Response = WebUtil.PostToService(m_serviceURL, RequestArgs);
|
OSDMap Response = WebUtil.PostToService(m_groupsServerURI, RequestArgs);
|
||||||
if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
|
if (Response["Success"].AsBoolean() && Response["Entries"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray entryArray = (OSDArray)Response["Entries"];
|
OSDArray entryArray = (OSDArray)Response["Entries"];
|
||||||
|
@ -1152,16 +1202,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
OSDMap entryMap = entryArray[0] as OSDMap;
|
OSDMap entryMap = entryArray[0] as OSDMap;
|
||||||
key = entryMap["Key"].AsString();
|
key = entryMap["Key"].AsString();
|
||||||
map = (OSDMap)OSDParser.DeserializeJson(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());
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1184,20 +1234,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs);
|
OSDMap response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
||||||
{
|
{
|
||||||
maps = new Dictionary<string, OSDMap>();
|
maps = new Dictionary<string, OSDMap>();
|
||||||
|
|
||||||
OSDArray entryArray = (OSDArray)response["Entries"];
|
OSDArray entryArray = (OSDArray)response["Entries"];
|
||||||
foreach (OSDMap entryMap in entryArray)
|
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()));
|
maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
|
||||||
}
|
}
|
||||||
if(maps.Count == 0)
|
if(maps.Count == 0)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1222,21 +1272,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs);
|
OSDMap response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
||||||
{
|
{
|
||||||
maps = new Dictionary<UUID, OSDMap>();
|
maps = new Dictionary<UUID, OSDMap>();
|
||||||
|
|
||||||
OSDArray entryArray = (OSDArray)response["Entries"];
|
OSDArray entryArray = (OSDArray)response["Entries"];
|
||||||
foreach (OSDMap entryMap in entryArray)
|
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["OwnerID"].AsUUID(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
|
maps.Add(entryMap["OwnerID"].AsUUID(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
|
||||||
}
|
}
|
||||||
if (maps.Count == 0)
|
if (maps.Count == 0)
|
||||||
{
|
{
|
||||||
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1260,7 +1310,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serviceURL, requestArgs);
|
OSDMap response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -1271,7 +1321,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,15 +61,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
private bool m_connectorEnabled = false;
|
private bool m_connectorEnabled = false;
|
||||||
|
|
||||||
private string m_serviceURL = string.Empty;
|
private string m_groupsServerURI = string.Empty;
|
||||||
|
|
||||||
private bool m_disableKeepAlive = false;
|
private bool m_disableKeepAlive = false;
|
||||||
|
|
||||||
private string m_groupReadKey = string.Empty;
|
private string m_groupReadKey = string.Empty;
|
||||||
private string m_groupWriteKey = string.Empty;
|
private string m_groupWriteKey = string.Empty;
|
||||||
|
|
||||||
private IUserAccountService m_accountService = null;
|
private IUserAccountService m_accountService = null;
|
||||||
|
|
||||||
|
// 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<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>>();
|
||||||
|
|
||||||
|
|
||||||
#region IRegionModuleBase Members
|
#region IRegionModuleBase Members
|
||||||
|
|
||||||
|
@ -104,13 +111,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
|
m_log.InfoFormat("[GROUPS-CONNECTOR]: Initializing {0}", this.Name);
|
||||||
|
|
||||||
m_serviceURL = groupsConfig.GetString("XmlRpcServiceURL", string.Empty);
|
m_groupsServerURI = groupsConfig.GetString("GroupsServerURI", string.Empty);
|
||||||
if ((m_serviceURL == null) ||
|
if ((m_groupsServerURI == null) ||
|
||||||
(m_serviceURL == string.Empty))
|
(m_groupsServerURI == string.Empty))
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("Please specify a valid URL for XmlRpcServiceURL in OpenSim.ini, [Groups]");
|
m_log.ErrorFormat("Please specify a valid URL for GroupsServerURI in OpenSim.ini, [Groups]");
|
||||||
m_connectorEnabled = false;
|
m_connectorEnabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -756,7 +763,70 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
|
XmlRpcCall(requestingAgentID, "groups.addGroupNotice", param);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region GroupSessionTracking
|
||||||
|
|
||||||
|
public void ResetAgentGroupChatSessions(UUID agentID)
|
||||||
|
{
|
||||||
|
foreach (List<UUID> 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<UUID>());
|
||||||
|
m_groupsAgentsInvitedToChatSession.Add(groupID, new List<UUID>());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region XmlRpcHashtableMarshalling
|
#region XmlRpcHashtableMarshalling
|
||||||
private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
|
private GroupProfileData GroupProfileHashtableToGroupProfileData(Hashtable groupProfile)
|
||||||
|
@ -871,7 +941,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
resp = req.Send(m_serviceURL, 10000);
|
resp = req.Send(m_groupsServerURI, 10000);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -948,8 +1018,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Group Request Tokens are an attempt to allow the groups service to authenticate
|
/// Group Request Tokens are an attempt to allow the groups service to authenticate
|
||||||
/// requests. Currently uses UserService, AgentID, and SessionID
|
/// requests.
|
||||||
/// TODO: Find a better way to do this.
|
/// TODO: This broke after the big grid refactor, either find a better way, or discard this
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
Loading…
Reference in New Issue