Merge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
UbitUmarov 2012-03-23 03:41:48 +00:00
commit 4db05a98c2
42 changed files with 893 additions and 279 deletions

View File

@ -25,39 +25,38 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Collections.Generic;
using System.Xml;
using OpenMetaverse;
using System;
using System.Reflection;
using log4net;
namespace OpenSim.Region.Framework.Scenes.Animation
public class GcNotify
{
public class AvatarAnimations
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static bool Enabled
{
public Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
public Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
public Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
public AvatarAnimations()
get { return s_initialized; }
set
{
using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"))
{
XmlDocument doc = new XmlDocument();
doc.Load(reader);
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{
if (nod.Attributes["name"] != null)
{
string name = (string)nod.Attributes["name"].Value;
UUID id = (UUID)nod.InnerText;
string animState = (string)nod.Attributes["state"].Value;
if (!s_initialized && value)
new GcNotify();
AnimsUUID.Add(name, id);
AnimsNames.Add(id, name);
if (animState != "")
AnimStateNames.Add(id, animState);
}
}
}
s_initialized = value;
}
}
}
private static bool s_initialized = false;
private GcNotify() {}
~GcNotify()
{
if (!Environment.HasShutdownStarted && !AppDomain.CurrentDomain.IsFinalizingForUnload())
{
m_log.DebugFormat("[GC NOTIFY]: Garbage collection triggered.");
if (Enabled)
new GcNotify();
}
}
}

View File

@ -1226,10 +1226,9 @@ namespace OpenSim.Framework
/// <param name="OrbitalPosition">The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView</param>
void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear,
float OrbitalPosition);
void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks);
void SendViewerTime(int phase);
UUID GetDefaultAnimation(string name);
void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, string flAbout,
uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID);

View File

@ -71,6 +71,7 @@ namespace OpenSim.Framework
bool IsEitherBannedOrRestricted(UUID avatar);
bool IsBannedFromLand(UUID avatar);
bool IsRestrictedFromLand(UUID avatar);
bool IsInLandAccessList(UUID avatar);
void SendLandUpdateToClient(IClientAPI remote_client);
void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client);
List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag);

View File

@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Xml;
using log4net;
@ -40,13 +41,6 @@ namespace OpenSim.Framework
#region SL / file extension / content-type conversions
public static Dictionary<string, UUID> DefaultAvatarAnimations = new Dictionary<string, UUID>();
static SLUtil()
{
DefaultAvatarAnimations = LoadDefaultAvatarAnimations("data/avataranimations.xml");
}
public static string SLAssetTypeToContentType(int assetType)
{
switch ((AssetType)assetType)
@ -382,47 +376,5 @@ namespace OpenSim.Framework
return output;
}
/// <summary>
/// Load the default SL avatar animations.
/// </summary>
/// <returns></returns>
public static Dictionary<string, UUID> LoadDefaultAvatarAnimations(string path)
{
Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
using (XmlTextReader reader = new XmlTextReader(path))
{
XmlDocument doc = new XmlDocument();
doc.Load(reader);
if (doc.DocumentElement != null)
{
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{
if (nod.Attributes["name"] != null)
{
string name = nod.Attributes["name"].Value.ToLower();
string id = nod.InnerText;
animations.Add(name, (UUID)id);
}
}
}
}
return animations;
}
/// <summary>
/// Get the default SL avatar animation with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static UUID GetDefaultAvatarAnimation(string name)
{
if (DefaultAvatarAnimations.ContainsKey(name))
return DefaultAvatarAnimations[name];
return UUID.Zero;
}
}
}

View File

@ -919,7 +919,7 @@ namespace OpenSim
break;
case "scene":
if (args.Length == 5)
if (args.Length == 4)
{
if (m_sceneManager.CurrentScene == null)
{
@ -927,39 +927,21 @@ namespace OpenSim
}
else
{
bool scriptingOn = !Convert.ToBoolean(args[2]);
bool collisionsOn = !Convert.ToBoolean(args[3]);
bool physicsOn = !Convert.ToBoolean(args[4]);
m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn);
string key = args[2];
string value = args[3];
m_sceneManager.CurrentScene.SetSceneCoreDebug(
new Dictionary<string, string>() { { key, value } });
MainConsole.Instance.Output(
String.Format(
"Set debug scene scripting = {0}, collisions = {1}, physics = {2}",
!scriptingOn, !collisionsOn, !physicsOn));
MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value);
}
}
else
{
MainConsole.Instance.Output("Usage: debug scene <scripting> <collisions> <physics> (where inside <> is true/false)");
MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics|teleport true|false");
}
break;
case "teleport":
foreach(Scene s in m_sceneManager.Scenes)
{
if (s.DEBUG)
{
s.DEBUG = false;
MainConsole.Instance.Output("Teleport debugging is disabled!");
}
else{
s.DEBUG = true;
MainConsole.Instance.Output("Teleport debugging is enabled!");
}
}
break;
default:
MainConsole.Instance.Output("Unknown debug command");
break;

View File

@ -11418,15 +11418,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
scriptQuestion.Data.Questions = question;
scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName);
scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName);
OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
}
public UUID GetDefaultAnimation(string name)
{
return SLUtil.GetDefaultAvatarAnimation(name);
}
/// <summary>
/// Handler called when we receive a logout packet.
/// </summary>

