aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2009-03-29 05:42:27 +0000
committerMelanie Thielker2009-03-29 05:42:27 +0000
commitc483206fd7ecd67ac4fc8c4e4b71f65dfd3de6c4 (patch)
tree74474e6dd9b3ed66c23c1de8af0283d3fbc0e896 /OpenSim/Region
parentFinish the offline IM module (still needs a server). Add rudimentary (diff)
downloadopensim-SC_OLD-c483206fd7ecd67ac4fc8c4e4b71f65dfd3de6c4.zip
opensim-SC_OLD-c483206fd7ecd67ac4fc8c4e4b71f65dfd3de6c4.tar.gz
opensim-SC_OLD-c483206fd7ecd67ac4fc8c4e4b71f65dfd3de6c4.tar.bz2
opensim-SC_OLD-c483206fd7ecd67ac4fc8c4e4b71f65dfd3de6c4.tar.xz
Change the client API to use GridInstantMessage for the "last mile" of IM
sending. With this change, all methods that handle IM now use GridInstantMessage rather than individual parameters.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs64
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs24
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs30
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs7
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs7
8 files changed, 57 insertions, 111 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 7d9efa6..ab643ae 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1190,68 +1190,58 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1190 /// <summary> 1190 /// <summary>
1191 /// Send an instant message to this client 1191 /// Send an instant message to this client
1192 /// </summary> 1192 /// </summary>
1193 public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp)
1194 {
1195 SendInstantMessage(fromAgent, message, toAgent, fromName, dialog, timeStamp, UUID.Zero, false, new byte[0]);
1196 }
1197
1198 /// <summary>
1199 /// Send an instant message to this client
1200 /// </summary>
1201 // 1193 //
1202 // Don't remove transaction ID! Groups and item gives need to set it! 1194 // Don't remove transaction ID! Groups and item gives need to set it!
1203 public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, 1195 public void SendInstantMessage(GridInstantMessage im)
1204 string fromName, byte dialog, uint timeStamp,
1205 UUID transactionID, bool fromGroup, byte[] binaryBucket)
1206 { 1196 {
1207 if (((Scene)(m_scene)).Permissions.CanInstantMessage(fromAgent, toAgent)) 1197 if (((Scene)(m_scene)).Permissions.CanInstantMessage(new UUID(im.fromAgentID), new UUID(im.toAgentID)))
1208 { 1198 {
1209 ImprovedInstantMessagePacket msg 1199 ImprovedInstantMessagePacket msg
1210 = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage); 1200 = (ImprovedInstantMessagePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedInstantMessage);
1211 1201
1212 msg.AgentData.AgentID = fromAgent; 1202 msg.AgentData.AgentID = new UUID(im.fromAgentID);
1213 msg.AgentData.SessionID = UUID.Zero; 1203 msg.AgentData.SessionID = UUID.Zero;
1214 msg.MessageBlock.FromAgentName = Utils.StringToBytes(fromName); 1204 msg.MessageBlock.FromAgentName = Utils.StringToBytes(im.fromAgentName);
1215 msg.MessageBlock.Dialog = dialog; 1205 msg.MessageBlock.Dialog = im.dialog;
1216 msg.MessageBlock.FromGroup = fromGroup; 1206 msg.MessageBlock.FromGroup = im.fromGroup;
1217 if (transactionID == UUID.Zero) 1207 if (im.imSessionID == UUID.Zero.Guid)
1218 msg.MessageBlock.ID = fromAgent ^ toAgent; 1208 msg.MessageBlock.ID = new UUID(im.fromAgentID) ^ new UUID(im.toAgentID);
1219 else 1209 else
1220 msg.MessageBlock.ID = transactionID; 1210 msg.MessageBlock.ID = new UUID(im.imSessionID);
1221 msg.MessageBlock.Offline = 0; 1211 msg.MessageBlock.Offline = im.offline;
1222 msg.MessageBlock.ParentEstateID = 0; 1212 msg.MessageBlock.ParentEstateID = im.ParentEstateID;
1223 msg.MessageBlock.Position = new Vector3(); 1213 msg.MessageBlock.Position = im.Position;
1224 msg.MessageBlock.RegionID = UUID.Zero; 1214 msg.MessageBlock.RegionID = new UUID(im.RegionID);
1225 msg.MessageBlock.Timestamp = timeStamp; 1215 msg.MessageBlock.Timestamp = im.timestamp;
1226 msg.MessageBlock.ToAgentID = toAgent; 1216 msg.MessageBlock.ToAgentID = new UUID(im.toAgentID);
1227 // Cap the message length at 1099. There is a limit in ImprovedInstantMessagePacket 1217 // Cap the message length at 1099. There is a limit in ImprovedInstantMessagePacket
1228 // the limit is 1100 but a 0 byte gets added to mark the end of the string 1218 // the limit is 1100 but a 0 byte gets added to mark the end of the string
1229 if (message != null && message.Length > 1099) 1219 if (im.message != null && im.message.Length > 1099)
1230 msg.MessageBlock.Message = Utils.StringToBytes(message.Substring(0, 1099)); 1220 msg.MessageBlock.Message = Utils.StringToBytes(im.message.Substring(0, 1099));
1231 else 1221 else
1232 msg.MessageBlock.Message = Utils.StringToBytes(message); 1222 msg.MessageBlock.Message = Utils.StringToBytes(im.message);
1233 msg.MessageBlock.BinaryBucket = binaryBucket; 1223 msg.MessageBlock.BinaryBucket = im.binaryBucket;
1234 1224
1235 if (message.StartsWith("[grouptest]")) 1225 if (im.message.StartsWith("[grouptest]"))
1236 { // this block is test code for implementing group IM - delete when group IM is finished 1226 { // this block is test code for implementing group IM - delete when group IM is finished
1237 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); 1227 IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
1238 if (eq != null) 1228 if (eq != null)
1239 { 1229 {
1240 dialog = 17; 1230 im.dialog = 17;
1241 1231
1242 //eq.ChatterboxInvitation( 1232 //eq.ChatterboxInvitation(
1243 // new UUID("00000000-68f9-1111-024e-222222111123"), 1233 // new UUID("00000000-68f9-1111-024e-222222111123"),
1244 // "OpenSimulator Testing", fromAgent, message, toAgent, fromName, dialog, 0, 1234 // "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0,
1245 // false, 0, new Vector3(), 1, transactionID, fromGroup, binaryBucket); 1235 // false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket);
1246 1236
1247 eq.ChatterboxInvitation( 1237 eq.ChatterboxInvitation(
1248 new UUID("00000000-68f9-1111-024e-222222111123"), 1238 new UUID("00000000-68f9-1111-024e-222222111123"),
1249 "OpenSimulator Testing", fromAgent, message, toAgent, fromName, dialog, 0, 1239 "OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0,
1250 false, 0, new Vector3(), 1, transactionID, fromGroup, Utils.StringToBytes("OpenSimulator Testing")); 1240 false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Utils.StringToBytes("OpenSimulator Testing"));
1251 1241
1252 eq.ChatterBoxSessionAgentListUpdates( 1242 eq.ChatterBoxSessionAgentListUpdates(
1253 new UUID("00000000-68f9-1111-024e-222222111123"), 1243 new UUID("00000000-68f9-1111-024e-222222111123"),
1254 fromAgent, toAgent, false, false, false); 1244 new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false);
1255 } 1245 }
1256 1246
1257 Console.WriteLine("SendInstantMessage: " + msg); 1247 Console.WriteLine("SendInstantMessage: " + msg);
@@ -7645,7 +7635,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7645 public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message) 7635 public void SendBlueBoxMessage(UUID FromAvatarID, String FromAvatarName, String Message)
7646 { 7636 {
7647 if (!ChildAgentStatus()) 7637 if (!ChildAgentStatus())
7648 SendInstantMessage(FromAvatarID, Message, AgentId, FromAvatarName, 1, (uint)Util.UnixTimeSinceEpoch()); 7638 SendInstantMessage(new GridInstantMessage(null, FromAvatarID, FromAvatarName, AgentId, 1, Message, false, new Vector3()));
7649 7639
7650 //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch()); 7640 //SendInstantMessage(FromAvatarID, fromSessionID, Message, AgentId, SessionId, FromAvatarName, (byte)21,(uint) Util.UnixTimeSinceEpoch());
7651 } 7641 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index d91e10d..edb2c56 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -679,9 +679,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
679 CreateCallingCard(client, friendID, callingCardFolders[0], friendPresence.Name); 679 CreateCallingCard(client, friendID, callingCardFolders[0], friendPresence.Name);
680 680
681 // local message means OnGridInstantMessage won't be triggered, so do the work here. 681 // local message means OnGridInstantMessage won't be triggered, so do the work here.
682 friendPresence.ControllingClient.SendInstantMessage(agentID, agentID.ToString(), friendID, client.Name, 682 friendPresence.ControllingClient.SendInstantMessage(
683 (byte)InstantMessageDialog.FriendshipAccepted, 683 new GridInstantMessage(client.Scene, agentID,
684 (uint)Util.UnixTimeSinceEpoch()); 684 client.Name, friendID,
685 (byte)InstantMessageDialog.FriendshipAccepted,
686 agentID.ToString(), false, Vector3.Zero));
685 ApproveFriendship(agentID, friendID, client.Name); 687 ApproveFriendship(agentID, friendID, client.Name);
686 } 688 }
687 else 689 else
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
index 01717ce..038f5c1 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -137,12 +137,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
137 137
138 if ((client != null) && !success) 138 if ((client != null) && !success)
139 { 139 {
140 client.SendInstantMessage(new UUID(im.toAgentID), 140 client.SendInstantMessage(
141 "Unable to send instant message. "+ 141 new GridInstantMessage(
142 "User is not logged in.", 142 null, new UUID(im.fromAgentID), "System",
143 new UUID(im.fromAgentID), "System", 143 new UUID(im.toAgentID),
144 (byte)InstantMessageDialog.BusyAutoResponse, 144 (byte)InstantMessageDialog.BusyAutoResponse,
145 (uint)Util.UnixTimeSinceEpoch()); 145 "Unable to send instant message. "+
146 "User is not logged in.", false,
147 new Vector3()));
146 } 148 }
147 } 149 }
148 ); 150 );
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index d8d6219..23aaabe 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -113,16 +113,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
113 if (!user.IsChildAgent) 113 if (!user.IsChildAgent)
114 { 114 {
115 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); 115 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
116 user.ControllingClient.SendInstantMessage( 116 user.ControllingClient.SendInstantMessage(im);
117 new UUID(im.fromAgentID), 117
118 im.message,
119 new UUID(im.toAgentID),
120 im.fromAgentName,
121 im.dialog,
122 im.timestamp,
123 new UUID(im.imSessionID),
124 im.fromGroup,
125 im.binaryBucket);
126 // Message sent 118 // Message sent
127 result(true); 119 result(true);
128 return; 120 return;
@@ -143,16 +135,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
143 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 135 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
144 136
145 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); 137 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client");
146 user.ControllingClient.SendInstantMessage( 138 user.ControllingClient.SendInstantMessage(im);
147 new UUID(im.fromAgentID), 139
148 im.message,
149 new UUID(im.toAgentID),
150 im.fromAgentName,
151 im.dialog,
152 im.timestamp,
153 new UUID(im.imSessionID),
154 im.fromGroup,
155 im.binaryBucket);
156 // Message sent 140 // Message sent
157 result(true); 141 result(true);
158 return; 142 return;
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 814b2de..9eb8e27 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -167,11 +167,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
167 { 167 {
168 DateTime saved = Util.ToDateTime((uint)im.timestamp); 168 DateTime saved = Util.ToDateTime((uint)im.timestamp);
169 169
170 client.SendInstantMessage(new UUID(im.toAgentID), 170 im.message = "(saved " + saved.ToString() + ") " + im.message;
171 "(saved " + saved.ToString() + ") " + im.message, 171 client.SendInstantMessage(im);
172 new UUID(im.fromAgentID), im.fromAgentName,
173 (byte)im.dialog,
174 (uint)im.timestamp);
175 } 172 }
176 } 173 }
177 174
@@ -188,12 +185,13 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
188 if (client == null) 185 if (client == null)
189 return; 186 return;
190 187
191 client.SendInstantMessage(new UUID(im.fromAgentID), 188 client.SendInstantMessage(new GridInstantMessage(
189 null, new UUID(im.toAgentID),
190 "System", new UUID(im.fromAgentID),
191 (byte)InstantMessageDialog.MessageFromAgent,
192 "User is not logged in. "+ 192 "User is not logged in. "+
193 (success ? "Message saved." : "Message not saved"), 193 (success ? "Message saved." : "Message not saved"),
194 new UUID(im.toAgentID), "System", 194 false, new Vector3()));
195 (byte)InstantMessageDialog.MessageFromAgent,
196 (uint)Util.UnixTimeSinceEpoch());
197 } 195 }
198 } 196 }
199 } 197 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 2939282..b8e4f08 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -212,11 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
212 // And notify. Transaction ID is the item ID. We get that 212 // And notify. Transaction ID is the item ID. We get that
213 // same ID back on the reply so we know what to act on 213 // same ID back on the reply so we know what to act on
214 // 214 //
215 user.ControllingClient.SendInstantMessage( 215 user.ControllingClient.SendInstantMessage(im);
216 new UUID(im.fromAgentID), im.message,
217 new UUID(im.toAgentID),
218 im.fromAgentName, im.dialog, im.timestamp,
219 copyID, false, im.binaryBucket);
220 216
221 return; 217 return;
222 } 218 }
@@ -232,11 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
232 228
233 if (user != null) // Local 229 if (user != null) // Local
234 { 230 {
235 user.ControllingClient.SendInstantMessage( 231 user.ControllingClient.SendInstantMessage(im);
236 new UUID(im.fromAgentID), im.message,
237 new UUID(im.toAgentID),
238 im.fromAgentName, im.dialog, im.timestamp,
239 UUID.Zero, false, im.binaryBucket);
240 } 232 }
241 else 233 else
242 { 234 {
@@ -303,11 +295,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
303 295
304 if (user != null) // Local 296 if (user != null) // Local
305 { 297 {
306 user.ControllingClient.SendInstantMessage( 298 user.ControllingClient.SendInstantMessage(im);
307 new UUID(im.fromAgentID), im.message,
308 new UUID(im.toAgentID),
309 im.fromAgentName, im.dialog, im.timestamp,
310 UUID.Zero, false, im.binaryBucket);
311 } 299 }
312 else 300 else
313 { 301 {
@@ -460,11 +448,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
460 448
461 // Deliver message 449 // Deliver message
462 // 450 //
463 user.ControllingClient.SendInstantMessage( 451 user.ControllingClient.SendInstantMessage(msg);
464 new UUID(msg.fromAgentID), msg.message,
465 new UUID(msg.toAgentID),
466 msg.fromAgentName, msg.dialog, msg.timestamp,
467 folderID, false, msg.binaryBucket);
468 } 452 }
469 else 453 else
470 { 454 {
@@ -497,11 +481,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
497 481
498 // Deliver message 482 // Deliver message
499 // 483 //
500 user.ControllingClient.SendInstantMessage( 484 user.ControllingClient.SendInstantMessage(msg);
501 new UUID(msg.fromAgentID), msg.message,
502 new UUID(msg.toAgentID),
503 msg.fromAgentName, msg.dialog, msg.timestamp,
504 itemID, false, msg.binaryBucket);
505 } 485 }
506 } 486 }
507 } 487 }
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 82d84fa..82d0198 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -416,12 +416,7 @@ namespace OpenSim.Region.Examples.SimpleModule
416 { 416 {
417 } 417 }
418 418
419 public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp) 419 public void SendInstantMessage(GridInstantMessage im)
420 {
421
422 }
423
424 public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transactionID, bool fromGroup, byte[] binaryBucket)
425 { 420 {
426 421
427 } 422 }
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 415a24a..a2ca008 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -505,12 +505,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
505 { 505 {
506 } 506 }
507 507
508 public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp) 508 public void SendInstantMessage(GridInstantMessage im)
509 {
510
511 }
512
513 public void SendInstantMessage(UUID fromAgent, string message, UUID toAgent, string fromName, byte dialog, uint timeStamp, UUID transationID, bool fromGroup, byte[] binaryBucket)
514 { 509 {
515 510
516 } 511 }