public void Init()
 {
     this.messageService = TestObjectFactory.GetMessagesService();
     this.controller = new MessagesController(this.messageService);
     this.presenceService = TestObjectFactory.GetPresenceService();
     this.controllerWithPresence = new MessagesController(this.messageService, this.presenceService);
 }
Beispiel #2
0
        public void RegisterCaps(IRegionClientCapsService service)
        {
            m_service = service;
            m_presenceService = service.Registry.RequestModuleInterface<IPresenceService>();
            m_gridUserService = service.Registry.RequestModuleInterface<IGridUserService>();
            
            GenericHTTPMethod method = delegate(Hashtable httpMethod)
            {
                return ProcessUpdateAgentLanguage(httpMethod, m_service.AgentID);
            };
            service.AddStreamHandler("UpdateAgentLanguage", new RestHTTPHandler("POST", service.CreateCAPS("UpdateAgentLanguage", ""),
                                                      method));
            method = delegate(Hashtable httpMethod)
            {
                return ProcessUpdateAgentInfo(httpMethod, m_service.AgentID);
            };
            service.AddStreamHandler("UpdateAgentInformation", new RestHTTPHandler("POST", service.CreateCAPS("UpdateAgentInformation", ""),
                                                      method));

            method = delegate(Hashtable httpMethod)
            {
                return HomeLocation(httpMethod, m_service.AgentID);
            };
            service.AddStreamHandler("HomeLocation", new RestHTTPHandler("POST", service.CreateCAPS("HomeLocation", ""),
                                                      method));
        }
        public void PostStart(IConfigSource config, IRegistryCore registry)
        {
            IConfig handlerConfig = config.Configs["Handlers"];
            if (handlerConfig.GetString("PresenceInHandler", "") != Name)
                return;
            IHttpServer server = registry.RequestModuleInterface<ISimulationBase>().GetHttpServer((uint)handlerConfig.GetInt("PresenceInHandlerPort"));
            m_PresenceService = registry.RequestModuleInterface<IPresenceService>();

            server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService));
        }
Beispiel #4
0
        public CAPSPrivateSeedHandler(IHttpServer server, IInventoryService inventoryService, ILibraryService libraryService, IGridUserService guService, IPresenceService presenceService, string URL, UUID agentID, string HostName)
        {
            m_server = server;
            m_InventoryService = inventoryService;
            m_LibraryService = libraryService;
            m_GridUserService = guService;
            m_PresenceService = presenceService;
            SimToInform = URL;
            m_AgentID = agentID;
            m_HostName = HostName;

            if(m_server != null)
                AddServerCAPS();
        }
 public WebStoreRobustConnector(IConfigSource config, IHttpServer server, string configName)
     : base(config, server, configName)
 {
     if (configName != string.Empty)
     {
         m_ConfigName = configName;
     }
     IConfig config2 = config.Configs["WebStore"];
     if (config2 == null)
     {
         this.m_Enabled = false;
         WebStoreRobustConnector.m_log.DebugFormat("[Web.Store.Robust.Connector]: Configuration Error Not Enabled", new object[0]);
         return;
     }
     this.m_Enabled = true;
     string @string = config2.GetString("StorageProvider", string.Empty);
     string string2 = config2.GetString("ConnectionString", string.Empty);
     string string3 = config2.GetString("Realm", "store_transactions");
     string string4 = config2.GetString("GridService", string.Empty);
     string string5 = config2.GetString("UserAccountService", string.Empty);
     string string6 = config2.GetString("PresenceService", string.Empty);
     if (@string == string.Empty || string2 == string.Empty || string4 == string.Empty || string5 == string.Empty || string6 == string.Empty)
     {
         this.m_Enabled = false;
         WebStoreRobustConnector.m_log.ErrorFormat("[Web.Store.Robust.Connector]: missing service specifications Not Enabled", new object[0]);
         return;
     }
     object[] args = new object[]
     {
         config
     };
     this.m_GridService = ServerUtils.LoadPlugin<IGridService>(string4, args);
     this.m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(string5, args);
     this.m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(string6, args);
     this.m_Database = ServerUtils.LoadPlugin<IStoreData>(@string, new object[]
     {
         string2,
         string3
     });
     this.m_Funcs = new Functions();
     WebStoreRobustConnector.m_log.DebugFormat("[Web.Store.Robust.Connector]: Initialzing", new object[0]);
     if (MainConsole.Instance != null)
     {
         MainConsole.Instance.Commands.AddCommand("Debug", false, "Web Store Debug", "Web Store Debug <true|false>", "This setting turns on Web Store Debug", new CommandDelegate(this.HandleDebugStoreVerbose));
     }
     server.AddXmlRPCHandler("ProcessTransaction", new XmlRpcMethod(this.ProcessTransaction));
 }
        public PresenceServiceConnector(IConfigSource config, IHttpServer server, string configName) :
                base(config, server, configName)
        {
            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

            string gridService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);

            if (gridService == String.Empty)
                throw new Exception("No LocalServiceModule in config file");

            Object[] args = new Object[] { config };
            m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(gridService, args);

            server.AddStreamHandler(new PresenceServerPostHandler(m_PresenceService));
        }
        public void Initialise(IConfigSource source)
        {
            IConfig moduleConfig = source.Configs["Modules"];
            if (moduleConfig != null)
            {
                string name = moduleConfig.GetString("PresenceServices", "");
                if (name == Name)
                {
                    m_RemoteConnector = new PresenceServicesConnector(source);

                    m_Enabled = true;

                    m_PresenceDetector = new PresenceDetector(this);

                    m_log.Info("[REMOTE PRESENCE CONNECTOR]: Remote presence enabled");
                }
            }

        }
        public UserAccountService(IConfigSource config)
            : base(config)
        {
            IConfig userConfig = config.Configs["UserAccountService"];
            if (userConfig == null)
                throw new Exception("No UserAccountService configuration");

            // In case there are several instances of this class in the same process,
            // the console commands are only registered for the root instance
            if (m_RootInstance == null)
            {
                m_RootInstance = this;
                string gridServiceDll = userConfig.GetString("GridService", string.Empty);
                if (gridServiceDll != string.Empty)
                    m_GridService = LoadPlugin<IGridService>(gridServiceDll, new Object[] { config });

                string authServiceDll = userConfig.GetString("AuthenticationService", string.Empty);
                if (authServiceDll != string.Empty)
                    m_AuthenticationService = LoadPlugin<IAuthenticationService>(authServiceDll, new Object[] { config });

                string presenceServiceDll = userConfig.GetString("PresenceService", string.Empty);
                if (presenceServiceDll != string.Empty)
                    m_PresenceService = LoadPlugin<IPresenceService>(presenceServiceDll, new Object[] { config });

                string invServiceDll = userConfig.GetString("InventoryService", string.Empty);
                if (invServiceDll != string.Empty)
                    m_InventoryService = LoadPlugin<IInventoryService>(invServiceDll, new Object[] { config });

                if (MainConsole.Instance != null)
                {
                    MainConsole.Instance.Commands.AddCommand("UserService", false,
                            "create user",
                            "create user [<first> [<last> [<pass> [<email>]]]]",
                            "Create a new user", HandleCreateUser);
                    MainConsole.Instance.Commands.AddCommand("UserService", false, "reset user password",
                            "reset user password [<first> [<last> [<password>]]]",
                            "Reset a user password", HandleResetUserPassword);
                }

            }

        }
        public UserAgentService(IConfigSource config)
        {
            if (!m_Initialized)
            {
                m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");
                
                IConfig serverConfig = config.Configs["UserAgentService"];
                if (serverConfig == null)
                    throw new Exception(String.Format("No section UserAgentService in config file"));

                string gridService = serverConfig.GetString("GridService", String.Empty);
                string presenceService = serverConfig.GetString("PresenceService", String.Empty);

                if (gridService == string.Empty || presenceService == string.Empty)
                    throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));

                Object[] args = new Object[] { config };
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
                m_GatekeeperConnector = new GatekeeperServiceConnector();

                m_Initialized = true;
            }
        }