View File

@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.EventManager.OnClientLogin += OnClientLogin;
}
public void RegionLoaded(Scene scene)
public virtual void RegionLoaded(Scene scene)
{
}
@ -582,10 +582,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Try the local sim
if (LocalFriendshipOffered(friendID, im))
{
m_log.DebugFormat("[XXX]: LocalFriendshipOffered successes");
return true;
}
// The prospective friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
IUserManagement m_uMan;
IUserManagement UserManagementModule
public IUserManagement UserManagementModule
{
get
{
@ -62,6 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
protected HGFriendsServicesConnector m_HGFriendsConnector = new HGFriendsServicesConnector();
protected HGStatusNotifier m_StatusNotifier;
#region ISharedRegionModule
public override string Name
@ -78,6 +79,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.RegisterModuleInterface<IFriendsSimConnector>(this);
}
public override void RegionLoaded(Scene scene)
{
if (!m_Enabled)
return;
if (m_StatusNotifier == null)
m_StatusNotifier = new HGStatusNotifier(this);
}
#endregion
#region IFriendsSimConnector
@ -230,25 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (friendsPerDomain.ContainsKey("local"))
base.StatusNotify(friendsPerDomain["local"], userID, online);
foreach (KeyValuePair<string, List<FriendInfo>> kvp in friendsPerDomain)
{
if (kvp.Key != "local")
{
// For the others, call the user agent service
List<string> ids = new List<string>();
foreach (FriendInfo f in kvp.Value)
ids.Add(f.Friend);
UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key);
List<UUID> friendsOnline = uConn.StatusNotification(ids, userID, online);
if (online && friendsOnline.Count > 0)
{
IClientAPI client = LocateClientObject(userID);
if (client != null)
client.SendAgentOnline(friendsOnline.ToArray());
}
}
}
m_StatusNotifier.Notify(userID, friendsPerDomain, online);
// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID);
}
@ -261,25 +252,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// fid is not a UUID...
string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty;
m_log.DebugFormat("[YYY]: FID {0}", fid);
if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp))
{
m_log.DebugFormat("[YYY]: Adding user {0} {1} {2}", f, l, url);
m_uMan.AddUser(agentID, f, l, url);
if (!agentID.Equals(UUID.Zero))
{
m_uMan.AddUser(agentID, f, l, url);
string name = m_uMan.GetUserName(agentID);
string[] parts = name.Trim().Split(new char[] {' '});
if (parts.Length == 2)
{
first = parts[0];
last = parts[1];
string name = m_uMan.GetUserName(agentID);
string[] parts = name.Trim().Split(new char[] { ' ' });
if (parts.Length == 2)
{
first = parts[0];
last = parts[1];
}
else
{
first = f;
last = l;
}
return true;
}
else
{
first = f;
last = l;
}
return true;
}
return false;
}
@ -744,7 +736,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
{
string[] parts = im.fromAgentName.Split(new char[] { '@' });
if (parts.Length == 2)
m_uMan.AddUser(new UUID(im.fromAgentID), parts[0], "http://" + parts[1]);
{
string[] fl = parts[0].Trim().Split(new char[] { '.' });
if (fl.Length == 2)
m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], fl[1], "http://" + parts[1]);
else
m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], "", "http://" + parts[1]);
}
}
return true;
}

View File

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors.Hypergrid;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
using OpenMetaverse;
using log4net;
namespace OpenSim.Region.CoreModules.Avatar.Friends
{
public class HGStatusNotifier
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private HGFriendsModule m_FriendsModule;
public HGStatusNotifier(HGFriendsModule friendsModule)
{
m_FriendsModule = friendsModule;
}
public void Notify(UUID userID, Dictionary<string, List<FriendInfo>> friendsPerDomain, bool online)
{
foreach (KeyValuePair<string, List<FriendInfo>> kvp in friendsPerDomain)
{
if (kvp.Key != "local")
{
// For the others, call the user agent service
List<string> ids = new List<string>();
foreach (FriendInfo f in kvp.Value)
ids.Add(f.Friend);
if (ids.Count == 0)
continue; // no one to notify. caller don't do this
m_log.DebugFormat("[HG STATUS NOTIFIER]: Notifying {0} friends in {1}", ids.Count, kvp.Key);
// ASSUMPTION: we assume that all users for one home domain
// have exactly the same set of service URLs.
// If this is ever not true, we need to change this.
UUID friendID = UUID.Zero; String tmp = String.Empty;
if (Util.ParseUniversalUserIdentifier(ids[0], out friendID, out tmp, out tmp, out tmp, out tmp))
{
string friendsServerURI = m_FriendsModule.UserManagementModule.GetUserServerURL(friendID, "FriendsServerURI");
if (friendsServerURI != string.Empty)
{
HGFriendsServicesConnector fConn = new HGFriendsServicesConnector(friendsServerURI);
List<UUID> friendsOnline = fConn.StatusNotification(ids, userID, online);
if (online && friendsOnline.Count > 0)
{
IClientAPI client = m_FriendsModule.LocateClientObject(userID);
if (client != null)
client.SendAgentOnline(friendsOnline.ToArray());
}
}
}
}
}
}
}
}

View File

