Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Interfaces/IEstateModule.cs
avinationmerge
Melanie 2012-04-11 23:35:27 +01:00
commit 4a67e8b98f
13 changed files with 171 additions and 25 deletions

View File

@ -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)
{

View File

@ -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<UUID> callingCardFolders)
{
// Update the local cache. Yes, we need to do it right here

View File

@ -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)

View File

@ -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<IGroupsModule>();
if (groupsModule == null)

View File

@ -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);
}
}

View File

@ -3095,5 +3095,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ScriptBaseClass.TRUE;
}
/// <summary>
/// Sets terrain estate texture
/// </summary>
/// <param name="level"></param>
/// <param name="texture"></param>
/// <returns></returns>
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<IEstateModule>();
if (estate != null)
estate.setEstateTerrainBaseTexture(level, textureID);
}
}
/// <summary>
/// Sets terrain heights of estate
/// </summary>
/// <param name="corner"></param>
/// <param name="low"></param>
/// <param name="high"></param>
/// <returns></returns>
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<IEstateModule>();
if (estate != null)
estate.setEstateTerrainTextureHeights(corner, (float)low, (float)high);
}
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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)

View File

@ -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.

View File

@ -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"

View File

@ -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 ===

View File

@ -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