Beispiel #10
0
        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
            {
                throw new Exception(String.Format("No section LoginService in config file"));
            }

            string accountService    = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService   = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService      = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService       = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService        = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService       = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService   = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService        = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService    = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService     = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName        = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage           = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory         = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel            = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL            = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
            m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_SearchURL  = m_LoginServerConfig.GetString("SearchURL", string.Empty);

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
            {
                throw new Exception("LoginService is missing service specifications");
            }

            Object[] args = new Object[] { config };
            m_UserAccountService    = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
            m_GridUserService       = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin <IAuthenticationService>(authService, args);
            m_InventoryService      = ServerUtils.LoadPlugin <IInventoryService>(invService, args);

            if (gridService != string.Empty)
            {
                m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args);
            }
            if (presenceService != string.Empty)
            {
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
            }
            if (avatarService != string.Empty)
            {
                m_AvatarService = ServerUtils.LoadPlugin <IAvatarService>(avatarService, args);
            }
            if (friendsService != string.Empty)
            {
                m_FriendsService = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
            }
            if (simulationService != string.Empty)
            {
                m_RemoteSimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
            }
            if (agentService != string.Empty)
            {
                m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(agentService, args);
            }

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin <ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }
        public void RegionLoaded(Scene scene)
        {
//            m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);

            if (m_scene == null)
                m_scene = scene;

            m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
            m_userManagementModule = m_scene.RequestModuleInterface<IUserManagement>();
            m_presenceService = m_scene.RequestModuleInterface<IPresenceService>();

            if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null)
            {
                m_scene.AddCommand(
                    "Friends", this, "friends show",
                    "friends show [--cache] <first-name> <last-name>",
                    "Show the friends for the given user if they exist.\n",
                    "The --cache option will show locally cached information for that user.",
                    HandleFriendsShowCommand);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CurrentUsersService"/> class.
        /// </summary>
        /// <param name="cacheService">The app's cache service.</param>
        /// <param name="guildsService">The app's guild service.</param>
        /// <param name="presenceService">The app's presence service.</param>
        /// <param name="dispatcherHelper">The app's dispatcher helper.</param>
        public CurrentUsersService(ICacheService cacheService, IGuildsService guildsService, IPresenceService presenceService, IDispatcherHelper dispatcherHelper)
        {
            _cacheService     = cacheService;
            _guildsService    = guildsService;
            _presenceService  = presenceService;
            _dispatcherHelper = dispatcherHelper;

            Messenger.Default.Register <GatewayReadyMessage>(this, m =>
            {
                _dispatcherHelper.CheckBeginInvokeOnUi(() =>
                {
                    CurrentUser.Model    = m.EventData.User;
                    CurrentUser.Presence = new DiscordAPI.Models.Presence()
                    {
                        User    = null,
                        Game    = null,
                        GuildId = null,
                        Roles   = null,
                        Status  = m.EventData.Settings.Status,
                    };

                    CurrentUserSettings = m.EventData.Settings;
                    _presenceService.UpdateUserPrecense(CurrentUser.Model.Id, CurrentUser.Presence);
                });
            });
            Messenger.Default.Register <GatewayUserSettingsUpdatedMessage>(this, m =>
            {
                _dispatcherHelper.CheckBeginInvokeOnUi(() =>
                {
                    CurrentUserSettings = m.Settings;

                    if (!string.IsNullOrEmpty(m.Settings.Status))
                    {
                        var newPresence = new DiscordAPI.Models.Presence()
                        {
                            User    = CurrentUser.Presence.User,
                            Game    = CurrentUser.Presence.Game,
                            GuildId = CurrentUser.Presence.GuildId,
                            Roles   = CurrentUser.Presence.Roles,
                            Status  = m.Settings.Status,
                        };
                        CurrentUser.Presence = newPresence;
                        _presenceService.UpdateUserPrecense(CurrentUser.Model.Id, CurrentUser.Presence);
                    }
                });
            });
        }
        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
                throw new Exception(String.Format("No section LoginService in config file"));

            string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
            m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);

            m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
            m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
                throw new Exception("LoginService is missing service specifications");

            Object[] args = new Object[] { config };
            m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
            m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
            m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);

            if (gridService != string.Empty)
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
            if (presenceService != string.Empty)
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
            if (avatarService != string.Empty)
                m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args);
            if (friendsService != string.Empty)
                m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args);
            if (simulationService != string.Empty)
                m_RemoteSimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
            if (agentService != string.Empty)
                m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(agentService, args);

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin<ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");

        }
 public PresenceServerPostHandler(IPresenceService service) :
         base("POST", "/presence")
 {
     m_PresenceService = service;
 }
