change XMLIrpgGroups attach to events, using the more correct

\addons\Groups\...  model
avinationmerge
UbitUmarov 2014-08-12 18:28:01 +01:00
parent 2cc8e90bd2
commit a0f26dc6ec
2 changed files with 194 additions and 172 deletions

View File

@ -1158,10 +1158,15 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene); m_scene.EventManager.TriggerSetRootAgentScene(m_uuid, m_scene);
/* this is now done by groups module on TriggerOnMakeRootAgent(this) below
at least XmlIRpcGroups
UUID groupUUID = UUID.Zero; UUID groupUUID = UUID.Zero;
string GroupName = string.Empty; string GroupName = string.Empty;
ulong groupPowers = 0; ulong groupPowers = 0;
// ---------------------------------- // ----------------------------------
// Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status // Previous Agent Difference - AGNI sends an unsolicited AgentDataUpdate upon root agent status
try try
@ -1185,7 +1190,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Debug("[AGENTUPDATE]: " + e.ToString()); m_log.Debug("[AGENTUPDATE]: " + e.ToString());
} }
// ------------------------------------ // ------------------------------------
*/
if (ParentID == 0) if (ParentID == 0)
{ {
// Moved this from SendInitialData to ensure that Appearance is initialized // Moved this from SendInitialData to ensure that Appearance is initialized
@ -1270,7 +1275,7 @@ namespace OpenSim.Region.Framework.Scenes
// and it has already rezzed the attachments and started their scripts. // and it has already rezzed the attachments and started their scripts.
// We do the following only for non-login agents, because their scripts // We do the following only for non-login agents, because their scripts
// haven't started yet. // haven't started yet.
/* moved down /* moved down
if (PresenceType == PresenceType.Npc || (TeleportFlags & TeleportFlags.ViaLogin) != 0) if (PresenceType == PresenceType.Npc || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
{ {
// Viewers which have a current outfit folder will actually rez their own attachments. However, // Viewers which have a current outfit folder will actually rez their own attachments. However,
@ -1279,8 +1284,8 @@ namespace OpenSim.Region.Framework.Scenes
Util.FireAndForget( Util.FireAndForget(
o => o =>
{ {
// if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None) // if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None)
// System.Threading.Thread.Sleep(7000); // System.Threading.Thread.Sleep(7000);
Scene.AttachmentsModule.RezAttachments(this); Scene.AttachmentsModule.RezAttachments(this);
}); });
@ -1320,15 +1325,15 @@ namespace OpenSim.Region.Framework.Scenes
// Resume scripts this possible should also be moved down after sending the avatar to viewer ? // Resume scripts this possible should also be moved down after sending the avatar to viewer ?
foreach (SceneObjectGroup sog in attachments) foreach (SceneObjectGroup sog in attachments)
{ {
// sending attachments before the avatar ? // sending attachments before the avatar ?
// moved to completemovement where it already was // moved to completemovement where it already was
// sog.ScheduleGroupForFullUpdate(); // sog.ScheduleGroupForFullUpdate();
sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
sog.ResumeScripts(); sog.ResumeScripts();
} }
} }
} }
*/ */
/* /*
SendAvatarDataToAllAgents(); SendAvatarDataToAllAgents();

View File

@ -195,6 +195,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
} }
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnMakeRootAgent += OnMakeRoot;
scene.EventManager.OnMakeChildAgent += OnMakeChild;
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
@ -245,19 +247,34 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
#endregion #endregion
#region EventHandlers #region EventHandlers
private void OnMakeRoot(ScenePresence sp)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
sp.ControllingClient.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
// Used for Notices and Group Invites/Accept/Reject
sp.ControllingClient.OnInstantMessage += OnInstantMessage;
// Send client their groups information.
// SendAgentGroupDataUpdate(sp.ControllingClient, sp.UUID);
// only send data viwer will ask rest later
OnAgentDataUpdateRequest(sp.ControllingClient, sp.UUID, sp.UUID);
}
private void OnMakeChild(ScenePresence sp)
{
if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
sp.ControllingClient.OnUUIDGroupNameRequest -= HandleUUIDGroupNameRequest;
sp.ControllingClient.OnInstantMessage -= OnInstantMessage;
}
private void OnNewClient(IClientAPI client) private void OnNewClient(IClientAPI client)
{ {
if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); if (m_debugEnabled) m_log.DebugFormat("[GROUPS]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest; client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnRequestAvatarProperties += OnRequestAvatarProperties; client.OnRequestAvatarProperties += OnRequestAvatarProperties;
// Used for Notices and Group Invites/Accept/Reject
client.OnInstantMessage += OnInstantMessage;
// Send client their groups information.
SendAgentGroupDataUpdate(client, client.AgentId);
} }
private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID) private void OnRequestAvatarProperties(IClientAPI remoteClient, UUID avatarID)