@ -691,7 +691,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
Scene.RegionInfo.RegionSettings.Save();
TriggerRegionInfoChange();
Scene.SetSceneCoreDebug(disableScripts, disableCollisions, disablePhysics);
Scene.SetSceneCoreDebug(
new Dictionary<string, string>() {
{ "scripting", (!disableScripts).ToString() },
{ "collisions", (!disableCollisions).ToString() },
{ "physics", (!disablePhysics).ToString() }
}
);
}
private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey)

View File

@ -497,7 +497,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public bool IsRestrictedFromLand(UUID avatar)
{
ExpireAccessList();
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0)
return false;
if (m_scene.Permissions.IsAdministrator(avatar))
return false;
@ -508,24 +509,27 @@ namespace OpenSim.Region.CoreModules.World.Land
if (avatar == LandData.OwnerID)
return false;
if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
{
if (LandData.ParcelAccessList.FindIndex(
delegate(LandAccessEntry e)
{
if (e.AgentID == avatar && e.Flags == AccessList.Access)
return true;
return false;
}) == -1)
{
if (!HasGroupAccess(avatar))
{
return true;
}
}
}
if (HasGroupAccess(avatar))
return false;
return false;
return (!IsInLandAccessList(avatar));
}
public bool IsInLandAccessList(UUID avatar)
{
ExpireAccessList();
if (LandData.ParcelAccessList.FindIndex(
delegate(LandAccessEntry e)
{
if (e.AgentID == avatar && e.Flags == AccessList.Access)
return true;
return false;
}) == -1)
{
return false;
}
return true;
}
public void SendLandUpdateToClient(IClientAPI remote_client)

View File

@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
private bool m_RegionOwnerIsGod = false;
private bool m_RegionManagerIsGod = false;
private bool m_ParcelOwnerIsGod = false;
private bool m_SimpleBuildPermissions = false;
/// <value>
/// The set of users that are allowed to create scripts. This is only active if permissions are not being
/// bypassed. This overrides normal permissions.
@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true);
m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false);
m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false);
m_allowedScriptCreators
= ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
m_allowedScriptEditors
@ -824,6 +828,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
permission = true;
}
if (m_SimpleBuildPermissions &&
(parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user))
permission = true;
return permission;
}

View File

@ -598,6 +598,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain
"[TERRAIN]: Could not save terrain from {0} to {1}. Valid file extensions are {2}",
m_scene.RegionInfo.RegionName, filename, m_supportedFileExtensions);
}
else
{
m_log.ErrorFormat(
"[TERRAIN]: Could not save terrain from {0} to {1}. {2} {3} {4} {5} {6} {7}",
m_scene.RegionInfo.RegionName, filename, fileWidth, fileHeight, fileStartX, fileStartY, offsetX, offsetY);
}
}
/// <summary>

View File

@ -156,6 +156,15 @@ namespace OpenSim.Region.Framework.Interfaces
/// <returns>null if the item does not exist</returns>
TaskInventoryItem GetInventoryItem(UUID itemId);
/// <summary>
/// Get all inventory items.
/// </summary>
/// <param name="name"></param>
/// <returns>
/// If there are no inventory items then an empty list is returned.
/// </returns>
List<TaskInventoryItem> GetInventoryItems();
/// <summary>
/// Get inventory items by name.
/// </summary>
@ -164,7 +173,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned.
/// </returns>
IList<TaskInventoryItem> GetInventoryItems(string name);
List<TaskInventoryItem> GetInventoryItems(string name);
/// <summary>
/// Get the scene object referenced by an inventory item.

View File

@ -27,8 +27,10 @@
using System;
using System.Collections.Generic;
using OpenSim.Framework;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using Animation = OpenSim.Framework.Animation;
@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
[Serializable]
public class AnimationSet
{
public static AvatarAnimations Animations = new AvatarAnimations();
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation();
private List<OpenSim.Framework.Animation> m_animations = new List<OpenSim.Framework.Animation>();
@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
/// </summary>
public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID)
{
if (Animations.AnimsUUID.ContainsKey(anim))
// m_log.DebugFormat(
// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}",
// anim, sequenceNum, objectID);
if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim))
{
return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID);
return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID);
}
return false;
}

View File

@ -0,0 +1,108 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Collections.Generic;
using System.Reflection;
using System.Xml;
using log4net;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Scenes.Animation
{
public class DefaultAvatarAnimations
{
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static readonly string DefaultAnimationsPath = "data/avataranimations.xml";
public static Dictionary<string, UUID> AnimsUUID = new Dictionary<string, UUID>();
public static Dictionary<UUID, string> AnimsNames = new Dictionary<UUID, string>();
public static Dictionary<UUID, string> AnimStateNames = new Dictionary<UUID, string>();
static DefaultAvatarAnimations()
{
LoadAnimations(DefaultAnimationsPath);
}
/// <summary>
/// Load the default SL avatar animations.
/// </summary>
/// <returns></returns>
private static void LoadAnimations(string path)
{
// Dictionary<string, UUID> animations = new Dictionary<string, UUID>();
using (XmlTextReader reader = new XmlTextReader(path))
{
XmlDocument doc = new XmlDocument();
doc.Load(reader);
// if (doc.DocumentElement != null)
// {
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{
if (nod.Attributes["name"] != null)
{
string name = nod.Attributes["name"].Value;
UUID id = (UUID)nod.InnerText;
string animState = (string)nod.Attributes["state"].Value;
AnimsUUID.Add(name, id);
AnimsNames.Add(id, name);
if (animState != "")
AnimStateNames.Add(id, animState);
// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState);
}
}
// }
}
// return animations;
}
/// <summary>
/// Get the default avatar animation with the given name.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static UUID GetDefaultAnimation(string name)
{
// m_log.DebugFormat(
// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name);
if (AnimsUUID.ContainsKey(name))
{
// m_log.DebugFormat(
// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name);
return AnimsUUID[name];
}
return UUID.Zero;
}
}
}

