示例#1
0
        /// <summary>
        /// Remove a specific script (and all its pending commands)
        /// </summary>
        /// <param name="localID"></param>
        /// <param name="itemID"></param>
        public static void RemoveScript(IScriptEngine engine, uint localID, UUID itemID)
        {
            // Remove a specific script

            // Remove dataserver events
            m_Dataserver[engine].RemoveEvents(localID, itemID);

            // Remove from: Timers
            m_Timer[engine].UnSetTimerEvents(localID, itemID);

            // Remove from: HttpRequest
            IHttpRequestModule iHttpReq =
                engine.World.RequestModuleInterface <IHttpRequestModule>();

            iHttpReq.StopHttpRequest(localID, itemID);

            IWorldComm comms = engine.World.RequestModuleInterface <IWorldComm>();

            if (comms != null)
            {
                comms.DeleteListener(itemID);
            }

            IXMLRPC xmlrpc = engine.World.RequestModuleInterface <IXMLRPC>();

            xmlrpc.DeleteChannels(itemID);
            xmlrpc.CancelSRDRequests(itemID);

            // Remove Sensors
            m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
        }
示例#2
0
        public LSL_Key llSendRemoteData(string channel, string dest, int idata, string sdata)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return("");
            }

            IXMLRPC xmlrpcMod = World.RequestModuleInterface <IXMLRPC>();

            ScriptSleep(m_sleepMsOnSendRemoteData);
            return((xmlrpcMod.SendRemoteData(m_host.UUID, m_itemID, channel, dest, idata, sdata)).ToString());
        }
示例#3
0
        public DateTime llRemoteDataReply(string channel, string message_id, string sdata, int idata)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IXMLRPC xmlrpcMod = World.RequestModuleInterface <IXMLRPC>();

            xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
            return(PScriptSleep(m_sleepMsOnRemoteDataReply));
        }
        public DateTime llCloseRemoteDataChannel(object _channel)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IXMLRPC xmlrpcMod = World.RequestModuleInterface <IXMLRPC>();

            xmlrpcMod.CloseXMLRPCChannel(UUID.Parse(_channel.ToString()));
            return(PScriptSleep(m_sleepMsOnCloseRemoteDataChannel));
        }
示例#5
0
        public DateTime llOpenRemoteDataChannel()
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }

            IXMLRPC xmlrpcMod = World.RequestModuleInterface <IXMLRPC>();

            if (xmlrpcMod.IsEnabled())
            {
                UUID          channelID    = xmlrpcMod.OpenXMLRPCChannel(m_host.UUID, m_itemID, UUID.Zero);
                IXmlRpcRouter xmlRpcRouter = World.RequestModuleInterface <IXmlRpcRouter>();
                if (xmlRpcRouter != null)
                {
                    string hostName = MainServer.Instance.HostName;
                    string protocol = MainServer.Instance.Secure ? "https://" : "http://";

                    xmlRpcRouter.RegisterNewReceiver(
                        m_ScriptEngine.ScriptModule,
                        channelID,
                        m_host.UUID,
                        m_itemID,
                        string.Format("{0}{1}:{2}/", protocol, hostName, xmlrpcMod.Port)
                        );
                }
                object[] resobj =
                {
                    new LSL_Integer(1),
                    new LSL_String(channelID.ToString()),
                    new LSL_String(UUID.Zero.ToString()),
                    new LSL_String(string.Empty),
                    new LSL_Integer(0),
                    new LSL_String(string.Empty)
                };
                m_ScriptEngine.PostScriptEvent(
                    m_itemID,
                    m_host.UUID,
                    new EventParams("remote_data", resobj, new DetectParams[0])
                    , EventPriority.FirstStart
                    );
            }
            return(PScriptSleep(m_sleepMsOnOpenRemoteDataChannel));
        }
