Example #1
0
 protected object OnGenericEvent(string FunctionName, object parameters)
 {
     if (FunctionName == "NewUserConnection")
     {
         ICapsService service = m_scene.RequestModuleInterface <ICapsService>();
         if (service != null)
         {
             object[]         obj     = (object[])parameters;
             OSDMap           param   = (OSDMap)obj[0];
             AgentCircuitData circuit = (AgentCircuitData)obj[1];
             if (circuit.reallyischild)//If Aurora is sending this, it'll show that it really is a child agent
             {
                 return(null);
             }
             AvatarAppearance appearance = m_scene.AvatarService.GetAppearance(circuit.AgentID);
             if (appearance != null)
             {
                 circuit.Appearance = appearance;
             }
             else
             {
                 m_scene.AvatarService.SetAppearance(circuit.AgentID, circuit.Appearance);
             }
             //circuit.Appearance.Texture = new Primitive.TextureEntry(UUID.Zero);
             circuit.child = false;//ONLY USE ROOT AGENTS, SINCE OPENSIM SENDS CHILD == TRUE ALL THE TIME
             if (circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("IncomingCAPSHandler"))
             {
                 AddCapsHandler(circuit);
             }
             else
             {
                 IClientCapsService clientService = service.GetOrCreateClientCapsService(circuit.AgentID);
                 clientService.RemoveCAPS(m_scene.RegionInfo.RegionHandle);
                 string caps = service.CreateCAPS(circuit.AgentID, CapsUtil.GetCapsSeedPath(circuit.CapsPath),
                                                  m_scene.RegionInfo.RegionHandle, true, circuit, MainServer.Instance.Port); //We ONLY use root agents because of OpenSim's inability to send the correct data
                 MainConsole.Instance.Output("setting up on " + clientService.HostUri + CapsUtil.GetCapsSeedPath(circuit.CapsPath));
                 IClientCapsService clientCaps = service.GetClientCapsService(circuit.AgentID);
                 if (clientCaps != null)
                 {
                     IRegionClientCapsService regionCaps = clientCaps.GetCapsService(m_scene.RegionInfo.RegionHandle);
                     if (regionCaps != null)
                     {
                         regionCaps.AddCAPS((OSDMap)param["CapsUrls"]);
                     }
                 }
             }
         }
     }
     else if (FunctionName == "UserStatusChange")
     {
         object[] info = (object[])parameters;
         if (!bool.Parse(info[1].ToString())) //Logging out
         {
             ICapsService service = m_scene.RequestModuleInterface <ICapsService>();
             if (service != null)
             {
                 service.RemoveCAPS(UUID.Parse(info[0].ToString()));
             }
         }
     }
     return(null);
 }