diff options
author | Melanie Thielker | 2014-06-21 00:39:55 +0200 |
---|---|---|
committer | Melanie Thielker | 2014-06-21 00:39:55 +0200 |
commit | 159fcbf150b7da0e229b29aa7b94793484543d12 (patch) | |
tree | b8c0ff3b4c758a3fba8315b556c923ef4c02a185 /OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |
parent | Merge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76' (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.zip opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.gz opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.bz2 opensim-SC_OLD-159fcbf150b7da0e229b29aa7b94793484543d12.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 111 |
1 files changed, 23 insertions, 88 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index f122d00..03aaaac 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -47,10 +47,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
47 | 47 | ||
48 | /// <summary> | 48 | /// <summary> |
49 | private List<Scene> m_Scenelist = new List<Scene>(); | 49 | private List<Scene> m_Scenelist = new List<Scene>(); |
50 | // private Dictionary<UUID, Scene> m_AgentRegions = | ||
51 | // new Dictionary<UUID, Scene>(); | ||
52 | 50 | ||
53 | private IMessageTransferModule m_TransferModule = null; | 51 | private IMessageTransferModule m_TransferModule; |
54 | private bool m_Enabled = true; | 52 | private bool m_Enabled = true; |
55 | 53 | ||
56 | #region Region Module interface | 54 | #region Region Module interface |
@@ -81,9 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
81 | // scene.RegisterModuleInterface<IInventoryTransferModule>(this); | 79 | // scene.RegisterModuleInterface<IInventoryTransferModule>(this); |
82 | 80 | ||
83 | scene.EventManager.OnNewClient += OnNewClient; | 81 | scene.EventManager.OnNewClient += OnNewClient; |
84 | // scene.EventManager.OnClientClosed += ClientLoggedOut; | ||
85 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | 82 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; |
86 | // scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; | ||
87 | } | 83 | } |
88 | 84 | ||
89 | public void RegionLoaded(Scene scene) | 85 | public void RegionLoaded(Scene scene) |
@@ -96,11 +92,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
96 | m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only"); | 92 | m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only"); |
97 | m_Enabled = false; | 93 | m_Enabled = false; |
98 | 94 | ||
99 | m_Scenelist.Clear(); | 95 | // m_Scenelist.Clear(); |
100 | scene.EventManager.OnNewClient -= OnNewClient; | 96 | // scene.EventManager.OnNewClient -= OnNewClient; |
101 | // scene.EventManager.OnClientClosed -= ClientLoggedOut; | ||
102 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 97 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
103 | // scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; | ||
104 | } | 98 | } |
105 | } | 99 | } |
106 | } | 100 | } |
@@ -108,9 +102,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
108 | public void RemoveRegion(Scene scene) | 102 | public void RemoveRegion(Scene scene) |
109 | { | 103 | { |
110 | scene.EventManager.OnNewClient -= OnNewClient; | 104 | scene.EventManager.OnNewClient -= OnNewClient; |
111 | // scene.EventManager.OnClientClosed -= ClientLoggedOut; | ||
112 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; | 105 | scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; |
113 | // scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; | ||
114 | m_Scenelist.Remove(scene); | 106 | m_Scenelist.Remove(scene); |
115 | } | 107 | } |
116 | 108 | ||
@@ -139,11 +131,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
139 | // Inventory giving is conducted via instant message | 131 | // Inventory giving is conducted via instant message |
140 | client.OnInstantMessage += OnInstantMessage; | 132 | client.OnInstantMessage += OnInstantMessage; |
141 | } | 133 | } |
142 | |||
143 | // protected void OnSetRootAgentScene(UUID id, Scene scene) | ||
144 | // { | ||
145 | // m_AgentRegions[id] = scene; | ||
146 | // } | ||
147 | 134 | ||
148 | private Scene FindClientScene(UUID agentId) | 135 | private Scene FindClientScene(UUID agentId) |
149 | { | 136 | { |
@@ -162,8 +149,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
162 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) | 149 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
163 | { | 150 | { |
164 | // m_log.DebugFormat( | 151 | // m_log.DebugFormat( |
165 | // "[INVENTORY TRANSFER]: {0} IM type received from {1}", | 152 | // "[INVENTORY TRANSFER]: {0} IM type received from client {1}. From={2} ({3}), To={4}", |
166 | // (InstantMessageDialog)im.dialog, client.Name); | 153 | // (InstantMessageDialog)im.dialog, client.Name, |
154 | // im.fromAgentID, im.fromAgentName, im.toAgentID); | ||
167 | 155 | ||
168 | Scene scene = FindClientScene(client.AgentId); | 156 | Scene scene = FindClientScene(client.AgentId); |
169 | 157 | ||
@@ -188,9 +176,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
188 | { | 176 | { |
189 | UUID folderID = new UUID(im.binaryBucket, 1); | 177 | UUID folderID = new UUID(im.binaryBucket, 1); |
190 | 178 | ||
191 | m_log.DebugFormat("[INVENTORY TRANSFER]: Inserting original folder {0} "+ | 179 | m_log.DebugFormat( |
192 | "into agent {1}'s inventory", | 180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", |
193 | folderID, new UUID(im.toAgentID)); | 181 | folderID, new UUID(im.toAgentID)); |
194 | 182 | ||
195 | InventoryFolderBase folderCopy | 183 | InventoryFolderBase folderCopy |
196 | = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); | 184 | = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); |
@@ -213,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
213 | user.ControllingClient.SendBulkUpdateInventory(folderCopy); | 201 | user.ControllingClient.SendBulkUpdateInventory(folderCopy); |
214 | 202 | ||
215 | // HACK!! | 203 | // HACK!! |
216 | // Insert the ID of the copied item into the IM so that we know which item to move to trash if it | 204 | // Insert the ID of the copied folder into the IM so that we know which item to move to trash if it |
217 | // is rejected. | 205 | // is rejected. |
218 | // XXX: This is probably a misuse of the session ID slot. | 206 | // XXX: This is probably a misuse of the session ID slot. |
219 | im.imSessionID = copyID.Guid; | 207 | im.imSessionID = copyID.Guid; |
@@ -425,7 +413,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
425 | { | 413 | { |
426 | folder = new InventoryFolderBase(inventoryID, client.AgentId); | 414 | folder = new InventoryFolderBase(inventoryID, client.AgentId); |
427 | folder = invService.GetFolder(folder); | 415 | folder = invService.GetFolder(folder); |
428 | 416 | ||
429 | if (folder != null & trashFolder != null) | 417 | if (folder != null & trashFolder != null) |
430 | { | 418 | { |
431 | previousParentFolderID = folder.ParentID; | 419 | previousParentFolderID = folder.ParentID; |
@@ -477,76 +465,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
477 | } | 465 | } |
478 | } | 466 | } |
479 | 467 | ||
480 | // public bool NeedSceneCacheClear(UUID agentID, Scene scene) | ||
481 | // { | ||
482 | // if (!m_AgentRegions.ContainsKey(agentID)) | ||
483 | // { | ||
484 | // // Since we can get here two ways, we need to scan | ||
485 | // // the scenes here. This is somewhat more expensive | ||
486 | // // but helps avoid a nasty bug | ||
487 | // // | ||
488 | // | ||
489 | // foreach (Scene s in m_Scenelist) | ||
490 | // { | ||
491 | // ScenePresence presence; | ||
492 | // | ||
493 | // if (s.TryGetScenePresence(agentID, out presence)) | ||
494 | // { | ||
495 | // // If the agent is in this scene, then we | ||
496 | // // are being called twice in a single | ||
497 | // // teleport. This is wasteful of cycles | ||
498 | // // but harmless due to this 2nd level check | ||
499 | // // | ||
500 | // // If the agent is found in another scene | ||
501 | // // then the list wasn't current | ||
502 | // // | ||
503 | // // If the agent is totally unknown, then what | ||
504 | // // are we even doing here?? | ||
505 | // // | ||
506 | // if (s == scene) | ||
507 | // { | ||
508 | // //m_log.Debug("[INVTRANSFERMOD]: s == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
509 | // return true; | ||
510 | // } | ||
511 | // else | ||
512 | // { | ||
513 | // //m_log.Debug("[INVTRANSFERMOD]: s != scene. Returning false in " + scene.RegionInfo.RegionName); | ||
514 | // return false; | ||
515 | // } | ||
516 | // } | ||
517 | // } | ||
518 | // //m_log.Debug("[INVTRANSFERMOD]: agent not in scene. Returning true in " + scene.RegionInfo.RegionName); | ||
519 | // return true; | ||
520 | // } | ||
521 | // | ||
522 | // // The agent is left in current Scene, so we must be | ||
523 | // // going to another instance | ||
524 | // // | ||
525 | // if (m_AgentRegions[agentID] == scene) | ||
526 | // { | ||
527 | // //m_log.Debug("[INVTRANSFERMOD]: m_AgentRegions[agentID] == scene. Returning true in " + scene.RegionInfo.RegionName); | ||
528 | // m_AgentRegions.Remove(agentID); | ||
529 | // return true; | ||
530 | // } | ||
531 | // | ||
532 | // // Another region has claimed the agent | ||
533 | // // | ||
534 | // //m_log.Debug("[INVTRANSFERMOD]: last resort. Returning false in " + scene.RegionInfo.RegionName); | ||
535 | // return false; | ||
536 | // } | ||
537 | // | ||
538 | // public void ClientLoggedOut(UUID agentID, Scene scene) | ||
539 | // { | ||
540 | // if (m_AgentRegions.ContainsKey(agentID)) | ||
541 | // m_AgentRegions.Remove(agentID); | ||
542 | // } | ||
543 | |||
544 | /// <summary> | 468 | /// <summary> |
545 | /// | 469 | /// |
546 | /// </summary> | 470 | /// </summary> |
547 | /// <param name="msg"></param> | 471 | /// <param name="im"></param> |
548 | private void OnGridInstantMessage(GridInstantMessage im) | 472 | private void OnGridInstantMessage(GridInstantMessage im) |
549 | { | 473 | { |
474 | // Check if it's a type of message that we should handle | ||
475 | if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
476 | || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) | ||
477 | || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | ||
478 | || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined))) | ||
479 | return; | ||
480 | |||
481 | m_log.DebugFormat( | ||
482 | "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}", | ||
483 | (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID); | ||
484 | |||
550 | // Check if this is ours to handle | 485 | // Check if this is ours to handle |
551 | // | 486 | // |
552 | Scene scene = FindClientScene(new UUID(im.toAgentID)); | 487 | Scene scene = FindClientScene(new UUID(im.toAgentID)); |