示例#6
0
        /// <summary>
        /// Unregister a specific script from facilities (and all its pending commands)
        /// </summary>
        /// <param name="localID"></param>
        /// <param name="itemID"></param>
        public static void UnregisterScriptFacilities(IScriptEngine engine, uint localID, UUID itemID, bool resetScript)
        {
//            m_log.DebugFormat("[ASYNC COMMAND MANAGER]: Removing facilities for script {0}", itemID);

            staticLock.AcquireReaderLock(-1);
            try
            {
                // Remove dataserver events
                m_Dataserver[engine].RemoveEvents(localID, itemID);

                if (resetScript)
                {
                    // Remove from: Timers
                    m_Timer[engine].UnSetTimerEvents(localID, itemID);

                    // Remove from: HttpRequest
                    IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface <IHttpRequestModule>();
                    if (iHttpReq != null)
                    {
                        iHttpReq.StopHttpRequestsForScript(itemID);
                    }
                }

                IWorldComm comms = engine.World.RequestModuleInterface <IWorldComm>();
                if (comms != null)
                {
                    comms.DeleteListener(itemID);
                }

                IXMLRPC xmlrpc = engine.World.RequestModuleInterface <IXMLRPC>();
                if (xmlrpc != null)
                {
                    xmlrpc.DeleteChannels(itemID);
                    xmlrpc.CancelSRDRequests(itemID);
                }

                // Remove Sensors
                m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
            }
            finally
            {
                staticLock.ReleaseReaderLock();
            }
        }
        /// <summary>
        /// Remove a specific script (and all its pending commands)
        /// </summary>
        /// <param name="localID"></param>
        /// <param name="itemID"></param>
        public static void RemoveScript(IScriptEngine engine, uint localID, UUID itemID)
        {
            // Remove a specific script
            //            m_log.DebugFormat("[ASYNC COMMAND MANAGER]: Removing facilities for script {0}", itemID);

            lock (staticLock)
            {
                // Remove dataserver events
                m_Dataserver[engine].RemoveEvents(localID, itemID);

                // Remove from: Timers
                m_Timer[engine].UnSetTimerEvents(localID, itemID);

                if (engine.World != null)
                {
                    // Remove from: HttpRequest
                    IHttpRequestModule iHttpReq = engine.World.RequestModuleInterface <IHttpRequestModule>();
                    if (iHttpReq != null)
                    {
                        iHttpReq.StopHttpRequest(localID, itemID);
                    }

                    IWorldComm comms = engine.World.RequestModuleInterface <IWorldComm>();
                    if (comms != null)
                    {
                        comms.DeleteListener(itemID);
                    }

                    IXMLRPC xmlrpc = engine.World.RequestModuleInterface <IXMLRPC>();
                    if (xmlrpc != null)
                    {
                        xmlrpc.DeleteChannels(itemID);
                        xmlrpc.CancelSRDRequests(itemID);
                    }
                }
                // Remove Sensors
                m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
            }
        }
示例#8
0
文件: Scene.cs 项目: CCIR/opensim
 /// <summary>
 /// Sets up references to modules required by the scene
 /// </summary>
 public void SetModuleInterfaces()
 {
     m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
     m_worldCommModule = RequestModuleInterface<IWorldComm>();
     XferManager = RequestModuleInterface<IXfer>();
     m_AvatarFactory = RequestModuleInterface<IAvatarFactoryModule>();
     AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
     m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
     m_dialogModule = RequestModuleInterface<IDialogModule>();
     m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
     EntityTransferModule = RequestModuleInterface<IEntityTransferModule>();
     m_groupsModule = RequestModuleInterface<IGroupsModule>();
     AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>();
     UserManagementModule = RequestModuleInterface<IUserManagement>();
 }
示例#9
0
 /// <summary>
 /// Sets up references to modules required by the scene
 /// </summary>
 public void SetModuleInterfaces()
 {
     m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
     m_worldCommModule = RequestModuleInterface<IWorldComm>();
     XferManager = RequestModuleInterface<IXfer>();
     m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
     m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
     m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
     m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
     m_dialogModule = RequestModuleInterface<IDialogModule>();
     m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
     m_teleportModule = RequestModuleInterface<ITeleportModule>();
 }
示例#10
0
        /// <summary>
        /// Sets up references to modules required by the scene
        /// </summary>
        public void SetModuleInterfaces()
        {
            m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
            m_worldCommModule = RequestModuleInterface<IWorldComm>();
            XferManager = RequestModuleInterface<IXfer>();
            m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
            AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
            m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
            m_dialogModule = RequestModuleInterface<IDialogModule>();
            m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
            m_teleportModule = RequestModuleInterface<IEntityTransferModule>();

            // Shoving this in here for now, because we have the needed
            // interfaces at this point
            //
            // TODO: Find a better place for this
            //
            while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
            {
                MainConsole.Instance.Output("The current estate " + m_regInfo.EstateSettings.EstateName + " has no owner set.");
                List<char> excluded = new List<char>(new char[1] { ' ' });
                string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
                string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);

                UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);

                if (account == null)
                {
                    // Create a new account
                    account = new UserAccount(m_regInfo.ScopeID, first, last, String.Empty);
                    if (account.ServiceURLs == null || (account.ServiceURLs != null && account.ServiceURLs.Count == 0))
                    {
                        account.ServiceURLs = new Dictionary<string, object>();
                        account.ServiceURLs["HomeURI"] = string.Empty;
                        account.ServiceURLs["GatekeeperURI"] = string.Empty;
                        account.ServiceURLs["InventoryServerURI"] = string.Empty;
                        account.ServiceURLs["AssetServerURI"] = string.Empty;
                    }

                    if (UserAccountService.StoreUserAccount(account))
                    {
                        string password = MainConsole.Instance.PasswdPrompt("Password");
                        string email = MainConsole.Instance.CmdPrompt("Email", "");

                        account.Email = email;
                        UserAccountService.StoreUserAccount(account);

                        bool success = false;
                        success = AuthenticationService.SetPassword(account.PrincipalID, password);
                        if (!success)
                            m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set password for account {0} {1}.",
                               first, last);

                        GridRegion home = null;
                        if (GridService != null)
                        {
                            List<GridRegion> defaultRegions = GridService.GetDefaultRegions(UUID.Zero);
                            if (defaultRegions != null && defaultRegions.Count >= 1)
                                home = defaultRegions[0];

                            if (GridUserService != null && home != null)
                                GridUserService.SetHome(account.PrincipalID.ToString(), home.RegionID, new Vector3(128, 128, 0), new Vector3(0, 1, 0));
                            else
                                m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to set home for account {0} {1}.",
                                   first, last);

                        }
                        else
                            m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to retrieve home region for account {0} {1}.",
                               first, last);

                        if (InventoryService != null)
                            success = InventoryService.CreateUserInventory(account.PrincipalID);
                        if (!success)
                            m_log.WarnFormat("[USER ACCOUNT SERVICE]: Unable to create inventory for account {0} {1}.",
                               first, last);


                        m_log.InfoFormat("[USER ACCOUNT SERVICE]: Account {0} {1} created successfully", first, last);

                        m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
                        m_regInfo.EstateSettings.Save();
                    }
                    else
                        m_log.ErrorFormat("[SCENE]: Unable to store account. If this simulator is connected to a grid, you must create the estate owner account first.");
                }
                else
                {
                    m_regInfo.EstateSettings.EstateOwner = account.PrincipalID;
                    m_regInfo.EstateSettings.Save();
                }
            }
        }
