aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Inventory
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-17 18:41:13 +0000
committerMelanie Thielker2008-08-17 18:41:13 +0000
commit40abeed7d425065e273e3a33264425f8ded35f3e (patch)
tree770891efd62ffa794bcdb2de937f0fd7b3c54f07 /OpenSim/Region/Environment/Modules/Avatar/Inventory
parentPatch for Adam: Add two new permissions options to Opensim.ini.example (diff)
downloadopensim-SC_OLD-40abeed7d425065e273e3a33264425f8ded35f3e.zip
opensim-SC_OLD-40abeed7d425065e273e3a33264425f8ded35f3e.tar.gz
opensim-SC_OLD-40abeed7d425065e273e3a33264425f8ded35f3e.tar.bz2
opensim-SC_OLD-40abeed7d425065e273e3a33264425f8ded35f3e.tar.xz
Add the IInventoryModule interface and a sample method call
to Scene.INventory.cs
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Inventory')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs36
1 files changed, 23 insertions, 13 deletions
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}