aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP
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/ClientStack/LindenUDP
parentFinish the offline IM module (still needs a server). Add rudimentary (diff)
downloadopensim-SC-c483206fd7ecd67ac4fc8c4e4b71f65dfd3de6c4.zip
opensim-SC-c483206fd7ecd67ac4fc8c4e4b71f65dfd3de6c4.tar.gz
opensim-SC-c483206fd7ecd67ac4fc8c4e4b71f65dfd3de6c4.tar.bz2
opensim-SC-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/ClientStack/LindenUDP')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs64
1 files changed, 27 insertions, 37 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 }