diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Framework/GcNotify.cs similarity index 56% rename from OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs rename to OpenSim/Framework/GcNotify.cs index 659c3a5c54..14a22a6104 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ b/OpenSim/Framework/GcNotify.cs @@ -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 AnimsUUID = new Dictionary(); - public Dictionary AnimsNames = new Dictionary(); - public Dictionary AnimStateNames = new Dictionary(); - - 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(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 94acdba339..004b1a67a2 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1226,10 +1226,9 @@ namespace OpenSim.Framework /// The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView 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); diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index dd73b3fe01..4f98d7bb30 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -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 CreateAccessListArrayByFlag(AccessList flag); diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index f9cb851a9e..db4541ef1a 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs @@ -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 DefaultAvatarAnimations = new Dictionary(); - - 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; } - - /// - /// Load the default SL avatar animations. - /// - /// - public static Dictionary LoadDefaultAvatarAnimations(string path) - { - Dictionary animations = new Dictionary(); - - 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; - } - - /// - /// Get the default SL avatar animation with the given name. - /// - /// - /// - public static UUID GetDefaultAvatarAnimation(string name) - { - if (DefaultAvatarAnimations.ContainsKey(name)) - return DefaultAvatarAnimations[name]; - - return UUID.Zero; - } } } \ No newline at end of file diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 9fcd99c1f6..fb1e8316ef 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -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() { { 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 (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; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index ba5f4d5ebb..c40c0ec2b1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -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); - } - /// /// Handler called when we receive a logout packet. /// diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index ca8d8e64fc..0590716cce 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -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() }); diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 0fe1134d57..e50a84a76e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -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(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> kvp in friendsPerDomain) - { - if (kvp.Key != "local") - { - // For the others, call the user agent service - List ids = new List(); - foreach (FriendInfo f in kvp.Value) - ids.Add(f.Friend); - UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); - List 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; } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs new file mode 100644 index 0000000000..61c6a30113 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs @@ -0,0 +1,66 @@ +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> friendsPerDomain, bool online) + { + foreach (KeyValuePair> kvp in friendsPerDomain) + { + if (kvp.Key != "local") + { + // For the others, call the user agent service + List ids = new List(); + 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"); + HGFriendsServicesConnector fConn = new HGFriendsServicesConnector(friendsServerURI); + + List friendsOnline = fConn.StatusNotification(ids, userID, online); + + if (online && friendsOnline.Count > 0) + { + IClientAPI client = m_FriendsModule.LocateClientObject(userID); + if (client != null) + client.SendAgentOnline(friendsOnline.ToArray()); + } + } + } + } + } + } +} diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 8b13b014cc..1e743c3672 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -691,7 +691,13 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); - Scene.SetSceneCoreDebug(disableScripts, disableCollisions, disablePhysics); + Scene.SetSceneCoreDebug( + new Dictionary() { + { "scripting", (!disableScripts).ToString() }, + { "collisions", (!disableCollisions).ToString() }, + { "physics", (!disablePhysics).ToString() } + } + ); } private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 02a163f08f..e86887d793 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -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) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index e4ecc6417d..4a654a38dd 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -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; + /// /// 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; } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 9176d3d70d..33041e9ac7 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -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 m_animations = new List(); @@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// 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; } diff --git a/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs new file mode 100644 index 0000000000..c2b0468067 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs @@ -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 AnimsUUID = new Dictionary(); + public static Dictionary AnimsNames = new Dictionary(); + public static Dictionary AnimStateNames = new Dictionary(); + + static DefaultAvatarAnimations() + { + LoadAnimations(DefaultAnimationsPath); + } + + /// + /// Load the default SL avatar animations. + /// + /// + private static void LoadAnimations(string path) + { +// Dictionary animations = new Dictionary(); + + 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; + } + + /// + /// Get the default avatar animation with the given name. + /// + /// + /// + 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; + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 3584cda015..cded9be47d 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -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; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 44ee453e41..44a738e716 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,7 +65,16 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; - public bool DEBUG = false; + + /// + /// Show debug information about teleports. + /// + public bool DebugTeleporting { get; private set; } + + /// + /// Show debug information about the scene loop. + /// + 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 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); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0847994ba0..2346c607a8 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -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 diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 1e87eed6e3..655f3a5097 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -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) { diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 7bd55901b8..a2375fe548 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -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; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index df4c7f8dcc..bd4c5fce37 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4764,7 +4764,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.RegionHandle == presence.RegionHandle) { - Dictionary animationstateNames = AnimationSet.Animations.AnimStateNames; + Dictionary 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; } diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index ca566f2857..8ef03e7a71 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -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 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 friends = new List(); + int i = 0; + foreach (KeyValuePair kvp in request) + { + if (kvp.Key.Equals("friend_" + i.ToString())) + { + friends.Add(kvp.Value.ToString()); + i++; + } + } + + List onlineFriends = m_TheService.StatusNotification(friends, principalID, online); + + Dictionary result = new Dictionary(); + 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 diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 9a0e27e2f1..db62aaa1d5 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -222,6 +222,7 @@ namespace OpenSim.Server.Handlers.Hypergrid } + [Obsolete] public XmlRpcResponse StatusNotification(XmlRpcRequest request, IPEndPoint remoteClient) { Hashtable hash = new Hashtable(); diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs index e3f326037c..e984a544fd 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs @@ -255,6 +255,58 @@ namespace OpenSim.Services.Connectors.Hypergrid return false; } + + public List StatusNotification(List friends, UUID userID, bool online) + { + Dictionary sendData = new Dictionary(); + List friendsOnline = new List(); + + 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 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 } } \ No newline at end of file diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index c07c6a6aa7..c542c29f1a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -415,6 +415,7 @@ namespace OpenSim.Services.Connectors.Hypergrid GetBoolResponse(request, out reason); } + [Obsolete] public List StatusNotification(List friends, UUID userID, bool online) { Hashtable hash = new Hashtable(); diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index 7815d7d1d8..5731e2fbe8 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs @@ -202,8 +202,15 @@ namespace OpenSim.Services.Connectors Dictionary structData = data.ToKeyValuePairs(); - foreach (KeyValuePair kvp in structData) + foreach (KeyValuePair 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); } diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs index 19ee3e27f9..39524ab93e 100644 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs @@ -214,6 +214,91 @@ namespace OpenSim.Services.HypergridService return false; } + public List StatusNotification(List 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(); + } + + // Let's unblock the caller right now, and take it from here async + + List localFriendsOnline = new List(); + + 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 usersToBeNotified = new List(); + 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(); + } + #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 } } diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 65963d9820..842ca5835d 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -332,6 +332,7 @@ namespace OpenSim.Services.HypergridService return false; } + [Obsolete] public List StatusNotification(List friends, UUID foreignUserID, bool online) { if (m_FriendsService == null || m_PresenceService == null) @@ -412,6 +413,7 @@ namespace OpenSim.Services.HypergridService return new List(); } + [Obsolete] protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) { UUID userID; diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index f48b8a9a76..3dc877a870 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs @@ -65,8 +65,8 @@ namespace OpenSim.Services.Interfaces UUID GetUUID(String first, String last); // Returns the local friends online + [Obsolete] List StatusNotification(List friends, UUID userID, bool online); - //List GetOnlineFriends(UUID userID, List 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 StatusNotification(List friends, UUID userID, bool online); } public interface IInstantMessageSimConnector diff --git a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs index 56195b1418..1e0a35b2dc 100644 --- a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs +++ b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs @@ -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(); - 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(); + //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 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 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 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 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 kvp in account.ServiceURLs) - m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); - } - } } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 2fe22a56b5..81a5cf7cfd 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -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) { } diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index db9f08b729..e0242abbef 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -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" diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 326caeb86d..69e94a584a 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -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