Beispiel #15
0
 public PresenceDetector(IPresenceService presenceservice)
 {
     m_PresenceService = presenceservice;
 }
Beispiel #16
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section GatekeeperService in config file"));
                }

                string accountService    = serverConfig.GetString("UserAccountService", String.Empty);
                string homeUsersService  = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService       = serverConfig.GetString("GridService", String.Empty);
                string presenceService   = serverConfig.GetString("PresenceService", String.Empty);
                string simulationService = serverConfig.GetString("SimulationService", String.Empty);
                string gridUserService   = serverConfig.GetString("GridUserService", String.Empty);

                // These are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                {
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                }

                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
                m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);
                if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
                {
                    m_ExternalName = m_ExternalName + "/";
                }

                try
                {
                    m_Uri = new Uri(m_ExternalName);
                }
                catch
                {
                    m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed gatekeeper address {0}", m_ExternalName);
                }

                Object[] args = new Object[] { config };
                m_GridService     = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                {
                    m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
                }
                if (homeUsersService != string.Empty)
                {
                    m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(homeUsersService, args);
                }
                if (gridUserService != string.Empty)
                {
                    m_GridUserService = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
                }

                if (simService != null)
                {
                    m_SimulationService = simService;
                }
                else if (simulationService != string.Empty)
                {
                    m_SimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
                }

                m_AllowedClients       = serverConfig.GetString("AllowedClients", string.Empty);
                m_DeniedClients        = serverConfig.GetString("DeniedClients", string.Empty);
                m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);

                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                {
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
                }

                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }
        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
            {
                throw new Exception(String.Format("No section LoginService in config file"));
            }

            string accountService    = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService   = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService      = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService       = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService        = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService       = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService   = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService        = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService    = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService     = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName        = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage           = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory         = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel            = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL            = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI",
                                                                                new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty);
            m_MapTileURL       = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_ProfileURL       = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
            m_OpenIDURL        = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
            m_SearchURL        = m_LoginServerConfig.GetString("SearchURL", string.Empty);
            m_Currency         = m_LoginServerConfig.GetString("Currency", string.Empty);
            m_ClassifiedFee    = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty);
            m_DestinationGuide = m_LoginServerConfig.GetString("DestinationGuide", string.Empty);
            m_AvatarPicker     = m_LoginServerConfig.GetString("AvatarPicker", string.Empty);

            m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
            m_DeniedClients  = m_LoginServerConfig.GetString("DeniedClients", string.Empty);

            m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");

            // Clean up some of these vars
            if (m_MapTileURL != String.Empty)
            {
                m_MapTileURL = m_MapTileURL.Trim();
                if (!m_MapTileURL.EndsWith("/"))
                {
                    m_MapTileURL = m_MapTileURL + "/";
                }
            }

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
            {
                throw new Exception("LoginService is missing service specifications");
            }

            // replace newlines in welcome message
            m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n");

            Object[] args = new Object[] { config };
            m_UserAccountService    = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
            m_GridUserService       = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin <IAuthenticationService>(authService, args);
            m_InventoryService      = ServerUtils.LoadPlugin <IInventoryService>(invService, args);

            if (gridService != string.Empty)
            {
                m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args);
            }
            if (presenceService != string.Empty)
            {
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
            }
            if (avatarService != string.Empty)
            {
                m_AvatarService = ServerUtils.LoadPlugin <IAvatarService>(avatarService, args);
            }
            if (friendsService != string.Empty)
            {
                m_FriendsService = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
            }
            if (simulationService != string.Empty)
            {
                m_RemoteSimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
            }
            if (agentService != string.Empty)
            {
                m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(agentService, args);
            }

            // Get the Hypergrid inventory service (exists only if Hypergrid is enabled)
            string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty);

            if (hgInvServicePlugin != string.Empty)
            {
                string   hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty);
                Object[] args2           = new Object[] { config, hgInvServiceArg };
                m_HGInventoryService = ServerUtils.LoadPlugin <IInventoryService>(hgInvServicePlugin, args2);
            }

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin <ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");
        }
