From b74a89bc125a9f3c0c7aac0001a84df4ec28a192 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 27 Mar 2012 22:33:42 +0100 Subject: minor: clean up some code formatting in VivoxVoiceModule.cs --- .../Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | 79 +++++++--------------- 1 file changed, 25 insertions(+), 54 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index 70e2f7e..738133c 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -221,15 +221,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice } } - // Called to indicate that the module has been added to the region public void AddRegion(Scene scene) { - if (m_pluginEnabled) { lock (vlock) { - string channelId; string sceneUUID = scene.RegionInfo.RegionID.ToString(); @@ -273,23 +270,22 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice } } - // Create a dictionary entry unconditionally. This eliminates the // need to check for a parent in the core code. The end result is // the same, if the parent table entry is an empty string, then // region channels will be created as first-level channels. - - lock (m_parents) - if (m_parents.ContainsKey(sceneUUID)) - { - RemoveRegion(scene); - m_parents.Add(sceneUUID, channelId); - } - else - { - m_parents.Add(sceneUUID, channelId); - } - + lock (m_parents) + { + if (m_parents.ContainsKey(sceneUUID)) + { + RemoveRegion(scene); + m_parents.Add(sceneUUID, channelId); + } + else + { + m_parents.Add(sceneUUID, channelId); + } + } } // we need to capture scene in an anonymous method @@ -298,26 +294,20 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice { OnRegisterCaps(scene, agentID, caps); }; - } - } - - // Called to indicate that all loadable modules have now been added + public void RegionLoaded(Scene scene) { // Do nothing. } - // Called to indicate that the region is going away. public void RemoveRegion(Scene scene) { - if (m_pluginEnabled) { lock (vlock) { - string channelId; string sceneUUID = scene.RegionInfo.RegionID.ToString(); @@ -328,10 +318,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice // iteration over the set of chidren identified. // This assumes that there is just one directory per // region. - if (VivoxTryGetDirectory(sceneUUID + "D", out channelId)) { - m_log.DebugFormat("[VivoxVoice]: region {0}: uuid {1}: located directory id {2}", sceneName, sceneUUID, channelId); @@ -360,7 +348,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice lock (m_parents) { - if (m_parents.ContainsKey(sceneUUID)) + if (m_parents.ContainsKey(sceneUUID)) { m_parents.Remove(sceneUUID); } @@ -459,11 +447,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice { try { - ScenePresence avatar = null; string avatarName = null; - if (scene == null) throw new Exception("[VivoxVoice][PROVISIONVOICE] Invalid scene"); + if (scene == null) + throw new Exception("[VivoxVoice][PROVISIONVOICE]: Invalid scene"); avatar = scene.GetScenePresence(agentID); while (avatar == null) @@ -566,7 +554,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice } } } - } while (retry); + } + while (retry); if (code != "OK") { @@ -676,7 +665,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice } } - /// /// Callback for a client request for a private chat channel /// @@ -698,10 +686,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice return "true"; } - private string RegionGetOrCreateChannel(Scene scene, LandData land) { - string channelUri = null; string channelId = null; @@ -709,11 +695,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice string landName; string parentId; - lock (m_parents) parentId = m_parents[scene.RegionInfo.RegionID.ToString()]; + lock (m_parents) + parentId = m_parents[scene.RegionInfo.RegionID.ToString()]; // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same // as the directory ID. Otherwise, it reflects the parcel's ID. - if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) { landName = String.Format("{0}:{1}", scene.RegionInfo.RegionName, land.Name); @@ -741,14 +727,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice m_log.DebugFormat("[VivoxVoice]: Region:Parcel \"{0}\": parent channel id {1}: retrieved parcel channel_uri {2} ", landName, parentId, channelUri); - - } return channelUri; } - private static readonly string m_vivoxLoginPath = "http://{0}/api2/viv_signin.php?userid={1}&pwd={2}"; /// @@ -761,7 +744,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice return VivoxCall(requrl, false); } - private static readonly string m_vivoxLogoutPath = "http://{0}/api2/viv_signout.php?auth_token={1}"; /// @@ -773,7 +755,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice return VivoxCall(requrl, false); } - private static readonly string m_vivoxGetAccountPath = "http://{0}/api2/viv_get_acct.php?auth_token={1}&user_name={2}"; /// @@ -786,7 +767,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice return VivoxCall(requrl, true); } - private static readonly string m_vivoxNewAccountPath = "http://{0}/api2/viv_adm_acct_new.php?username={1}&pwd={2}&auth_token={3}"; /// @@ -801,7 +781,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice return VivoxCall(requrl, true); } - private static readonly string m_vivoxPasswordPath = "http://{0}/api2/viv_adm_password.php?user_name={1}&new_pwd={2}&auth_token={3}"; /// @@ -813,7 +792,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice return VivoxCall(requrl, true); } - private static readonly string m_vivoxChannelPath = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_name={2}&auth_token={3}"; /// @@ -828,7 +806,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice /// /// In this case the call handles parent and description as optional values. /// - private bool VivoxTryCreateChannel(string parent, string channelId, string description, out string channelUri) { string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", channelId, m_authToken); @@ -864,7 +841,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice /// channel name space. /// The parent and description are optional values. /// - private bool VivoxTryCreateDirectory(string dirId, string description, out string channelId) { string requrl = String.Format(m_vivoxChannelPath, m_vivoxServer, "create", dirId, m_authToken); @@ -901,7 +877,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice /// are required in a later phase. /// In this case the call handles parent and description as optional values. /// - private bool VivoxTryGetChannel(string channelParent, string channelName, out string channelId, out string channelUri) { @@ -1044,6 +1019,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice // return VivoxCall(requrl, true); // } + private static readonly string m_vivoxChannelDel = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}"; + /// /// Delete a channel. /// Once again, there a multitude of options possible. In the simplest case @@ -1055,9 +1032,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice /// are required in a later phase. /// In this case the call handles parent and description as optional values. /// - - private static readonly string m_vivoxChannelDel = "http://{0}/api2/viv_chan_mod.php?mode={1}&chan_id={2}&auth_token={3}"; - private XmlElement VivoxDeleteChannel(string parent, string channelid) { string requrl = String.Format(m_vivoxChannelDel, m_vivoxServer, "delete", channelid, m_authToken); @@ -1068,12 +1042,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice return VivoxCall(requrl, true); } + private static readonly string m_vivoxChannelSearch = "http://{0}/api2/viv_chan_search.php?&cond_chanparent={1}&auth_token={2}"; + /// /// Return information on channels in the given directory /// - - private static readonly string m_vivoxChannelSearch = "http://{0}/api2/viv_chan_search.php?&cond_chanparent={1}&auth_token={2}"; - private XmlElement VivoxListChildren(string channelid) { string requrl = String.Format(m_vivoxChannelSearch, m_vivoxServer, channelid, m_authToken); @@ -1118,7 +1091,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice /// The outcome of the call can be determined by examining the /// status value in the hash table. /// - private XmlElement VivoxCall(string requrl, bool admin) { @@ -1164,7 +1136,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice /// /// Just say if it worked. /// - private bool IsOK(XmlElement resp) { string status; @@ -1337,4 +1308,4 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice return false; } } -} +} \ No newline at end of file -- cgit v1.1 From 445e8bc56017fe70a94e80b6f3306b8f17c56747 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 28 Mar 2012 01:08:56 +0100 Subject: minor: Add some documentation to OnNewClient and OnClientClosed events --- OpenSim/Region/Framework/Scenes/EventManager.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 1e1fcb7..7993abe 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -68,9 +68,11 @@ namespace OpenSim.Region.Framework.Scenes public delegate void OnNewClientDelegate(IClientAPI client); /// - /// Deprecated in favour of OnClientConnect. - /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces. + /// Triggered when a new client is added to the scene. /// + /// + /// Triggered before OnClientLogin. + /// public event OnNewClientDelegate OnNewClient; /// @@ -188,6 +190,12 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ClientClosed(UUID clientID, Scene scene); + /// + /// Fired when a client is removed from a scene. + /// + /// + /// At the point of firing, the scene still contains the client's scene presence. + /// public event ClientClosed OnClientClosed; public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); -- cgit v1.1 From 710c14fb57ce2a8cd9a1d5c68ed7c3539a4148cc Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 28 Mar 2012 01:15:56 +0200 Subject: Add SendRemoveInventoryFolders which allows to remove one or more folders from the viewer's inventory view. For HG v2.0. More to come --- OpenSim/Framework/Client/IClientInventory.cs | 37 +++++++++++++++++++ .../Region/ClientStack/Linden/UDP/LLClientView.cs | 41 +++++++++++++++++++++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Framework/Client/IClientInventory.cs (limited to 'OpenSim') diff --git a/OpenSim/Framework/Client/IClientInventory.cs b/OpenSim/Framework/Client/IClientInventory.cs new file mode 100644 index 0000000..00651e0 --- /dev/null +++ b/OpenSim/Framework/Client/IClientInventory.cs @@ -0,0 +1,37 @@ +/* + * 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 OpenMetaverse; + +namespace OpenSim.Framework.Client +{ + public interface IClientInventory + { + void SendRemoveInventoryFolders(UUID[] folders); + } +} diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 68aae14..7ba9eaf 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// Handles new client connections /// Constructor takes a single Packet and authenticates everything /// - public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientIPEndpoint, IStatsCollector + public class LLClientView : IClientAPI, IClientCore, IClientIM, IClientChat, IClientInventory, IClientIPEndpoint, IStatsCollector { /// /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. @@ -448,6 +448,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // DebugPacketLevel = 1; RegisterInterface(this); + RegisterInterface(this); RegisterInterface(this); RegisterInterface(this); @@ -12262,5 +12263,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (reply != null) OutPacket(reply, ThrottleOutPacketType.Task); } + + public void SendRemoveInventoryFolders(UUID[] folders) + { + IEventQueue eq = Scene.RequestModuleInterface(); + + if (eq == null) + { + m_log.DebugFormat("[LLCLIENT]: Null event queue"); + return; + } + + OSDMap llsd = new OSDMap(3); + + OSDMap AgentDataMap = new OSDMap(1); + AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); + AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); + + OSDArray AgentData = new OSDArray(1); + AgentData.Add(AgentDataMap); + + llsd.Add("AgentData", AgentData); + + OSDArray FolderData = new OSDArray(); + + foreach (UUID folder in folders) + { + OSDMap FolderDataMap = new OSDMap(2); + FolderDataMap.Add("FolderID", OSD.FromUUID(folder)); + FolderDataMap.Add("AgentID", OSD.FromUUID(AgentId)); + + FolderData.Add(FolderDataMap); + } + + llsd.Add("FolderData", FolderData); + + eq.Enqueue(BuildEvent("RemoveInventoryFolder", + llsd), AgentId); + } } } -- cgit v1.1 From 8c0f1e905814e93003dd8d78ee54ae947cb3af17 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 28 Mar 2012 02:10:07 +0100 Subject: Add a corresponding method for items. HG v2 --- OpenSim/Framework/Client/IClientInventory.cs | 1 + .../Region/ClientStack/Linden/UDP/LLClientView.cs | 38 ++++++++++++++++++++++ 2 files changed, 39 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Client/IClientInventory.cs b/OpenSim/Framework/Client/IClientInventory.cs index 00651e0..d59f8b7 100644 --- a/OpenSim/Framework/Client/IClientInventory.cs +++ b/OpenSim/Framework/Client/IClientInventory.cs @@ -33,5 +33,6 @@ namespace OpenSim.Framework.Client public interface IClientInventory { void SendRemoveInventoryFolders(UUID[] folders); + void SendRemoveInventoryItems(UUID[] folders); } } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7ba9eaf..0c1d7f2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12264,6 +12264,44 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(reply, ThrottleOutPacketType.Task); } + public void SendRemoveInventoryItems(UUID[] items) + { + IEventQueue eq = Scene.RequestModuleInterface(); + + if (eq == null) + { + m_log.DebugFormat("[LLCLIENT]: Null event queue"); + return; + } + + OSDMap llsd = new OSDMap(3); + + OSDMap AgentDataMap = new OSDMap(1); + AgentDataMap.Add("AgentID", OSD.FromUUID(AgentId)); + AgentDataMap.Add("SessionID", OSD.FromUUID(SessionId)); + + OSDArray AgentData = new OSDArray(1); + AgentData.Add(AgentDataMap); + + llsd.Add("AgentData", AgentData); + + OSDArray ItemData = new OSDArray(); + + foreach (UUID item in items) + { + OSDMap ItemDataMap = new OSDMap(2); + ItemDataMap.Add("ItemID", OSD.FromUUID(item)); + ItemDataMap.Add("AgentID", OSD.FromUUID(AgentId)); + + ItemData.Add(ItemDataMap); + } + + llsd.Add("ItemData", ItemData); + + eq.Enqueue(BuildEvent("RemoveInventoryItem", + llsd), AgentId); + } + public void SendRemoveInventoryFolders(UUID[] folders) { IEventQueue eq = Scene.RequestModuleInterface(); -- cgit v1.1