aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/IInventoryModule.cs40
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs36
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs9
3 files changed, 72 insertions, 13 deletions
diff --git a/OpenSim/Framework/IInventoryModule.cs b/OpenSim/Framework/IInventoryModule.cs
new file mode 100644
index 0000000..19171cd
--- /dev/null
+++ b/OpenSim/Framework/IInventoryModule.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using libsecondlife;
30
31namespace OpenSim.Framework
32{
33 /// <summary>
34 /// An interface for accessing and managing agent inventory
35 /// </summary>
36 public interface IInventoryModule
37 {
38// void TestFunction();
39 }
40}
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs
index e1cc688..cc088a0 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs
@@ -36,7 +36,7 @@ using OpenSim.Region.Environment.Scenes;
36 36
37namespace OpenSim.Region.Environment.Modules.Avatar.Inventory 37namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
38{ 38{
39 public class InventoryModule : IRegionModule 39 public class InventoryModule : IInventoryModule, IRegionModule
40 { 40 {
41 private static readonly ILog m_log 41 private static readonly ILog m_log
42 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 42 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -48,14 +48,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
48 /// </summary> 48 /// </summary>
49 private IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>(); 49 private IDictionary<LLUUID, LLUUID> m_pendingOffers = new Dictionary<LLUUID, LLUUID>();
50 50
51 private Scene m_scene; 51 private List<Scene> m_Scenelist = new List<Scene>();
52 52
53 #region IRegionModule Members 53 #region IRegionModule Members
54 54
55 public void Initialise(Scene scene, IConfigSource config) 55 public void Initialise(Scene scene, IConfigSource config)
56 { 56 {
57 m_scene = scene; 57 if(!m_Scenelist.Contains(scene))
58 scene.EventManager.OnNewClient += OnNewClient; 58 {
59 m_Scenelist.Add(scene);
60
61 scene.RegisterModuleInterface<IInventoryModule>(this);
62
63 scene.EventManager.OnNewClient += OnNewClient;
64 }
59 } 65 }
60 66
61 public void PostInitialise() 67 public void PostInitialise()
@@ -73,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
73 79
74 public bool IsSharedModule 80 public bool IsSharedModule
75 { 81 {
76 get { return false; } 82 get { return true; }
77 } 83 }
78 84
79 #endregion 85 #endregion
@@ -97,9 +103,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
97 "[AGENT INVENTORY]: Routing inventory offering message from {0}, {1} to {2}", 103 "[AGENT INVENTORY]: Routing inventory offering message from {0}, {1} to {2}",
98 client.AgentId, client.Name, toAgentID); 104 client.AgentId, client.Name, toAgentID);
99 105
100 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) 106 if (((Scene)(client.Scene)).Entities.ContainsKey(toAgentID) && ((Scene)(client.Scene)).Entities[toAgentID] is ScenePresence)
101 { 107 {
102 ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; 108 ScenePresence user = (ScenePresence) ((Scene)(client.Scene)).Entities[toAgentID];
103 109
104 if (!user.IsChildAgent) 110 if (!user.IsChildAgent)
105 { 111 {
@@ -143,9 +149,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
143 "[AGENT INVENTORY]: Routing inventory accepted message from {0}, {1} to {2}", 149 "[AGENT INVENTORY]: Routing inventory accepted message from {0}, {1} to {2}",
144 client.AgentId, client.Name, toAgentID); 150 client.AgentId, client.Name, toAgentID);
145 151
146 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) 152 if (((Scene)(client.Scene)).Entities.ContainsKey(toAgentID) && ((Scene)(client.Scene)).Entities[toAgentID] is ScenePresence)
147 { 153 {
148 ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; 154 ScenePresence user = (ScenePresence) ((Scene)(client.Scene)).Entities[toAgentID];
149 155
150 if (!user.IsChildAgent) 156 if (!user.IsChildAgent)
151 { 157 {
@@ -160,7 +166,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
160 166
161 // Since the message originates from the accepting client, the toAgentID is 167 // Since the message originates from the accepting client, the toAgentID is
162 // the agent giving the item. 168 // the agent giving the item.
163 m_scene.GiveInventoryItem(client, toAgentID, m_pendingOffers[imSessionID]); 169 ((Scene)(client.Scene)).GiveInventoryItem(client, toAgentID, m_pendingOffers[imSessionID]);
164 170
165 m_pendingOffers.Remove(imSessionID); 171 m_pendingOffers.Remove(imSessionID);
166 } 172 }
@@ -189,9 +195,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
189 } 195 }
190 else if (dialog == (byte) InstantMessageDialog.InventoryDeclined) 196 else if (dialog == (byte) InstantMessageDialog.InventoryDeclined)
191 { 197 {
192 if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) 198 if (((Scene)(client.Scene)).Entities.ContainsKey(toAgentID) && ((Scene)(client.Scene)).Entities[toAgentID] is ScenePresence)
193 { 199 {
194 ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; 200 ScenePresence user = (ScenePresence) ((Scene)(client.Scene)).Entities[toAgentID];
195 201
196 if (!user.IsChildAgent) 202 if (!user.IsChildAgent)
197 { 203 {
@@ -216,5 +222,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory
216 } 222 }
217 } 223 }
218 } 224 }
225
226// public void TestFunction()
227// {
228// }
219 } 229 }
220} \ No newline at end of file 230}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 3f62610..fe66dd5 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -2308,5 +2308,14 @@ namespace OpenSim.Region.Environment.Scenes
2308 else 2308 else
2309 EventManager.TriggerStopScript(part.LocalId, itemID); 2309 EventManager.TriggerStopScript(part.LocalId, itemID);
2310 } 2310 }
2311
2312// public void TestFunction()
2313// {
2314// IInventoryModule imod = RequestModuleInterface<IInventoryModule>();
2315// if (imod == null)
2316// return;
2317//
2318// imod.TestFunction();
2319// }
2311 } 2320 }
2312} 2321}