Beispiel #18
0
        public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector)
            : base(config)
        {
            // Let's set this always, because we don't know the sequence
            // of instantiations
            if (friendsConnector != null)
            {
                m_FriendsLocalSimConnector = friendsConnector;
            }

            if (!m_Initialized)
            {
                m_Initialized = true;

                m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");

                m_FriendsSimConnector = new FriendsSimConnector();

                IConfig serverConfig = config.Configs["UserAgentService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section UserAgentService in config file"));
                }

                string gridService        = serverConfig.GetString("GridService", String.Empty);
                string gridUserService    = serverConfig.GetString("GridUserService", String.Empty);
                string gatekeeperService  = serverConfig.GetString("GatekeeperService", String.Empty);
                string friendsService     = serverConfig.GetString("FriendsService", String.Empty);
                string presenceService    = serverConfig.GetString("PresenceService", String.Empty);
                string userAccountService = serverConfig.GetString("UserAccountService", String.Empty);

                m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);

                if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
                {
                    throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));
                }

                Object[] args = new Object[] { config };
                m_GridService         = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_GridUserService     = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
                m_GatekeeperConnector = new GatekeeperServiceConnector();
                m_GatekeeperService   = ServerUtils.LoadPlugin <IGatekeeperService>(gatekeeperService, args);
                m_FriendsService      = ServerUtils.LoadPlugin <IFriendsService>(friendsService, args);
                m_PresenceService     = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);
                m_UserAccountService  = ServerUtils.LoadPlugin <IUserAccountService>(userAccountService, args);

                m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0);

                LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed");
                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions);

                m_GridName = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI",
                                                                    new string[] { "Startup", "Hypergrid", "UserAgentService" }, String.Empty).ToLowerInvariant();
                if (string.IsNullOrEmpty(m_GridName)) // Legacy. Remove soon.
                {
                    m_GridName = serverConfig.GetString("ExternalName", string.Empty);
                    if (m_GridName == string.Empty)
                    {
                        serverConfig = config.Configs["GatekeeperService"];
                        m_GridName   = serverConfig.GetString("ExternalName", string.Empty).ToLowerInvariant();
                    }
                }

                if (!m_GridName.EndsWith("/"))
                {
                    m_GridName = m_GridName + "/";
                }

                // Finally some cleanup
                m_Database.DeleteOld();
            }
        }
Beispiel #19
0
 public PresenceDetector(IPresenceService presenceservice)
 {
     m_PresenceService = presenceservice;
 }
Beispiel #20
0
 public PresencesController(IPresenceService presenceService) =>
Beispiel #21
0
 public MessagesController(IMessagesService messageServicePassed, IPresenceService presenceServicePassed)
     : this(messageServicePassed)
 {
     this.presences = presenceServicePassed;
 }
Beispiel #22
0
 public void PostInitialize(IConfigSource config, IRegistryCore registry)
 {
     m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>();
     m_GridUserService = registry.RequestModuleInterface<IGridUserService>();
     m_AuthenticationService = registry.RequestModuleInterface<IAuthenticationService>();
     m_InventoryService = registry.RequestModuleInterface<IInventoryService>();
     m_GridService = registry.RequestModuleInterface<IGridService>();
     m_PresenceService = registry.RequestModuleInterface<IPresenceService>();
     m_AvatarService = registry.RequestModuleInterface<IAvatarService>();
     m_FriendsService = registry.RequestModuleInterface<IFriendsService>();
     m_SimulationService = registry.RequestModuleInterface<ISimulationService>();
     m_AssetService = registry.RequestModuleInterface<IAssetService>();
     m_LibraryService = registry.RequestModuleInterface<ILibraryService>();
     m_CapsService = registry.RequestModuleInterface<ICapsService>();
 }
        public HGInstantMessageService(IConfigSource config, IInstantMessageSimConnector imConnector)
        {
            if (imConnector != null)
                m_IMSimConnector = imConnector;

            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["HGInstantMessageService"];
                if (serverConfig == null)
                    throw new Exception(String.Format("No section HGInstantMessageService in config file"));

                string gridService = serverConfig.GetString("GridService", String.Empty);
                string presenceService = serverConfig.GetString("PresenceService", String.Empty);
                string userAgentService = serverConfig.GetString("UserAgentService", String.Empty);
                m_InGatekeeper = serverConfig.GetBoolean("InGatekeeper", false);
                m_log.DebugFormat("[HG IM SERVICE]: Starting... InRobust? {0}", m_InGatekeeper);


                if (gridService == string.Empty || presenceService == string.Empty)
                    throw new Exception(String.Format("Incomplete specifications, InstantMessage Service cannot function."));

                Object[] args = new Object[] { config };
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
                m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(userAgentService, args);

                m_RegionCache = new ExpiringCache<UUID, GridRegion>();

                IConfig cnf = config.Configs["Messaging"];
                if (cnf == null)
                {
                    return;
                }

                m_RestURL = cnf.GetString("OfflineMessageURL", string.Empty);
                m_ForwardOfflineGroupMessages = cnf.GetBoolean("ForwardOfflineGroupMessages", false);

            }
        }