View File

@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_scenePresence.IsChildAgent)
return;
UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name);
// XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
// are referenced with lower case names!
UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper());
if (animID == UUID.Zero)
return;
@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (m_scenePresence.IsChildAgent)
return;
UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name);
// XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations
// are referenced with lower case names!
UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name);
if (animID == UUID.Zero)
return;

View File

@ -1217,9 +1217,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary>
/// Copy a task (prim) inventory item to another task (prim)
/// </summary>
/// <param name="destId"></param>
/// <param name="part"></param>
/// <param name="itemId"></param>
/// <param name="destId">ID of destination part</param>
/// <param name="part">Source part</param>
/// <param name="itemId">Source item id to transfer</param>
public void MoveTaskInventoryItem(UUID destId, SceneObjectPart part, UUID itemId)
{
TaskInventoryItem srcTaskItem = part.Inventory.GetInventoryItem(itemId);
@ -1247,14 +1247,14 @@ namespace OpenSim.Region.Framework.Scenes
// Can't transfer this
//
if ((part.OwnerID != destPart.OwnerID) && ((srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0))
if (part.OwnerID != destPart.OwnerID && (srcTaskItem.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
return;
bool overrideNoMod = false;
if ((part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) != 0)
overrideNoMod = true;
if (part.OwnerID != destPart.OwnerID && (part.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
if (part.OwnerID != destPart.OwnerID && (destPart.GetEffectiveObjectFlags() & (uint)PrimFlags.AllowInventoryDrop) == 0)
{
// object cannot copy items to an object owned by a different owner
// unless llAllowInventoryDrop has been called

View File

@ -65,7 +65,16 @@ namespace OpenSim.Region.Framework.Scenes
#region Fields
public bool EmergencyMonitoring = false;
public bool DEBUG = false;
/// <summary>
/// Show debug information about teleports.
/// </summary>
public bool DebugTeleporting { get; private set; }
/// <summary>
/// Show debug information about the scene loop.
/// </summary>
public bool DebugUpdates { get; private set; }
public SynchronizeSceneHandler SynchronizeScene;
public SimStatsReporter StatsReporter;
@ -1053,44 +1062,66 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine)
public void SetSceneCoreDebug(Dictionary<string, string> options)
{
if (m_scripts_enabled != !ScriptEngine)
if (options.ContainsKey("scripting"))
{
if (ScriptEngine)
bool enableScripts = true;
if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts)
{
m_log.Info("Stopping all Scripts in Scene");
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
if (!enableScripts)
{
if (ent is SceneObjectGroup)
((SceneObjectGroup)ent).RemoveScriptInstances(false);
}
}
else
{
m_log.Info("Starting all Scripts in Scene");
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
{
if (ent is SceneObjectGroup)
m_log.Info("Stopping all Scripts in Scene");
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
{
SceneObjectGroup sog = (SceneObjectGroup)ent;
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
sog.ResumeScripts();
if (ent is SceneObjectGroup)
((SceneObjectGroup)ent).RemoveScriptInstances(false);
}
}
else
{
m_log.Info("Starting all Scripts in Scene");
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
{
if (ent is SceneObjectGroup)
{
SceneObjectGroup sog = (SceneObjectGroup)ent;
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
sog.ResumeScripts();
}
}
}
}
m_scripts_enabled = !ScriptEngine;
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
m_scripts_enabled = enableScripts;
}
}
if (m_physics_enabled != !PhysicsEngine)
if (options.ContainsKey("physics"))
{
m_physics_enabled = !PhysicsEngine;
bool enablePhysics;
if (bool.TryParse(options["physics"], out enablePhysics))
m_physics_enabled = enablePhysics;
}
if (options.ContainsKey("teleport"))
{
bool enableTeleportDebugging;
if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
DebugTeleporting = enableTeleportDebugging;
}
if (options.ContainsKey("updates"))
{
bool enableUpdateDebugging;
if (bool.TryParse(options["updates"], out enableUpdateDebugging))
{
DebugUpdates = enableUpdateDebugging;
GcNotify.Enabled = DebugUpdates;
}
}
}
@ -1427,7 +1458,7 @@ namespace OpenSim.Region.Framework.Scenes
// Tell the watchdog that this thread is still alive
Watchdog.UpdateThread();
// previousFrameTick = m_lastFrameTick;
previousFrameTick = m_lastFrameTick;
m_lastFrameTick = Util.EnvironmentTickCount();
maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
maintc = (int)(MinFrameTime * 1000) - maintc;
@ -1442,12 +1473,14 @@ namespace OpenSim.Region.Framework.Scenes
m_firstHeartbeat = false;
// Optionally warn if a frame takes double the amount of time that it should.
// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
// m_log.WarnFormat(
// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
// MinFrameTime * 1000,
// RegionInfo.RegionName);
if (DebugUpdates
&& Util.EnvironmentTickCountSubtract(
m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
m_log.WarnFormat(
"[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
MinFrameTime * 1000,
RegionInfo.RegionName);
}
}

View File

@ -778,9 +778,9 @@ namespace OpenSim.Region.Framework.Scenes
/// A list of inventory items with that name.
/// If no inventory item has that name then an empty list is returned.
/// </returns>
public IList<TaskInventoryItem> GetInventoryItems(string name)
public List<TaskInventoryItem> GetInventoryItems(string name)
{
IList<TaskInventoryItem> items = new List<TaskInventoryItem>();
List<TaskInventoryItem> items = new List<TaskInventoryItem>();
m_items.LockItemsForRead(true);
@ -1295,7 +1295,7 @@ namespace OpenSim.Region.Framework.Scenes
public List<TaskInventoryItem> GetInventoryItems()
{
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
List<TaskInventoryItem> ret = new List<TaskInventoryItem>();
lock (m_items)
ret = new List<TaskInventoryItem>(m_items.Values);

View File

@ -3920,7 +3920,7 @@ namespace OpenSim.Region.Framework.Scenes
ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y);
if (land != null)
{
if (Scene.DEBUG)
if (Scene.DebugTeleporting)
TeleportFlagsDebug();
// If we come in via login, landmark or map, we want to

View File

@ -113,7 +113,7 @@ namespace OpenSim.Region.Framework.Tests
}
/// <summary>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
/// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
/// </summary>
/// <remarks>
/// This should place it in the most suitable user folder.
@ -142,9 +142,11 @@ namespace OpenSim.Region.Framework.Tests
}
/// <summary>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
/// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned.
/// </summary>
/// <remarks>
/// This should place it in the most suitable user folder.
/// </remarks>
[Test]
public void TestMoveTaskInventoryItemNoParent()
{

View File

@ -1211,11 +1211,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public UUID GetDefaultAnimation(string name)
{
return UUID.Zero;
}
public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID)
{

View File

@ -133,11 +133,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
}
public UUID GetDefaultAnimation(string name)
{
return SLUtil.GetDefaultAvatarAnimation(name);
}
public Vector3 Position
{
get { return m_scene.Entities[m_uuid].AbsolutePosition; }

View File

@ -4764,7 +4764,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.RegionHandle == presence.RegionHandle)
{
Dictionary<UUID, string> animationstateNames = AnimationSet.Animations.AnimStateNames;
Dictionary<UUID, string> animationstateNames = DefaultAvatarAnimations.AnimStateNames;
if (presence != null)
{
@ -6064,7 +6064,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
if (agent.Animator.Animations.DefaultAnimation.AnimID
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
== DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
{
flags |= ScriptBaseClass.AGENT_SITTING;
}
@ -8408,7 +8408,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Vector lower;
LSL_Vector upper;
if (presence.Animator.Animations.DefaultAnimation.AnimID
== AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
== DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
{
// This is for ground sitting avatars
float height = presence.Appearance.AvatarHeight / 2.66666667f;

View File

@ -0,0 +1,168 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using log4net;
using Nini.Config;
using NUnit.Framework;
using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
using OpenSim.Region.CoreModules.Avatar.AvatarFactory;
using OpenSim.Region.OptionalModules.World.NPC;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.ScriptEngine.Shared.Tests
{
/// <summary>
/// Tests for inventory functions in LSL
/// </summary>
[TestFixture]
public class LSL_ApiInventoryTests
{
protected Scene m_scene;
protected XEngine.XEngine m_engine;
[SetUp]
public void SetUp()
{
IConfigSource initConfigSource = new IniConfigSource();
IConfig config = initConfigSource.AddConfig("XEngine");
config.Set("Enabled", "true");
m_scene = SceneHelpers.SetupScene();
SceneHelpers.SetupSceneModules(m_scene, initConfigSource);
m_engine = new XEngine.XEngine();
m_engine.Initialise(initConfigSource);
m_engine.AddRegion(m_scene);
}
/// <summary>
/// Test giving inventory from an object to an object where both are owned by the same user.
/// </summary>
[Test]
public void TestLlGiveInventoryO2OSameOwner()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID userId = TestHelpers.ParseTail(0x1);
string inventoryItemName = "item1";
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, userId, "so1", 0x10);
m_scene.AddSceneObject(so1);
// Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20);
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, userId);
LSL_Api api = new LSL_Api();
api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
// Create a second object
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
m_scene.AddSceneObject(so2);
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
// Item has copy permissions so original should stay intact.
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
Assert.That(originalItems.Count, Is.EqualTo(1));
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
Assert.That(copiedItems.Count, Is.EqualTo(1));
Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
}
/// <summary>
/// Test giving inventory from an object to an object where they have different owners
/// </summary>
[Test]
public void TestLlGiveInventoryO2ODifferentOwners()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
UUID user1Id = TestHelpers.ParseTail(0x1);
UUID user2Id = TestHelpers.ParseTail(0x2);
string inventoryItemName = "item1";
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
m_scene.AddSceneObject(so1);
LSL_Api api = new LSL_Api();
api.Initialize(m_engine, so1.RootPart, so1.RootPart.LocalId, so1.RootPart.UUID);
// Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20);
TaskInventoryHelpers.AddSceneObject(m_scene, so1.RootPart, inventoryItemName, itemId, user1Id);
// Create a second object
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
m_scene.AddSceneObject(so2);
LSL_Api api2 = new LSL_Api();
api2.Initialize(m_engine, so2.RootPart, so2.RootPart.LocalId, so2.RootPart.UUID);
// *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
{
// Item has copy permissions so original should stay intact.
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
Assert.That(originalItems.Count, Is.EqualTo(1));
// Should have not copied
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
Assert.That(copiedItems.Count, Is.EqualTo(0));
}
// *** Secondly, we turn on allow inventory drop in the target and retest. ***
api2.llAllowInventoryDrop(1);
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
{
// Item has copy permissions so original should stay intact.
List<TaskInventoryItem> originalItems = so1.RootPart.Inventory.GetInventoryItems();
Assert.That(originalItems.Count, Is.EqualTo(1));
// Should now have copied.
List<TaskInventoryItem> copiedItems = so2.RootPart.Inventory.GetInventoryItems(inventoryItemName);
Assert.That(copiedItems.Count, Is.EqualTo(1));
Assert.That(copiedItems[0].Name, Is.EqualTo(inventoryItemName));
}
}
}
}

View File

@ -105,6 +105,9 @@ namespace OpenSim.Server.Handlers.Hypergrid
case "validate_friendship_offered":
return ValidateFriendshipOffered(request);
case "statusnotification":
return StatusNotification(request);
/*
case "friendship_approved":
return FriendshipApproved(request);
@ -197,7 +200,6 @@ namespace OpenSim.Server.Handlers.Hypergrid
string message = string.Empty;
string name = string.Empty;
m_log.DebugFormat("[HGFRIENDS HANDLER]: Friendship offered");
if (!request.ContainsKey("FromID") || !request.ContainsKey("ToID"))
return BoolResult(false);
@ -229,6 +231,59 @@ namespace OpenSim.Server.Handlers.Hypergrid
return BoolResult(success);
}
byte[] StatusNotification(Dictionary<string, object> request)
{
UUID principalID = UUID.Zero;
if (request.ContainsKey("userID"))
UUID.TryParse(request["userID"].ToString(), out principalID);
else
{
m_log.WarnFormat("[HGFRIENDS HANDLER]: no userID in request to notify");
return FailureResult();
}
bool online = true;
if (request.ContainsKey("online"))
Boolean.TryParse(request["online"].ToString(), out online);
else
{
m_log.WarnFormat("[HGFRIENDS HANDLER]: no online in request to notify");
return FailureResult();
}
List<string> friends = new List<string>();
int i = 0;
foreach (KeyValuePair<string, object> kvp in request)
{
if (kvp.Key.Equals("friend_" + i.ToString()))
{
friends.Add(kvp.Value.ToString());
i++;
}
}
List<UUID> onlineFriends = m_TheService.StatusNotification(friends, principalID, online);
Dictionary<string, object> result = new Dictionary<string, object>();
if ((onlineFriends == null) || ((onlineFriends != null) && (onlineFriends.Count == 0)))
result["RESULT"] = "NULL";
else
{
i = 0;
foreach (UUID f in onlineFriends)
{
result["friend_" + i] = f.ToString();
i++;
}
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
#endregion

View File

@ -222,6 +222,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
[Obsolete]
public XmlRpcResponse StatusNotification(XmlRpcRequest request, IPEndPoint remoteClient)
{
Hashtable hash = new Hashtable();

View File

@ -73,6 +73,18 @@ namespace OpenSim.Server.Handlers.Login
if (requestData != null)
{
foreach (string key in requestData.Keys)
{
object value = requestData[key];
Console.WriteLine("{0}:{1}", key, value);
if (value is ArrayList)
{
ICollection col = value as ICollection;
foreach (object item in col)
Console.WriteLine(" {0}", item);
}
}
if (requestData.ContainsKey("first") && requestData["first"] != null &&
requestData.ContainsKey("last") && requestData["last"] != null && (
(requestData.ContainsKey("passwd") && requestData["passwd"] != null) ||

View File

@ -94,6 +94,5 @@ namespace OpenSim.Server.Handlers.Login
server.AddXmlRPCHandler("set_login_level", loginHandlers.HandleXMLRPCSetLoginLevel, false);
server.SetDefaultLLSDHandler(loginHandlers.HandleLLSDLogin);
}
}
}

View File

@ -255,6 +255,58 @@ namespace OpenSim.Services.Connectors.Hypergrid
return false;
}
public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online)
{
Dictionary<string, object> sendData = new Dictionary<string, object>();
List<UUID> friendsOnline = new List<UUID>();
sendData["METHOD"] = "statusnotification";
sendData["userID"] = userID.ToString();
sendData["online"] = online.ToString();
int i = 0;
foreach (string s in friends)
{
sendData["friend_" + i.ToString()] = s;
i++;
}
string reply = string.Empty;
string uri = m_ServerURI + "/hgfriends";
try
{
reply = SynchronousRestFormsRequester.MakeRequest("POST",
uri,
ServerUtils.BuildQueryString(sendData));
}
catch (Exception e)
{
m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message);
return friendsOnline;
}
if (reply != string.Empty)
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
// Here is the actual response
foreach (string key in replyData.Keys)
{
if (key.StartsWith("friend_") && replyData[key] != null)
{
UUID uuid;
if (UUID.TryParse(replyData[key].ToString(), out uuid))
friendsOnline.Add(uuid);
}
}
}
else
m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Received empty reply from remote StatusNotify");
return friendsOnline;
}
#endregion
}
}

View File

@ -415,6 +415,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
GetBoolResponse(request, out reason);
}
[Obsolete]
public List<UUID> StatusNotification(List<string> friends, UUID userID, bool online)
{
Hashtable hash = new Hashtable();

View File

@ -202,8 +202,15 @@ namespace OpenSim.Services.Connectors
Dictionary<string, object> structData = data.ToKeyValuePairs();
foreach (KeyValuePair<string,object> kvp in structData)
foreach (KeyValuePair<string, object> kvp in structData)
{
if (kvp.Value == null)
{
m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Null value for {0}", kvp.Key);
continue;
}
sendData[kvp.Key] = kvp.Value.ToString();
}
return SendAndGetBoolReply(sendData);
}

View File

@ -214,6 +214,91 @@ namespace OpenSim.Services.HypergridService
return false;
}
public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online)
{
if (m_FriendsService == null || m_PresenceService == null)
{
m_log.WarnFormat("[HGFRIENDS SERVICE]: Unable to perform status notifications because friends or presence services are missing");
return new List<UUID>();
}
// Let's unblock the caller right now, and take it from here async
List<UUID> localFriendsOnline = new List<UUID>();
m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends of {2} status",
foreignUserID, friends.Count, (online ? "online" : "offline"));
// First, let's double check that the reported friends are, indeed, friends of that user
// And let's check that the secret matches
List<string> usersToBeNotified = new List<string>();
foreach (string uui in friends)
{
UUID localUserID;
string secret = string.Empty, tmp = string.Empty;
if (Util.ParseUniversalUserIdentifier(uui, out localUserID, out tmp, out tmp, out tmp, out secret))
{
FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID);
foreach (FriendInfo finfo in friendInfos)
{
if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret))
{
// great!
usersToBeNotified.Add(localUserID.ToString());
}
}
}
}
// Now, let's send the notifications
//m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: user has {0} local friends", usersToBeNotified.Count);
// First, let's send notifications to local users who are online in the home grid
PresenceInfo[] friendSessions = m_PresenceService.GetAgents(usersToBeNotified.ToArray());
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = null;
foreach (PresenceInfo pinfo in friendSessions)
if (pinfo.RegionID != UUID.Zero) // let's guard against traveling agents
{
friendSession = pinfo;
break;
}
if (friendSession != null)
{
ForwardStatusNotificationToSim(friendSession.RegionID, foreignUserID, friendSession.UserID, online);
usersToBeNotified.Remove(friendSession.UserID.ToString());
UUID id;
if (UUID.TryParse(friendSession.UserID, out id))
localFriendsOnline.Add(id);
}
}
// Lastly, let's notify the rest who may be online somewhere else
foreach (string user in usersToBeNotified)
{
UUID id = new UUID(user);
//m_UserAgentService.LocateUser(id);
//etc...
//if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName)
//{
// string url = m_TravelingAgents[id].GridExternalName;
// // forward
//}
//m_log.WarnFormat("[HGFRIENDS SERVICE]: User {0} is visiting another grid. HG Status notifications still not implemented.", user);
}
// and finally, let's send the online friends
if (online)
{
return localFriendsOnline;
}
else
return new List<UUID>();
}
#endregion IHGFriendsService
#region Aux
@ -296,6 +381,28 @@ namespace OpenSim.Services.HypergridService
return false;
}
protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online)
{
UUID userID;
if (UUID.TryParse(user, out userID))
{
if (m_FriendsLocalSimConnector != null)
{
m_log.DebugFormat("[HGFRIENDS SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline"));
m_FriendsLocalSimConnector.StatusNotify(foreignUserID, userID, online);
}
else
{
GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID);
if (region != null)
{
m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline"));
m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online);
}
}
}
}
#endregion Aux
}
}

View File

@ -332,6 +332,7 @@ namespace OpenSim.Services.HypergridService
return false;
}
[Obsolete]
public List<UUID> StatusNotification(List<string> friends, UUID foreignUserID, bool online)
{
if (m_FriendsService == null || m_PresenceService == null)
@ -412,6 +413,7 @@ namespace OpenSim.Services.HypergridService
return new List<UUID>();
}
[Obsolete]
protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online)
{
UUID userID;

View File

@ -65,8 +65,8 @@ namespace OpenSim.Services.Interfaces
UUID GetUUID(String first, String last);
// Returns the local friends online
[Obsolete]
List<UUID> StatusNotification(List<string> friends, UUID userID, bool online);
//List<UUID> GetOnlineFriends(UUID userID, List<string> friends);
bool IsAgentComingHome(UUID sessionID, string thisGridExternalName);
bool VerifyAgent(UUID sessionID, string token);
@ -92,6 +92,8 @@ namespace OpenSim.Services.Interfaces
bool DeleteFriendship(FriendInfo finfo, string secret);
bool FriendshipOffered(UUID from, string fromName, UUID to, string message);
bool ValidateFriendshipOffered(UUID fromID, UUID toID);
// Returns the local friends online
List<UUID> StatusNotification(List<string> friends, UUID userID, bool online);
}
public interface IInstantMessageSimConnector

View File

@ -62,22 +62,60 @@ namespace OpenSim.Tests.Clients.PresenceClient
string last = "Clueless";
string email = "foo@bar.com";
UserAccount account = new UserAccount(user1);
account.FirstName = first;
account.LastName = last;
account.Email = email;
account.ServiceURLs = new Dictionary<string, object>();
account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com");
account.ServiceURLs.Add("AssetServerURI", "http://cnn.com");
//UserAccount account = new UserAccount(user1);
//account.ScopeID = UUID.Zero;
//account.FirstName = first;
//account.LastName = last;
//account.Email = email;
//account.ServiceURLs = new Dictionary<string, object>();
//account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com");
//account.ServiceURLs.Add("AssetServerURI", "http://cnn.com");
bool success = m_Connector.StoreUserAccount(account);
if (success)
m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName);
//bool success = m_Connector.StoreUserAccount(account);
//if (success)
// m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName);
//else
// m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName);
//System.Console.WriteLine("\n");
//account = m_Connector.GetUserAccount(UUID.Zero, user1);
//if (account == null)
// m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1);
//else
//{
// m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
// account.PrincipalID, account.FirstName, account.LastName, account.Email);
// foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
// m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
//}
//System.Console.WriteLine("\n");
UserAccount account = m_Connector.GetUserAccount(UUID.Zero, first, last);
if (account == null)
m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name ");
else
m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName);
{
m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
account.PrincipalID, account.FirstName, account.LastName, account.Email);
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
}
System.Console.WriteLine("\n");
account = m_Connector.GetUserAccount(UUID.Zero, email);
if (account == null)
m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email");
else
{
m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
account.PrincipalID, account.FirstName, account.LastName, account.Email);
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
}
System.Console.WriteLine("\n");
account = m_Connector.GetUserAccount(UUID.Zero, user1);
if (account == null)
m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1);
@ -90,30 +128,16 @@ namespace OpenSim.Tests.Clients.PresenceClient
}
System.Console.WriteLine("\n");
account = m_Connector.GetUserAccount(UUID.Zero, first, last);
account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist");
if (account == null)
m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name for {0}", user1);
m_log.InfoFormat("[USER CLIENT]: Unable to retrieve account 'DoesNot Exist'");
else
{
m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
m_log.InfoFormat("[USER CLIENT]: Account 'DoesNot Exist' retrieved correctly. REALLY??? userID={0}; FirstName={1}; LastName={2}; Email={3}",
account.PrincipalID, account.FirstName, account.LastName, account.Email);
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
}
System.Console.WriteLine("\n");
account = m_Connector.GetUserAccount(UUID.Zero, email);
if (account == null)
m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email for {0}", user1);
else
{
m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
account.PrincipalID, account.FirstName, account.LastName, account.Email);
foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
}
}
}

View File

@ -702,11 +702,6 @@ namespace OpenSim.Tests.Common.Mock
{
}
public UUID GetDefaultAnimation(string name)
{
return UUID.Zero;
}
public void SendTakeControls(int controls, bool passToAgent, bool TakeControls)
{
}

View File

@ -194,6 +194,15 @@
; region_manager_is_god = false
; parcel_owner_is_god = true
;; More control over permissions
;; This is definitely not SL!
; Provides a simple control for land owners to give build rights to specific avatars
; in publicly accessible parcels that disallow object creation in general.
; Owners specific avatars by adding them to the Access List of the parcel
; without having to use the Groups feature
; simple_build_permissions = false
;; Default script engine to use. Currently, we only have XEngine
; DefaultScriptEngine = "XEngine"

View File

@ -260,6 +260,14 @@
; Default value is all
; allowed_script_editors = all
; Provides a simple control for land owners to give build rights to specific avatars
; in publicly accessible parcels that disallow object creation in general.
; Owners specific avatars by adding them to the Access List of the parcel
; without having to use the Groups feature
; Disabled by default
; simple_build_permissions = False
; ##
; ## SCRIPT ENGINE
; ##

View File

@ -395,8 +395,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
HomeURI = "http://127.0.0.1:8002"
[HGFriendsService]
LocalServiceModule = "OpenSim.Services.FriendsService.dll:FriendsService"
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGFriendsService"
UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService"
FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService"
UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService"
GridService = "OpenSim.Services.GridService.dll:GridService"
PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
[HGInstantMessageService]
LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInstantMessageService"

View File

@ -225,10 +225,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
MapTileURL = "http://127.0.0.1:8002";
; For V2/3 Web Profiles
ProfileServerURL = "http://127.0.0.1/profiles/[AGENT_NAME]
ProfileServerURL = "http://127.0.0.1/profiles/[AGENT_NAME]"
; For V2/V3 webapp authentication SSO
OpenIDServerURL = "http://127.0.0.1/openid/openidserver/
OpenIDServerURL = "http://127.0.0.1/openid/openidserver/"
; If you run this login server behind a proxy, set this to true
; HasProxy = false