diff options
author | Melanie Thielker | 2008-11-16 22:04:01 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-16 22:04:01 +0000 |
commit | 5e2e05a1c1cf083c52728798c809711f4e2f52ae (patch) | |
tree | a51ab47c0d6e83a31fc02e0b840911bf936fe802 /OpenSim/Region/Environment/Modules/Avatar/Inventory | |
parent | - Fix a formatting error in a log message (Mantis#2635). (diff) | |
download | opensim-SC-5e2e05a1c1cf083c52728798c809711f4e2f52ae.zip opensim-SC-5e2e05a1c1cf083c52728798c809711f4e2f52ae.tar.gz opensim-SC-5e2e05a1c1cf083c52728798c809711f4e2f52ae.tar.bz2 opensim-SC-5e2e05a1c1cf083c52728798c809711f4e2f52ae.tar.xz |
Megapatch. Completely remove the multiparameter IM methods. Remove the insecure
fromAgentSession field.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Inventory')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 71cc726..f4707de 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -117,38 +117,34 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer | |||
117 | return null; | 117 | return null; |
118 | } | 118 | } |
119 | 119 | ||
120 | private void OnInstantMessage(IClientAPI client, UUID fromAgentID, | 120 | private void OnInstantMessage(IClientAPI client, GridInstantMessage im) |
121 | UUID fromAgentSession, UUID toAgentID, | ||
122 | UUID imSessionID, uint timestamp, string fromAgentName, | ||
123 | string message, byte dialog, bool fromGroup, byte offline, | ||
124 | uint ParentEstateID, Vector3 Position, UUID RegionID, | ||
125 | byte[] binaryBucket) | ||
126 | { | 121 | { |
127 | Scene scene = FindClientScene(client.AgentId); | 122 | Scene scene = FindClientScene(client.AgentId); |
128 | 123 | ||
129 | if (scene == null) // Something seriously wrong here. | 124 | if (scene == null) // Something seriously wrong here. |
130 | return; | 125 | return; |
131 | 126 | ||
132 | if (dialog == (byte) InstantMessageDialog.InventoryOffered) | 127 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) |
133 | { | 128 | { |
134 | ScenePresence user = | 129 | ScenePresence user = |
135 | scene.GetScenePresence(toAgentID); | 130 | scene.GetScenePresence(new UUID(im.toAgentID)); |
136 | 131 | ||
137 | // First byte of the array is probably the item type | 132 | // First byte of the array is probably the item type |
138 | // Next 16 bytes are the UUID | 133 | // Next 16 bytes are the UUID |
139 | 134 | ||
140 | UUID itemID = new UUID(binaryBucket, 1); | 135 | UUID itemID = new UUID(im.binaryBucket, 1); |
141 | 136 | ||
142 | m_log.DebugFormat("[AGENT INVENTORY]: Inserting item {0} "+ | 137 | m_log.DebugFormat("[AGENT INVENTORY]: Inserting item {0} "+ |
143 | "into agent {1}'s inventory", | 138 | "into agent {1}'s inventory", |
144 | itemID, toAgentID); | 139 | itemID, new UUID(im.toAgentID)); |
145 | 140 | ||
146 | InventoryItemBase itemCopy = scene.GiveInventoryItem(toAgentID, | 141 | InventoryItemBase itemCopy = scene.GiveInventoryItem( |
142 | new UUID(im.toAgentID), | ||
147 | client.AgentId, itemID); | 143 | client.AgentId, itemID); |
148 | 144 | ||
149 | byte[] itemCopyID = itemCopy.ID.GetBytes(); | 145 | byte[] itemCopyID = itemCopy.ID.GetBytes(); |
150 | 146 | ||
151 | Array.Copy(itemCopyID, 0, binaryBucket, 1, 16); | 147 | Array.Copy(itemCopyID, 0, im.binaryBucket, 1, 16); |
152 | 148 | ||
153 | // Send the IM to the recipient. The item is already | 149 | // Send the IM to the recipient. The item is already |
154 | // in their inventory, so it will not be lost if | 150 | // in their inventory, so it will not be lost if |
@@ -164,9 +160,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer | |||
164 | // same ID back on the reply so we know what to act on | 160 | // same ID back on the reply so we know what to act on |
165 | // | 161 | // |
166 | user.ControllingClient.SendInstantMessage( | 162 | user.ControllingClient.SendInstantMessage( |
167 | fromAgentID, message, toAgentID, fromAgentName, | 163 | new UUID(im.fromAgentID), im.message, |
168 | dialog, timestamp, itemCopy.ID, false, | 164 | new UUID(im.toAgentID), |
169 | binaryBucket); | 165 | im.fromAgentName, im.dialog, im.timestamp, |
166 | itemCopy.ID, false, im.binaryBucket); | ||
170 | 167 | ||
171 | return; | 168 | return; |
172 | } | 169 | } |
@@ -177,15 +174,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer | |||
177 | // TODO: Implement grid sending | 174 | // TODO: Implement grid sending |
178 | } | 175 | } |
179 | } | 176 | } |
180 | else if (dialog == (byte) InstantMessageDialog.InventoryAccepted) | 177 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) |
181 | { | 178 | { |
182 | ScenePresence user = scene.GetScenePresence(toAgentID); | 179 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
183 | 180 | ||
184 | if (user != null) // Local | 181 | if (user != null) // Local |
185 | { | 182 | { |
186 | user.ControllingClient.SendInstantMessage( | 183 | user.ControllingClient.SendInstantMessage( |
187 | fromAgentID, message, toAgentID, fromAgentName, | 184 | new UUID(im.fromAgentID), im.message, |
188 | dialog, timestamp, UUID.Zero, false, binaryBucket); | 185 | new UUID(im.toAgentID), |
186 | im.fromAgentName, im.dialog, im.timestamp, | ||
187 | UUID.Zero, false, im.binaryBucket); | ||
189 | } | 188 | } |
190 | else | 189 | else |
191 | { | 190 | { |
@@ -194,9 +193,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer | |||
194 | // TODO: Implement sending via grid | 193 | // TODO: Implement sending via grid |
195 | } | 194 | } |
196 | } | 195 | } |
197 | else if (dialog == (byte) InstantMessageDialog.InventoryDeclined) | 196 | else if (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) |
198 | { | 197 | { |
199 | UUID itemID = imSessionID; // The item, back from it's trip | 198 | UUID itemID = new UUID(im.imSessionID); // The item, back from it's trip |
200 | 199 | ||
201 | // Here, the recipient is local and we can assume that the | 200 | // Here, the recipient is local and we can assume that the |
202 | // inventory is loaded. Courtesy of the above bulk update, | 201 | // inventory is loaded. Courtesy of the above bulk update, |
@@ -235,13 +234,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Transfer | |||
235 | } | 234 | } |
236 | } | 235 | } |
237 | 236 | ||
238 | ScenePresence user = scene.GetScenePresence(toAgentID); | 237 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
239 | 238 | ||
240 | if (user != null) // Local | 239 | if (user != null) // Local |
241 | { | 240 | { |
242 | user.ControllingClient.SendInstantMessage( | 241 | user.ControllingClient.SendInstantMessage( |
243 | fromAgentID, message, toAgentID, fromAgentName, | 242 | new UUID(im.fromAgentID), im.message, |
244 | dialog, timestamp, UUID.Zero, false, binaryBucket); | 243 | new UUID(im.toAgentID), |
244 | im.fromAgentName, im.dialog, im.timestamp, | ||
245 | UUID.Zero, false, im.binaryBucket); | ||
245 | } | 246 | } |
246 | else | 247 | else |
247 | { | 248 | { |