Beispiel #24
0
 public void Init()
 {
     this.presenceRepository = RepositoriesTestObjectFactory.GetPresenceRepository();
     this.userRepository = RepositoriesTestObjectFactory.GetUsersRepository();
     this.presenceService = new PresenceService(this.userRepository, this.presenceRepository);
 }
        public void RegionLoaded(Scene scene)
        {
            if (!m_groupMessagingEnabled)
                return;

            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
            if (m_groupData == null)
            {
                m_log.Error("[Groups.Messaging]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
                RemoveRegion(scene); 
                return;
            }

            m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();

            // No message transfer module, no groups messaging
            if (m_msgTransferModule == null)
            {
                m_log.Error("[Groups.Messaging]: Could not get MessageTransferModule");
                RemoveRegion(scene);
                return;
            }

            if (m_presenceService == null)
                m_presenceService = scene.PresenceService;

        }
Beispiel #26
0
 public PresenceServerPostHandler(IPresenceService service) :
     base("POST", "/presence")
 {
     m_PresenceService = service;
 }
Beispiel #27
0
        public UserAgentService(IConfigSource config, IFriendsSimConnector friendsConnector)
        {
            // Let's set this always, because we don't know the sequence
            // of instantiations
            if (friendsConnector != null)
                m_FriendsLocalSimConnector = friendsConnector;

            if (!m_Initialized)
            {
                m_Initialized = true;

                m_log.DebugFormat("[HOME USERS SECURITY]: Starting...");

                m_FriendsSimConnector = new FriendsSimConnector();

                IConfig serverConfig = config.Configs["UserAgentService"];
                if (serverConfig == null)
                    throw new Exception(String.Format("No section UserAgentService in config file"));

                string gridService = serverConfig.GetString("GridService", String.Empty);
                string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
                string gatekeeperService = serverConfig.GetString("GatekeeperService", String.Empty);
                string friendsService = serverConfig.GetString("FriendsService", String.Empty);
                string presenceService = serverConfig.GetString("PresenceService", String.Empty);
                string userAccountService = serverConfig.GetString("UserAccountService", String.Empty);

                m_BypassClientVerification = serverConfig.GetBoolean("BypassClientVerification", false);

                if (gridService == string.Empty || gridUserService == string.Empty || gatekeeperService == string.Empty)
                    throw new Exception(String.Format("Incomplete specifications, UserAgent Service cannot function."));

                Object[] args = new Object[] { config };
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
                m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
                m_GatekeeperConnector = new GatekeeperServiceConnector();
                m_GatekeeperService = ServerUtils.LoadPlugin<IGatekeeperService>(gatekeeperService, args);
                m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args);
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
                m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(userAccountService, args);

                m_LevelOutsideContacts = serverConfig.GetInt("LevelOutsideContacts", 0);

                LoadTripPermissionsFromConfig(serverConfig, "ForeignTripsAllowed");
                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions);

                m_GridName = serverConfig.GetString("ExternalName", string.Empty);
                if (m_GridName == string.Empty)
                {
                    serverConfig = config.Configs["GatekeeperService"];
                    m_GridName = serverConfig.GetString("ExternalName", string.Empty);
                }
                if (!m_GridName.EndsWith("/"))
                    m_GridName = m_GridName + "/";

            }
        }
