diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index f64c161271..fc6325dc3d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } - protected void InitModule(IConfigSource config) + protected virtual void InitModule(IConfigSource config) { IConfig friendsConfig = config.Configs["Friends"]; if (friendsConfig != null) @@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } } - private void OnInstantMessage(IClientAPI client, GridInstantMessage im) + protected virtual void OnInstantMessage(IClientAPI client, GridInstantMessage im) { if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) { diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 9a6d277252..3728b85a16 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -50,6 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private int m_levelHGFriends = 0; + IUserManagement m_uMan; public IUserManagement UserManagementModule { @@ -87,6 +89,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends m_StatusNotifier = new HGStatusNotifier(this); } + protected override void InitModule(IConfigSource config) + { + base.InitModule(config); + + // Additionally to the base method + IConfig friendsConfig = config.Configs["HGFriendsModule"]; + if (friendsConfig != null) + { + m_levelHGFriends = friendsConfig.GetInt("LevelHGFriends", 0); + + // TODO: read in all config variables pertaining to + // HG friendship permissions + } + } + #endregion #region IFriendsSimConnector @@ -105,6 +122,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends #endregion + protected override void OnInstantMessage(IClientAPI client, GridInstantMessage im) + { + if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered) + { + // we got a friendship offer + UUID principalID = new UUID(im.fromAgentID); + UUID friendID = new UUID(im.toAgentID); + + // Check if friendID is foreigner and if principalID has the permission + // to request friendships with foreigners. If not, return immediately. + if (!UserManagementModule.IsLocalGridUser(friendID)) + { + ScenePresence avatar = null; + ((Scene)client.Scene).TryGetScenePresence(principalID, out avatar); + + if (avatar == null) + return; + + if (avatar.UserLevel < m_levelHGFriends) + { + client.SendAgentAlertMessage("Unable to send friendship invitation to foreigner. Insufficient permissions.", false); + return; + } + } + } + + base.OnInstantMessage(client, im); + } + protected override void OnApproveFriendRequest(IClientAPI client, UUID friendID, List callingCardFolders) { // Update the local cache. Yes, we need to do it right here diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1e743c3672..366e02dc40 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -168,12 +168,18 @@ namespace OpenSim.Region.CoreModules.World.Estate sendRegionInfoPacketToAll(); } - public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int corner, UUID texture) + public void setEstateTerrainBaseTexture(int level, UUID texture) + { + setEstateTerrainBaseTexture(null, level, texture); + sendRegionHandshakeToAll(); + } + + public void setEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) { if (texture == UUID.Zero) return; - switch (corner) + switch (level) { case 0: Scene.RegionInfo.RegionSettings.TerrainTexture1 = texture; @@ -193,6 +199,11 @@ namespace OpenSim.Region.CoreModules.World.Estate sendRegionInfoPacketToAll(); } + public void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue) + { + setEstateTerrainTextureHeights(null, corner, lowValue, highValue); + } + public void setEstateTerrainTextureHeights(IClientAPI client, int corner, float lowValue, float highValue) { switch (corner) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 509c4d7e3f..9b2ddfda70 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -447,7 +447,10 @@ namespace OpenSim.Region.CoreModules.World.Land { bool isMember; if (m_groupMemberCache.TryGetValue(avatar, out isMember)) + { + m_groupMemberCache.Update(avatar, isMember, m_groupMemberCacheTimeout); return isMember; + } IGroupsModule groupsModule = m_scene.RequestModuleInterface(); if (groupsModule == null) diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 72e79ed497..ca2ad94592 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -47,5 +47,8 @@ namespace OpenSim.Region.Framework.Interfaces void sendRegionHandshakeToAll(); void TriggerEstateInfoChange(); void TriggerRegionInfoChange(); + + void setEstateTerrainBaseTexture(int level, UUID texture); + void setEstateTerrainTextureHeights(int corner, float lowValue, float highValue); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0dc2aa2b95..28997742c8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3095,5 +3095,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ScriptBaseClass.TRUE; } + + /// + /// Sets terrain estate texture + /// + /// + /// + /// + public void osSetTerrainTexture(int level, LSL_Key texture) + { + CheckThreatLevel(ThreatLevel.High, "osSetTerrainTexture"); + + m_host.AddScriptLPS(1); + //Check to make sure that the script's owner is the estate manager/master + //World.Permissions.GenericEstatePermission( + if (World.Permissions.IsGod(m_host.OwnerID)) + { + if (level < 0 || level > 3) + return; + + UUID textureID = new UUID(); + if (!UUID.TryParse(texture, out textureID)) + return; + + // estate module is required + IEstateModule estate = World.RequestModuleInterface(); + if (estate != null) + estate.setEstateTerrainBaseTexture(level, textureID); + } + } + + /// + /// Sets terrain heights of estate + /// + /// + /// + /// + /// + public void osSetTerrainTextureHeight(int corner, double low, double high) + { + CheckThreatLevel(ThreatLevel.High, "osSetTerrainTextureHeight"); + + m_host.AddScriptLPS(1); + //Check to make sure that the script's owner is the estate manager/master + //World.Permissions.GenericEstatePermission( + if (World.Permissions.IsGod(m_host.OwnerID)) + { + if (corner < 0 || corner > 3) + return; + + // estate module is required + IEstateModule estate = World.RequestModuleInterface(); + if (estate != null) + estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high); + } + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 444a681b55..2fcc443a00 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -234,5 +234,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_Integer osInviteToGroup(LSL_Key agentId); LSL_Integer osEjectFromGroup(LSL_Key agentId); + + void osSetTerrainTexture(int level, LSL_Key texture); + void osSetTerrainTextureHeight(int corner, double low, double high); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 680cefb4e0..b94b9bffe0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -878,5 +878,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osEjectFromGroup(agentId); } + + public void osSetTerrainTexture(int level, LSL_Key texture) + { + m_OSSL_Functions.osSetTerrainTexture(level, texture); + } + + public void osSetTerrainTextureHeight(int corner, double low, double high) + { + m_OSSL_Functions.osSetTerrainTextureHeight(corner, low, high); + } } } diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 7deaf954c0..f982cc1360 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -116,29 +116,36 @@ namespace OpenSim.Services.Connectors } else if (replyData.ContainsKey("Result")&& (replyData["Result"].ToString().ToLower() == "failure")) { - m_log.DebugFormat("[GRID CONNECTOR]: Registration failed: {0}", replyData["Message"].ToString()); + m_log.ErrorFormat( + "[GRID CONNECTOR]: Registration failed: {0} when contacting {1}", replyData["Message"], uri); + return replyData["Message"].ToString(); } else if (!replyData.ContainsKey("Result")) { - m_log.DebugFormat("[GRID CONNECTOR]: reply data does not contain result field"); + m_log.ErrorFormat( + "[GRID CONNECTOR]: reply data does not contain result field when contacting {0}", uri); } else { - m_log.DebugFormat("[GRID CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); - return "Unexpected result "+replyData["Result"].ToString(); + m_log.ErrorFormat( + "[GRID CONNECTOR]: unexpected result {0} when contacting {1}", replyData["Result"], uri); + + return "Unexpected result " + replyData["Result"].ToString(); } - } else - m_log.DebugFormat("[GRID CONNECTOR]: RegisterRegion received null reply"); + { + m_log.ErrorFormat( + "[GRID CONNECTOR]: RegisterRegion received null reply when contacting grid server at {0}", uri); + } } catch (Exception e) { - m_log.DebugFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); + m_log.ErrorFormat("[GRID CONNECTOR]: Exception when contacting grid server at {0}: {1}", uri, e.Message); } - return "Error communicating with grid service"; + return string.Format("Error communicating with the grid service at {0}", uri); } public bool DeregisterRegion(UUID regionID) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 6fb97876f2..babd0ec3a3 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1129,7 +1129,7 @@ ; Maximum number of llListen events we allow over the entire region. ; Set this to 0 to have no limit imposed - max_listeners_per_region = 1000 + max_listens_per_region = 1000 ; Maximum number of llListen events we allow per script ; Set this to 0 to have no limit imposed. diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 0eb8291679..4ea5ffd051 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -319,13 +319,13 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 ; password help: optional: page providing password assistance for users of your grid ;password = http://127.0.0.1/password - ; HG address of the gatekeeper, if you have one - ; this is the entry point for all the regions of the world - ; gatekeeper = http://127.0.0.1:8002/ + ; HG address of the gatekeeper, if you have one + ; this is the entry point for all the regions of the world + ; gatekeeper = http://127.0.0.1:8002/ - ; HG user domain, if you have one - ; this is the entry point for all user-related HG services - ; uas = http://127.0.0.1:8002/ + ; HG user domain, if you have one + ; this is the entry point for all user-related HG services + ; uas = http://127.0.0.1:8002/ [GatekeeperService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:GatekeeperService" diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example index fa6f5258c5..8d7f6fc427 100644 --- a/bin/config-include/GridCommon.ini.example +++ b/bin/config-include/GridCommon.ini.example @@ -137,6 +137,10 @@ ;; uncomment the next line. You may want to do this on sims that have licensed content. ; OutboundPermission = False +[HGFriendsModule] + ; User level required to be able to send friendship invitations to foreign users + ;LevelHGFriends = 0; + [UserAgentService] ; ; === HG ONLY === diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 4f4f4005d0..e4bc548967 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -61,6 +61,10 @@ ;; uncomment the next line. You may want to do this on sims that have licensed content. ; OutboundPermission = False +[HGFriendsModule] + ; User level required to be able to send friendship invitations to foreign users + ;LevelHGFriends = 0; + [GridService] ;; For in-memory region storage (default) StorageProvider = "OpenSim.Data.Null.dll:NullRegionData" @@ -231,13 +235,13 @@ ; currently unused ;password = http://127.0.0.1/password - ; HG address of the gatekeeper, if you have one - ; this is the entry point for all the regions of the world - ; gatekeeper = http://127.0.0.1:9000/ + ; HG address of the gatekeeper, if you have one + ; this is the entry point for all the regions of the world + ; gatekeeper = http://127.0.0.1:9000/ - ; HG user domain, if you have one - ; this is the entry point for all user-related HG services - ; uas = http://127.0.0.1:9000/ + ; HG user domain, if you have one + ; this is the entry point for all user-related HG services + ; uas = http://127.0.0.1:9000/ [MapImageService] ; Set this if you want to change the default