take lludp out of usermanagement module
							parent
							
								
									20b974cff0
								
							
						
					
					
						commit
						ad601c9502
					
				|  | @ -2998,24 +2998,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
|             OutPacket(economyData, ThrottleOutPacketType.Task); | ||||
|         } | ||||
| 
 | ||||
|         public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data) | ||||
|         static private readonly byte[] AvatarPickerReplyHeader = new byte[] { | ||||
|                 Helpers.MSG_RELIABLE, | ||||
|                 0, 0, 0, 0, // sequence number | ||||
|                 0, // extra | ||||
|                 0xff, 0xff, 0, 28 // ID 28 (low frequency bigendian) | ||||
|                 }; | ||||
| 
 | ||||
|         public void SendAvatarPickerReply(UUID QueryID, List<UserData> users) | ||||
|         { | ||||
|             //construct the AvatarPickerReply packet. | ||||
|             AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket(); | ||||
|             replyPacket.AgentData.AgentID = AgentData.AgentID; | ||||
|             replyPacket.AgentData.QueryID = AgentData.QueryID; | ||||
|             //int i = 0; | ||||
|             List<AvatarPickerReplyPacket.DataBlock> data_block = new List<AvatarPickerReplyPacket.DataBlock>(); | ||||
|             foreach (AvatarPickerReplyDataArgs arg in Data) | ||||
|             UDPPacketBuffer buf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | ||||
|             byte[] data = buf.Data; | ||||
| 
 | ||||
|             //setup header | ||||
|             Buffer.BlockCopy(AvatarPickerReplyHeader, 0, data, 0, 10); | ||||
|             AgentId.ToBytes(data, 10); //26 | ||||
|             QueryID.ToBytes(data, 26); //42 | ||||
| 
 | ||||
|             if (users.Count == 0) | ||||
|             { | ||||
|                 AvatarPickerReplyPacket.DataBlock db = new AvatarPickerReplyPacket.DataBlock(); | ||||
|                 db.AvatarID = arg.AvatarID; | ||||
|                 db.FirstName = arg.FirstName; | ||||
|                 db.LastName = arg.LastName; | ||||
|                 data_block.Add(db); | ||||
|                 data[42] = 0; | ||||
|                 buf.DataLength = 43; | ||||
|                 m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); | ||||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             int pos = 43; | ||||
|             int count = 0; | ||||
|             for(int u = 0; u < users.Count; ++u) | ||||
|             { | ||||
|                 UserData user = users[u]; | ||||
|                 user.Id.ToBytes(data,pos); | ||||
|                 pos+= 16; | ||||
|                 byte[] tmp = Utils.StringToBytes(user.FirstName); | ||||
|                 data[pos++] = (byte)tmp.Length; | ||||
|                 if(tmp.Length > 0) | ||||
|                 { | ||||
|                     Buffer.BlockCopy(tmp, 0, data, pos, tmp.Length); | ||||
|                     pos += tmp.Length; | ||||
|                 } | ||||
|                 tmp = Utils.StringToBytes(user.LastName); | ||||
|                 data[pos++] = (byte)tmp.Length; | ||||
|                 if (tmp.Length > 0) | ||||
|                 { | ||||
|                     Buffer.BlockCopy(tmp, 0, data, pos, tmp.Length); | ||||
|                     pos += tmp.Length; | ||||
|                 } | ||||
|                 ++count; | ||||
| 
 | ||||
|                 if (pos >= LLUDPServer.MAXPAYLOAD - 120) | ||||
|                 { | ||||
|                     data[42] = (byte)count; | ||||
|                     buf.DataLength = pos; | ||||
|                     m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); | ||||
|                     if (u < users.Count - 1) | ||||
|                     { | ||||
|                         UDPPacketBuffer newbuf = m_udpServer.GetNewUDPBuffer(m_udpClient.RemoteEndPoint); | ||||
|                         byte[] newdata = newbuf.Data; | ||||
|                         Buffer.BlockCopy(data, 0, newdata, pos, 42); | ||||
|                         pos = 43; | ||||
|                     } | ||||
|                     count = 0; | ||||
|                 } | ||||
|             } | ||||
|             if(count > 0) | ||||
|             { | ||||
|                 data[42] = (byte)count; | ||||
|                 buf.DataLength = pos; | ||||
|                 m_udpServer.SendUDPPacket(m_udpClient, buf, ThrottleOutPacketType.Task); | ||||
|             } | ||||
|             replyPacket.Data = data_block.ToArray(); | ||||
|             OutPacket(replyPacket, ThrottleOutPacketType.Task); | ||||
|         } | ||||
| 
 | ||||
|         public void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) | ||||
|  |  | |||
|  | @ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
|                             if (p != null && !p.IsDeleted) | ||||
|                                 flags |= 0x10; | ||||
| 
 | ||||
|                             if(!clients.Contains(client) && client.IsActive) | ||||
|                             if(clients == null) | ||||
|                             { | ||||
|                                 client.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType, props.FirstLifeText, flags, | ||||
|                                                               props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); | ||||
|  | @ -195,17 +195,30 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles | |||
|                                 if (agentGroups != null) | ||||
|                                     client.SendAvatarGroupsReply(avatarID, agentGroups); | ||||
|                             } | ||||
|                             foreach (IClientAPI cli in clients) | ||||
|                             else | ||||
|                             { | ||||
|                                 if (!cli.IsActive) | ||||
|                                     continue; | ||||
|                                 cli.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType, props.FirstLifeText, flags, | ||||
|                                                             props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); | ||||
|                                 if (!clients.Contains(client) && client.IsActive) | ||||
|                                 { | ||||
|                                     client.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType, props.FirstLifeText, flags, | ||||
|                                                                   props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); | ||||
| 
 | ||||