Beispiel #28
0
        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_config = config;
            m_AuroraLoginConfig = config.Configs["AuroraLoginService"];
            if (m_AuroraLoginConfig != null)
            {
                m_UseTOS = m_AuroraLoginConfig.GetBoolean("UseTermsOfServiceOnFirstLogin", false);
                m_DefaultHomeRegion = m_AuroraLoginConfig.GetString("DefaultHomeRegion", "");
                m_DefaultUserAvatarArchive = m_AuroraLoginConfig.GetString("DefaultAvatarArchiveForNewUser", "");
                m_AllowAnonymousLogin = m_AuroraLoginConfig.GetBoolean("AllowAnonymousLogin", false);
                m_AuthenticateUsers = m_AuroraLoginConfig.GetBoolean("AuthenticateUsers", true);
                m_TOSLocation = m_AuroraLoginConfig.GetString("FileNameOfTOS", "");
                m_AllowFirstLife = m_AuroraLoginConfig.GetBoolean("AllowFirstLifeInProfile", true);
                m_TutorialURL = m_AuroraLoginConfig.GetString("TutorialURL", m_TutorialURL);
                ReadEventValues(m_AuroraLoginConfig);
                ReadClassifiedValues(m_AuroraLoginConfig);
                CAPSServerURL = m_AuroraLoginConfig.GetString("CAPSServiceURL", "");
                CAPSServicePassword = m_AuroraLoginConfig.GetString("CAPSServicePassword", "");
            }
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
                throw new Exception(String.Format("No section LoginService in config file"));

            string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL = m_LoginServerConfig.GetString("GatekeeperURI", string.Empty);
            m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
            
            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
                throw new Exception("LoginService is missing service specifications");

            Object[] args = new Object[] { config };
            m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
            m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
            m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);

            if (gridService != string.Empty)
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
            if (presenceService != string.Empty)
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
            if (avatarService != string.Empty)
                m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args);
            if (friendsService != string.Empty)
                m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args);
            if (simulationService != string.Empty)
                m_RemoteSimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
            if (agentService != string.Empty)
                m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(agentService, args);

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin<ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }
            //Start the grid profile archiver.
            new GridAvatarProfileArchiver(m_UserAccountService);
            archiver = new GridAvatarArchiver(m_UserAccountService, m_AvatarService, m_InventoryService);
            LoginModules = Aurora.Framework.AuroraModuleLoader.PickupModules<ILoginModule>();
            foreach (ILoginModule module in LoginModules)
            {
                module.Initialize(this, config, m_UserAccountService);
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");

        }
 public void RegionLoaded(Scene scene)
 {
     m_GridUserService = scene.GridUserService;
     m_PresenceService = scene.PresenceService;
     m_PresenceService.LogoutRegionAgents(scene.RegionInfo.RegionID);
 }
 public PresenceServerPostHandler(IPresenceService service, IServiceAuth auth) :
     base("POST", "/presence", auth)
 {
     m_PresenceService = service;
 }
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                    throw new Exception(String.Format("No section GatekeeperService in config file"));

                string accountService = serverConfig.GetString("UserAccountService", String.Empty);
                string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService = serverConfig.GetString("GridService", String.Empty);
                string presenceService = serverConfig.GetString("PresenceService", String.Empty);
                string simulationService = serverConfig.GetString("SimulationService", String.Empty);
                string gridUserService = serverConfig.GetString("GridUserService", String.Empty);
                string bansService = serverConfig.GetString("BansService", String.Empty);

                // These are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                
                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
                m_ExternalName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
                    new string[] { "Startup", "Hypergrid", "GatekeeperService" }, String.Empty);
                m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName);
                if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
                    m_ExternalName = m_ExternalName + "/";

                try
                {
                    m_Uri = new Uri(m_ExternalName);
                }
                catch
                {
                    m_log.WarnFormat("[GATEKEEPER SERVICE]: Malformed gatekeeper address {0}", m_ExternalName);
                }

                Object[] args = new Object[] { config };
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                    m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
                if (homeUsersService != string.Empty)
                    m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);
                if (gridUserService != string.Empty)
                    m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
                if (bansService != string.Empty)
                    m_BansService = ServerUtils.LoadPlugin<IBansService>(bansService, args);

                if (simService != null)
                    m_SimulationService = simService;
                else if (simulationService != string.Empty)
                        m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);

                m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty);
                m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty);
                m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);

                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");

                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }
        public void RegionLoaded(Scene scene)
        {
            if (!m_groupMessagingEnabled)
                return;

            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
            if (m_groupData == null)
            {
                m_log.Error("[GROUPS-MESSAGING]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }

            m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();

            // No message transfer module, no groups messaging
            if (m_msgTransferModule == null)
            {
                m_log.Error("[GROUPS-MESSAGING]: Could not get MessageTransferModule");
                Close();
                m_groupMessagingEnabled = false;
                return;
            }

            if (m_presenceService == null)
                m_presenceService = scene.PresenceService;

            m_sceneList.Add(scene);

            scene.EventManager.OnNewClient += OnNewClient;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
            scene.EventManager.OnClientLogin += OnClientLogin;
        }
Beispiel #33
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                    throw new Exception(String.Format("No section GatekeeperService in config file"));

                string accountService = serverConfig.GetString("UserAccountService", String.Empty);
                string homeUsersService = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService = serverConfig.GetString("GridService", String.Empty);
                string presenceService = serverConfig.GetString("PresenceService", String.Empty);
                string simulationService = serverConfig.GetString("SimulationService", String.Empty);

                // These 3 are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                
                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
                m_ExternalName = serverConfig.GetString("ExternalName", string.Empty);

                Object[] args = new Object[] { config };
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                    m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
                if (homeUsersService != string.Empty)
                    m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(homeUsersService, args);

                if (simService != null)
                    m_SimulationService = simService;
                else if (simulationService != string.Empty)
                        m_SimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");

                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }
 public PresenceServerPostHandler(IPresenceService service, IServiceAuth auth) :
         base("POST", "/presence", auth)
 {
     m_PresenceService = service;
 }
        public HGFriendsService(IConfigSource config, String configName, IFriendsSimConnector localSimConn)
        {
            if (m_FriendsLocalSimConnector == null)
                m_FriendsLocalSimConnector = localSimConn;

            if (!m_Initialized)
            {
                m_Initialized = true;

                if (configName != String.Empty)
                    m_ConfigName = configName;

                Object[] args = new Object[] { config };

                IConfig serverConfig = config.Configs[m_ConfigName];
                if (serverConfig == null)
                    throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

                string theService = serverConfig.GetString("FriendsService", string.Empty);
                if (theService == String.Empty)
                    throw new Exception("No FriendsService in config file " + m_ConfigName);
                m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(theService, args);

                theService = serverConfig.GetString("UserAccountService", string.Empty);
                if (theService == String.Empty)
                    throw new Exception("No UserAccountService in " + m_ConfigName);
                m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(theService, args);

                theService = serverConfig.GetString("GridService", string.Empty);
                if (theService == String.Empty)
                    throw new Exception("No GridService in " + m_ConfigName);
                m_GridService = ServerUtils.LoadPlugin<IGridService>(theService, args);

                theService = serverConfig.GetString("PresenceService", string.Empty);
                if (theService == String.Empty)
                    throw new Exception("No PresenceService in " + m_ConfigName);
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(theService, args);

                m_FriendsSimConnector = new FriendsSimConnector();

                m_log.DebugFormat("[HGFRIENDS SERVICE]: Starting...");

            }
        }
        public void Initialise(IConfigSource source)
        {
            IConfig moduleConfig = source.Configs["Modules"];
            if (moduleConfig != null)
            {
                string name = moduleConfig.GetString("PresenceServices", "");
                if (name == Name)
                {
                    IConfig inventoryConfig = source.Configs["PresenceService"];
                    if (inventoryConfig == null)
                    {
                        m_log.Error("[LOCAL PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini");
                        return;
                    }

                    string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty);

                    if (serviceDll == String.Empty)
                    {
                        m_log.Error("[LOCAL PRESENCE CONNECTOR]: No LocalServiceModule named in section PresenceService");
                        return;
                    }

                    Object[] args = new Object[] { source };
                    m_log.DebugFormat("[LOCAL PRESENCE CONNECTOR]: Service dll = {0}", serviceDll);

                    m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(serviceDll, args);

                    if (m_PresenceService == null)
                    {
                        m_log.Error("[LOCAL PRESENCE CONNECTOR]: Can't load presence service");
                        //return;
                        throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
                    }

                    //Init(source);

                    m_PresenceDetector = new PresenceDetector(this);

                    m_Enabled = true;
                    m_log.Info("[LOCAL PRESENCE CONNECTOR]: Local presence connector enabled");
                }
            }
        }