示例#11
0
        public void CheckXMLRPCRequests()
        {
            if (m_CmdManager.m_ScriptEngine.World == null)
            {
                return;
            }

            IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface <IXMLRPC>();

            if (xmlrpc != null)
            {
                RPCRequestInfo rInfo = (RPCRequestInfo)xmlrpc.GetNextCompletedRequest();

                while (rInfo != null)
                {
                    xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID());

                    //Deliver data to prim's remote_data handler
                    object[] resobj = new object[]
                    {
                        new LSL_Types.LSLInteger(2),
                        new LSL_Types.LSLString(
                            rInfo.GetChannelKey().ToString()),
                        new LSL_Types.LSLString(
                            rInfo.GetMessageID().ToString()),
                        new LSL_Types.LSLString(String.Empty),
                        new LSL_Types.LSLInteger(rInfo.GetIntValue()),
                        new LSL_Types.LSLString(rInfo.GetStrVal())
                    };

                    foreach (IScriptEngine e in m_CmdManager.ScriptEngines)
                    {
                        if (e.PostScriptEvent(
                                rInfo.GetItemID(), new EventParams(
                                    "remote_data", resobj,
                                    new DetectParams[0])))
                        {
                            break;
                        }
                    }

                    rInfo = (RPCRequestInfo)xmlrpc.GetNextCompletedRequest();
                }

                SendRemoteDataRequest srdInfo = (SendRemoteDataRequest)xmlrpc.GetNextCompletedSRDRequest();

                while (srdInfo != null)
                {
                    xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID());

                    //Deliver data to prim's remote_data handler
                    object[] resobj = new object[]
                    {
                        new LSL_Types.LSLInteger(3),
                        new LSL_Types.LSLString(srdInfo.Channel.ToString()),
                        new LSL_Types.LSLString(srdInfo.GetReqID().ToString()),
                        new LSL_Types.LSLString(String.Empty),
                        new LSL_Types.LSLInteger(srdInfo.Idata),
                        new LSL_Types.LSLString(srdInfo.Sdata)
                    };

                    foreach (IScriptEngine e in m_CmdManager.ScriptEngines)
                    {
                        if (e.PostScriptEvent(
                                srdInfo.ItemID, new EventParams(
                                    "remote_data", resobj,
                                    new DetectParams[0])))
                        {
                            break;
                        }
                    }

                    srdInfo = (SendRemoteDataRequest)xmlrpc.GetNextCompletedSRDRequest();
                }
            }
        }
示例#12
0
 public void Initialize(ScriptEngine ScriptEngine, Scene scene)
 {
     xmlrpc = scene.RequestModuleInterface<IXMLRPC>();
     m_ScriptEngine = ScriptEngine;
 }
示例#13
0
文件: Scene.cs 项目: NovaGrid/opensim
 /// <summary>
 /// Sets up references to modules required by the scene
 /// </summary>
 public void SetModuleInterfaces()
 {
     m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
     m_worldCommModule = RequestModuleInterface<IWorldComm>();
     XferManager = RequestModuleInterface<IXfer>();
     m_AvatarFactory = RequestModuleInterface<IAvatarFactory>();
     AttachmentsModule = RequestModuleInterface<IAttachmentsModule>();
     m_serialiser = RequestModuleInterface<IRegionSerialiserModule>();
     m_dialogModule = RequestModuleInterface<IDialogModule>();
     m_capsModule = RequestModuleInterface<ICapabilitiesModule>();
     m_teleportModule = RequestModuleInterface<IEntityTransferModule>();
 }