|                                 cli.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, | ||||
|                                                             (uint)props.SkillsMask, props.SkillsText, props.Language); | ||||
|                                 if (agentGroups != null) | ||||
|                                     cli.SendAvatarGroupsReply(avatarID, agentGroups); | ||||
|                                     client.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, | ||||
|                                                                  (uint)props.SkillsMask, props.SkillsText, props.Language); | ||||
|                                     if (agentGroups != null) | ||||
|                                         client.SendAvatarGroupsReply(avatarID, agentGroups); | ||||
|                                 } | ||||
|                                 foreach (IClientAPI cli in clients) | ||||
|                                 { | ||||
|                                     if (!cli.IsActive) | ||||
|                                         continue; | ||||
|                                     cli.SendAvatarProperties(props.UserId, props.AboutText, born, membershipType, props.FirstLifeText, flags, | ||||
|                                                                 props.FirstLifeImageId, props.ImageId, props.WebUrl, props.PartnerId); | ||||
| 
 | ||||
|                                     cli.SendAvatarInterestsReply(props.UserId, (uint)props.WantToMask, props.WantToText, | ||||
|                                                                 (uint)props.SkillsMask, props.SkillsText, props.Language); | ||||
|                                     if (agentGroups != null) | ||||
|                                         cli.SendAvatarGroupsReply(avatarID, agentGroups); | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
|  |  | |||
|  | @ -26,6 +26,7 @@ | |||
|  */ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Collections.Concurrent; | ||||
| using System.IO; | ||||
| using System.Reflection; | ||||
| using System.Threading; | ||||
|  | @ -237,51 +238,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement | |||
|             //EventManager.TriggerAvatarPickerRequest(); | ||||
| 
 | ||||
|             m_log.DebugFormat("[USER MANAGEMENT MODULE]: HandleAvatarPickerRequest for {0}", query); | ||||
| 
 | ||||
|             List<UserData> users = GetUserData(query, 500, 1); | ||||
| 
 | ||||
|             AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket)PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); | ||||
|             // TODO: don't create new blocks if recycling an old packet | ||||
| 
 | ||||
|             AvatarPickerReplyPacket.DataBlock[] searchData = | ||||
|                 new AvatarPickerReplyPacket.DataBlock[users.Count]; | ||||
|             AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); | ||||
| 
 | ||||
|             agentData.AgentID = avatarID; | ||||
|             agentData.QueryID = RequestID; | ||||
|             replyPacket.AgentData = agentData; | ||||
|             //byte[] bytes = new byte[AvatarResponses.Count*32]; | ||||
| 
 | ||||
|             int i = 0; | ||||
|             foreach (UserData item in users) | ||||
|             { | ||||
|                 UUID translatedIDtem = item.Id; | ||||
|                 searchData[i] = new AvatarPickerReplyPacket.DataBlock(); | ||||
|                 searchData[i].AvatarID = translatedIDtem; | ||||
|                 searchData[i].FirstName = Utils.StringToBytes((string)item.FirstName); | ||||
|                 searchData[i].LastName = Utils.StringToBytes((string)item.LastName); | ||||
|                 i++; | ||||
|             } | ||||
|             if (users.Count == 0) | ||||
|             { | ||||
|                 searchData = new AvatarPickerReplyPacket.DataBlock[0]; | ||||
|             } | ||||
|             replyPacket.Data = searchData; | ||||
| 
 | ||||
|             AvatarPickerReplyAgentDataArgs agent_data = new AvatarPickerReplyAgentDataArgs(); | ||||
|             agent_data.AgentID = replyPacket.AgentData.AgentID; | ||||
|             agent_data.QueryID = replyPacket.AgentData.QueryID; | ||||
| 
 | ||||
|             List<AvatarPickerReplyDataArgs> data_args = new List<AvatarPickerReplyDataArgs>(); | ||||
|             for (i = 0; i < replyPacket.Data.Length; i++) | ||||
|             { | ||||
|                 AvatarPickerReplyDataArgs data_arg = new AvatarPickerReplyDataArgs(); | ||||
|                 data_arg.AvatarID = replyPacket.Data[i].AvatarID; | ||||
|                 data_arg.FirstName = replyPacket.Data[i].FirstName; | ||||
|                 data_arg.LastName = replyPacket.Data[i].LastName; | ||||
|                 data_args.Add(data_arg); | ||||
|             } | ||||
|             client.SendAvatarPickerReply(agent_data, data_args); | ||||
|             client.SendAvatarPickerReply(RequestID, users); | ||||
|         } | ||||
| 
 | ||||
|         protected virtual void AddAdditionalUsers(string query, List<UserData> users) | ||||
|  |  | |||
|  | @ -1176,7 +1176,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         public void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data) | ||||
|         public void SendAvatarPickerReply(UUID QueryID, List<UserData> users) | ||||
|         { | ||||
| 
 | ||||
|         } | ||||
|  |  | |||
|  | @ -677,7 +677,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public virtual void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data) | ||||
|         public virtual void SendAvatarPickerReply(UUID QueryID, List<UserData> users) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
|  | @ -583,7 +583,7 @@ namespace OpenSim.Tests.Common | |||
|         { | ||||
|         } | ||||
| 
 | ||||
|         public virtual void SendAvatarPickerReply(AvatarPickerReplyAgentDataArgs AgentData, List<AvatarPickerReplyDataArgs> Data) | ||||
|         public virtual void SendAvatarPickerReply(UUID QueryID, List<UserData> users) | ||||
|         { | ||||
|         } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 UbitUmarov
						UbitUmarov