Beispiel #37
0
 public CAPSPublicHandler(IHttpServer server, string pass, IInventoryService inventory, ILibraryService library, IGridUserService guService, IPresenceService presenceService, string hostName) :
     base("POST", "/CAPS/REGISTER")
 {
     m_server = server;
     CAPSPass = pass;
     m_inventory = inventory;
     m_library = library;
     m_GridUserService = guService;
     m_PresenceService = presenceService;
     m_hostName = hostName;
 }
Beispiel #38
0
        public GatekeeperService(IConfigSource config, ISimulationService simService)
        {
            if (!m_Initialized)
            {
                m_Initialized = true;

                IConfig serverConfig = config.Configs["GatekeeperService"];
                if (serverConfig == null)
                {
                    throw new Exception(String.Format("No section GatekeeperService in config file"));
                }

                string accountService       = serverConfig.GetString("UserAccountService", string.Empty);
                string homeUsersService     = serverConfig.GetString("UserAgentService", string.Empty);
                string gridService          = serverConfig.GetString("GridService", string.Empty);
                string presenceService      = serverConfig.GetString("PresenceService", string.Empty);
                string simulationService    = serverConfig.GetString("SimulationService", string.Empty);
                string gridUserService      = serverConfig.GetString("GridUserService", string.Empty);
                string bansService          = serverConfig.GetString("BansService", string.Empty);
                string accessControlService = serverConfig.GetString("AccessControlService", string.Empty);

                // These are mandatory, the others aren't
                if (gridService == string.Empty || presenceService == string.Empty)
                {
                    throw new Exception("Incomplete specifications, Gatekeeper Service cannot function.");
                }

                string scope = serverConfig.GetString("ScopeID", UUID.Zero.ToString());
                UUID.TryParse(scope, out m_ScopeID);
                //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
                m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);

                string[] sections     = new string[] { "Const, Startup", "Hypergrid", "GatekeeperService" };
                string   externalName = Util.GetConfigVarFromSections <string>(config, "GatekeeperURI", sections, string.Empty);
                if (string.IsNullOrEmpty(externalName))
                {
                    externalName = serverConfig.GetString("ExternalName", string.Empty);
                }

                m_gatekeeperHost = new OSHHTPHost(externalName, true);
                if (!m_gatekeeperHost.IsResolvedHost)
                {
                    m_log.Error((m_gatekeeperHost.IsValidHost ? "Could not resolve GatekeeperURI" : "GatekeeperURI is a invalid host ") + externalName ?? "");
                    throw new Exception("GatekeeperURI is invalid");
                }
                m_gatekeeperURL = m_gatekeeperHost.URIwEndSlash;

                string gatekeeperURIAlias = Util.GetConfigVarFromSections <string>(config, "GatekeeperURIAlias", sections, string.Empty);

                if (!string.IsNullOrWhiteSpace(gatekeeperURIAlias))
                {
                    string[] alias = gatekeeperURIAlias.Split(',');
                    for (int i = 0; i < alias.Length; ++i)
                    {
                        OSHHTPHost tmp = new OSHHTPHost(alias[i].Trim(), false);
                        if (tmp.IsValidHost)
                        {
                            if (m_gateKeeperAlias == null)
                            {
                                m_gateKeeperAlias = new HashSet <OSHHTPHost>();
                            }
                            m_gateKeeperAlias.Add(tmp);
                        }
                    }
                }

                object[] args = new object[] { config };
                m_GridService     = ServerUtils.LoadPlugin <IGridService>(gridService, args);
                m_PresenceService = ServerUtils.LoadPlugin <IPresenceService>(presenceService, args);

                if (accountService != string.Empty)
                {
                    m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(accountService, args);
                }
                if (homeUsersService != string.Empty)
                {
                    m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(homeUsersService, args);
                }
                if (gridUserService != string.Empty)
                {
                    m_GridUserService = ServerUtils.LoadPlugin <IGridUserService>(gridUserService, args);
                }
                //if (bansService != string.Empty)
                //    m_BansService = ServerUtils.LoadPlugin<IBansService>(bansService, args);
                if (accessControlService != string.Empty)
                {
                    m_AccessControlService = ServerUtils.LoadPlugin <IAccessControlService>(accessControlService, args);
                }

                if (simService != null)
                {
                    m_SimulationService = simService;
                }
                else if (simulationService != string.Empty)
                {
                    m_SimulationService = ServerUtils.LoadPlugin <ISimulationService>(simulationService, args);
                }

                string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" };
                m_AllowedClients = Util.GetConfigVarFromSections <string>(
                    config, "AllowedClients", possibleAccessControlConfigSections, string.Empty);
                m_DeniedClients = Util.GetConfigVarFromSections <string>(
                    config, "DeniedClients", possibleAccessControlConfigSections, string.Empty);
                m_DeniedMacs = Util.GetConfigVarFromSections <string>(
                    config, "DeniedMacs", possibleAccessControlConfigSections, string.Empty);
                m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true);

                LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions);
                LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_ForeignsDisallowedExceptions);

                if (m_GridService == null || m_PresenceService == null || m_SimulationService == null)
                {
                    throw new Exception("Unable to load a required plugin, Gatekeeper Service cannot function.");
                }

                IConfig presenceConfig = config.Configs["PresenceService"];
                if (presenceConfig != null)
                {
                    m_allowDuplicatePresences = presenceConfig.GetBoolean("AllowDuplicatePresences", m_allowDuplicatePresences);
                }

                IConfig messagingConfig = config.Configs["Messaging"];
                if (messagingConfig != null)
                {
                    m_messageKey = messagingConfig.GetString("MessageKey", String.Empty);
                }
                m_log.Debug("[GATEKEEPER SERVICE]: Starting...");
            }
        }
