mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
* May fix mantis #4603.
* My local git wants to commit the groups files for line endings, I'm gonna let it do it.
This commit is contained in:
@@ -49,9 +49,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
|
||||
private List<Scene> m_sceneList = new List<Scene>();
|
||||
|
||||
private IMessageTransferModule m_msgTransferModule = null;
|
||||
|
||||
private IGroupsServicesConnector m_groupData = null;
|
||||
private IMessageTransferModule m_msgTransferModule = null;
|
||||
|
||||
private IGroupsServicesConnector m_groupData = null;
|
||||
|
||||
// Config Options
|
||||
private bool m_groupMessagingEnabled = false;
|
||||
@@ -108,13 +108,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
if (!m_groupMessagingEnabled)
|
||||
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>();
|
||||
|
||||
// No groups module, no groups messaging
|
||||
// No groups module, no groups messaging
|
||||
if (m_groupData == null)
|
||||
{
|
||||
{
|
||||
m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
|
||||
Close();
|
||||
m_groupMessagingEnabled = false;
|
||||
@@ -190,9 +190,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Not really needed, but does confirm that the group exists.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Not really needed, but does confirm that the group exists.
|
||||
/// </summary>
|
||||
public bool StartGroupChatSession(UUID agentID, UUID groupID)
|
||||
{
|
||||
if (m_debugEnabled)
|
||||
@@ -201,7 +201,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID, groupID, null);
|
||||
|
||||
if (groupInfo != null)
|
||||
{
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -213,11 +213,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
public void SendMessageToGroup(GridInstantMessage im, UUID groupID)
|
||||
{
|
||||
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_groupData.GetGroupMembers(UUID.Zero, groupID))
|
||||
{
|
||||
{
|
||||
if (m_groupData.hasAgentDroppedGroupChatSession(member.AgentID, groupID))
|
||||
{
|
||||
// Don't deliver messages to people who have dropped this session
|
||||
@@ -226,7 +226,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
}
|
||||
|
||||
// Copy Message
|
||||
GridInstantMessage msg = new GridInstantMessage();
|
||||
GridInstantMessage msg = new GridInstantMessage();
|
||||
msg.imSessionID = groupID.Guid;
|
||||
msg.fromAgentName = im.fromAgentName;
|
||||
msg.message = im.message;
|
||||
@@ -259,13 +259,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
}
|
||||
}
|
||||
|
||||
#region SimGridEventHandlers
|
||||
|
||||
void OnClientLogin(IClientAPI client)
|
||||
{
|
||||
#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)
|
||||
@@ -303,28 +303,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
|
||||
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);
|
||||
|
||||
UUID AgentID = new UUID(msg.fromAgentID);
|
||||
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:
|
||||
case (byte)InstantMessageDialog.SessionAdd:
|
||||
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||
break;
|
||||
|
||||
case (byte)InstantMessageDialog.SessionDrop:
|
||||
case (byte)InstantMessageDialog.SessionDrop:
|
||||
m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID);
|
||||
break;
|
||||
|
||||
case (byte)InstantMessageDialog.SessionSend:
|
||||
if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)
|
||||
case (byte)InstantMessageDialog.SessionSend:
|
||||
if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID)
|
||||
&& !m_groupData.hasAgentBeenInvitedToGroupChatSession(AgentID, GroupID)
|
||||
)
|
||||
{
|
||||
// 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
|
||||
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||
|
||||
UUID toAgentID = new UUID(msg.toAgentID);
|
||||
@@ -336,10 +336,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
{
|
||||
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>();
|
||||
eq.ChatterboxInvitation(
|
||||
eq.ChatterboxInvitation(
|
||||
GroupID
|
||||
, groupInfo.GroupName
|
||||
, new UUID(msg.fromAgentID)
|
||||
@@ -357,7 +357,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
, Utils.StringToBytes(groupInfo.GroupName)
|
||||
);
|
||||
|
||||
eq.ChatterBoxSessionAgentListUpdates(
|
||||
eq.ChatterBoxSessionAgentListUpdates(
|
||||
new UUID(GroupID)
|
||||
, new UUID(msg.fromAgentID)
|
||||
, new UUID(msg.toAgentID)
|
||||
@@ -367,7 +367,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!m_groupData.hasAgentDroppedGroupChatSession(AgentID, GroupID))
|
||||
{
|
||||
// User hasn't dropped, so they're in the session,
|
||||
@@ -394,8 +394,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ClientEvents
|
||||
|
||||
#region ClientEvents
|
||||
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
|
||||
{
|
||||
if (m_debugEnabled)
|
||||
@@ -407,23 +407,23 @@ 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.imSessionID);
|
||||
UUID AgentID = new UUID(im.fromAgentID);
|
||||
|
||||
{
|
||||
if (m_debugEnabled) m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID);
|
||||
|
||||
UUID GroupID = new UUID(im.imSessionID);
|
||||
UUID AgentID = new UUID(im.fromAgentID);
|
||||
|
||||
GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);
|
||||
|
||||
if (groupInfo != null)
|
||||
{
|
||||
{
|
||||
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||
|
||||
ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);
|
||||
|
||||
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
|
||||
queue.ChatterBoxSessionAgentListUpdates(
|
||||
GroupID
|
||||
queue.ChatterBoxSessionAgentListUpdates(
|
||||
GroupID
|
||||
, AgentID
|
||||
, new UUID(im.toAgentID)
|
||||
, false //canVoiceChat
|
||||
@@ -435,16 +435,16 @@ 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);
|
||||
{
|
||||
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());
|
||||
|
||||
//If this agent is sending a message, then they want to be in the session
|
||||
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||
|
||||
//If this agent is sending a message, then they want to be in the session
|
||||
m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);
|
||||
|
||||
SendMessageToGroup(im, GroupID);
|
||||
}
|
||||
}
|
||||
@@ -501,7 +501,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||
/// Try to find an active IClientAPI reference for agentID giving preference to root connections
|
||||
/// </summary>
|
||||
private IClientAPI GetActiveClient(UUID agentID)
|
||||
{
|
||||
{
|
||||
if (m_debugEnabled) m_log.WarnFormat("[GROUPS-MESSAGING]: Looking for local client {0}", agentID);
|
||||
|
||||
IClientAPI child = null;
|
||||
@@ -514,26 +514,26 @@ 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);
|
||||
{
|
||||
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);
|
||||
{
|
||||
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);
|
||||
// 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user