//        IConfig m_ClientsConfig;

        public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService)
        {
            m_LoginServerConfig = config.Configs["LoginService"];
            if (m_LoginServerConfig == null)
                throw new Exception(String.Format("No section LoginService in config file"));

            string accountService = m_LoginServerConfig.GetString("UserAccountService", String.Empty);
            string gridUserService = m_LoginServerConfig.GetString("GridUserService", String.Empty);
            string agentService = m_LoginServerConfig.GetString("UserAgentService", String.Empty);
            string authService = m_LoginServerConfig.GetString("AuthenticationService", String.Empty);
            string invService = m_LoginServerConfig.GetString("InventoryService", String.Empty);
            string gridService = m_LoginServerConfig.GetString("GridService", String.Empty);
            string presenceService = m_LoginServerConfig.GetString("PresenceService", String.Empty);
            string libService = m_LoginServerConfig.GetString("LibraryService", String.Empty);
            string friendsService = m_LoginServerConfig.GetString("FriendsService", String.Empty);
            string avatarService = m_LoginServerConfig.GetString("AvatarService", String.Empty);
            string simulationService = m_LoginServerConfig.GetString("SimulationService", String.Empty);

            m_DefaultRegionName = m_LoginServerConfig.GetString("DefaultRegion", String.Empty);
            m_WelcomeMessage = m_LoginServerConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
            m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
            m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
            m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
            m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
                new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty);
            m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
            m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
            m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);
            m_SearchURL = m_LoginServerConfig.GetString("SearchURL", string.Empty);
            m_Currency = m_LoginServerConfig.GetString("Currency", string.Empty);
            m_ClassifiedFee = m_LoginServerConfig.GetString("ClassifiedFee", string.Empty);
            m_DestinationGuide = m_LoginServerConfig.GetString ("DestinationGuide", string.Empty);
            m_AvatarPicker = m_LoginServerConfig.GetString ("AvatarPicker", string.Empty);

            m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty);
            m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty);

            m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time");

            // Clean up some of these vars
            if (m_MapTileURL != String.Empty)
            {
                m_MapTileURL = m_MapTileURL.Trim();
                if (!m_MapTileURL.EndsWith("/"))
                    m_MapTileURL = m_MapTileURL + "/";
            }

            // These are required; the others aren't
            if (accountService == string.Empty || authService == string.Empty)
                throw new Exception("LoginService is missing service specifications");

            // replace newlines in welcome message
            m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n");

            Object[] args = new Object[] { config };
            m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
            m_GridUserService = ServerUtils.LoadPlugin<IGridUserService>(gridUserService, args);
            m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
            m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(invService, args);

            if (gridService != string.Empty)
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
            if (presenceService != string.Empty)
                m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
            if (avatarService != string.Empty)
                m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args);
            if (friendsService != string.Empty)
                m_FriendsService = ServerUtils.LoadPlugin<IFriendsService>(friendsService, args);
            if (simulationService != string.Empty)
                m_RemoteSimulationService = ServerUtils.LoadPlugin<ISimulationService>(simulationService, args);
            if (agentService != string.Empty)
                m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(agentService, args);

            // Get the Hypergrid inventory service (exists only if Hypergrid is enabled)
            string hgInvServicePlugin = m_LoginServerConfig.GetString("HGInventoryServicePlugin", String.Empty);
            if (hgInvServicePlugin != string.Empty)
            {
                string hgInvServiceArg = m_LoginServerConfig.GetString("HGInventoryServiceConstructorArg", String.Empty);
                Object[] args2 = new Object[] { config, hgInvServiceArg };
                m_HGInventoryService = ServerUtils.LoadPlugin<IInventoryService>(hgInvServicePlugin, args2);
            }

            //
            // deal with the services given as argument
            //
            m_LocalSimulationService = simService;
            if (libraryService != null)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument");
                m_LibraryService = libraryService;
            }
            else if (libService != string.Empty)
            {
                m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService");
                m_LibraryService = ServerUtils.LoadPlugin<ILibraryService>(libService, args);
            }

            m_GatekeeperConnector = new GatekeeperServiceConnector();

            if (!Initialized)
            {
                Initialized = true;
                RegisterCommands();
            }

            m_log.DebugFormat("[LLOGIN SERVICE]: Starting...");

        }
 public void PostInitialize(IConfigSource config, IRegistryCore registry)
 {
     m_PresenceService = registry.RequestModuleInterface<IPresenceService>();
 }