From 544daf1c76ff553036ebd81a8e0e2af0dff9bfe0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 11 Oct 2008 05:59:12 +0000 Subject: Plumb the remaining search packets and replies. --- OpenSim/Framework/IClientAPI.cs | 66 ++++++ .../Region/ClientStack/LindenUDP/LLClientView.cs | 239 +++++++++++++++++++++ .../Environment/Modules/World/NPC/NPCAvatar.cs | 28 +++ .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 43 +++- 4 files changed, 369 insertions(+), 7 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index dd905c9..556f724 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -314,6 +314,10 @@ namespace OpenSim.Framework public delegate void ObjectOwner(IClientAPI remoteClient, UUID ownerID, UUID groupID, List localIDs); public delegate void DirPlacesQuery(IClientAPI remoteClient, UUID queryID, string queryText, int queryFlags, int category, string simName, int queryStart); + public delegate void DirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart); + public delegate void DirLandQuery(IClientAPI remoteClient, UUID queryID, uint queryFlags, uint searchType, int price, int area, int queryStart); + public delegate void DirPopularQuery(IClientAPI remoteClient, UUID queryID, uint queryFlags); + public delegate void DirClassifiedQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, uint category, int queryStart); public delegate void MapItemRequest(IClientAPI remoteClient, uint flags, uint EstateID, bool godlike, uint itemtype, ulong regionhandle); @@ -328,6 +332,61 @@ namespace OpenSim.Framework public float dwell; } + public struct DirPeopleReplyData + { + public UUID agentID; + public string firstName; + public string lastName; + public string group; + public bool online; + public int reputation; + } + + public struct DirEventsReplyData + { + public UUID ownerID; + public string name; + public uint eventID; + public string date; + public uint unixTime; + public uint eventFlags; + } + + public struct DirGroupsReplyData + { + public UUID groupID; + public string groupName; + public int members; + public float searchOrder; + } + + public struct DirClassifiedReplyData + { + public UUID classifiedID; + public string name; + public byte classifiedFlags; + public uint creationDate; + public uint expirationDate; + public int price; + } + + public struct DirLandReplyData + { + public UUID parcelID; + public string name; + public bool auction; + public bool forSale; + public int salePrice; + public int actualArea; + } + + public struct DirPopularReplyData + { + public UUID parcelID; + public string name; + public float dwell; + } + public interface IClientAPI { Vector3 StartPos { get; set; } @@ -793,6 +852,13 @@ namespace OpenSim.Framework void SendScriptTeleportRequest(string objName, string simName, Vector3 pos, Vector3 lookAt); void SendDirPlacesReply(UUID queryID, DirPlacesReplyData[] data); + void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data); + void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data); + void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data); + void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data); + void SendDirLandReply(UUID queryID, DirLandReplyData[] data); + void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data); + void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7eda272..6ec9f7f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -263,6 +263,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private ObjectOwner handlerObjectOwner = null; private DirPlacesQuery handlerDirPlacesQuery = null; + private DirFindQuery handlerDirFindQuery = null; + private DirLandQuery handlerDirLandQuery = null; + private DirPopularQuery handlerDirPopularQuery = null; + private DirClassifiedQuery handlerDirClassifiedQuery = null; private MapItemRequest handlerMapItemRequest = null; @@ -993,6 +997,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP public event ObjectOwner OnObjectOwner; public event DirPlacesQuery OnDirPlacesQuery; + public event DirFindQuery OnDirFindQuery; + public event DirLandQuery OnDirLandQuery; + public event DirPopularQuery OnDirPopularQuery; + public event DirClassifiedQuery OnDirClassifiedQuery; public event MapItemRequest OnMapItemRequest; @@ -6346,6 +6354,58 @@ namespace OpenSim.Region.ClientStack.LindenUDP dirPlacesQueryPacket.QueryData.QueryStart); } break; + case PacketType.DirFindQuery: + DirFindQueryPacket dirFindQueryPacket = (DirFindQueryPacket)Pack; + handlerDirFindQuery = OnDirFindQuery; + if (handlerDirFindQuery != null) + { + handlerDirFindQuery(this, + dirFindQueryPacket.QueryData.QueryID, + Utils.BytesToString( + dirFindQueryPacket.QueryData.QueryText), + dirFindQueryPacket.QueryData.QueryFlags, + dirFindQueryPacket.QueryData.QueryStart); + } + break; + case PacketType.DirLandQuery: + DirLandQueryPacket dirLandQueryPacket = (DirLandQueryPacket)Pack; + handlerDirLandQuery = OnDirLandQuery; + if (handlerDirLandQuery != null) + { + handlerDirLandQuery(this, + dirLandQueryPacket.QueryData.QueryID, + dirLandQueryPacket.QueryData.QueryFlags, + dirLandQueryPacket.QueryData.SearchType, + dirLandQueryPacket.QueryData.Price, + dirLandQueryPacket.QueryData.Area, + dirLandQueryPacket.QueryData.QueryStart); + } + break; + case PacketType.DirPopularQuery: + DirPopularQueryPacket dirPopularQueryPacket = (DirPopularQueryPacket)Pack; + handlerDirPopularQuery = OnDirPopularQuery; + if (handlerDirPopularQuery != null) + { + handlerDirPopularQuery(this, + dirPopularQueryPacket.QueryData.QueryID, + dirPopularQueryPacket.QueryData.QueryFlags); + } + break; + case PacketType.DirClassifiedQuery: + DirClassifiedQueryPacket dirClassifiedQueryPacket = (DirClassifiedQueryPacket)Pack; + handlerDirClassifiedQuery = OnDirClassifiedQuery; + if (handlerDirClassifiedQuery != null) + { + handlerDirClassifiedQuery(this, + dirClassifiedQueryPacket.QueryData.QueryID, + Utils.BytesToString( + dirClassifiedQueryPacket.QueryData.QueryText), + dirClassifiedQueryPacket.QueryData.QueryFlags, + dirClassifiedQueryPacket.QueryData.Category, + dirClassifiedQueryPacket.QueryData.QueryStart); + } + break; + default: m_log.Warn("[CLIENT]: unhandled packet " + Pack.ToString()); break; @@ -6834,6 +6894,185 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } + + public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data) + { + DirPeopleReplyPacket packet = (DirPeopleReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPeopleReply); + + packet.AgentData = new DirPeopleReplyPacket.AgentDataBlock(); + packet.AgentData.AgentID = AgentId; + + packet.QueryData = new DirPeopleReplyPacket.QueryDataBlock(); + packet.QueryData.QueryID = queryID; + + packet.QueryReplies = new DirPeopleReplyPacket.QueryRepliesBlock[ + data.Length]; + + int i = 0; + foreach (DirPeopleReplyData d in data) + { + packet.QueryReplies[i] = new DirPeopleReplyPacket.QueryRepliesBlock(); + packet.QueryReplies[i].AgentID = d.agentID; + packet.QueryReplies[i].FirstName = + Utils.StringToBytes(d.firstName); + packet.QueryReplies[i].LastName = + Utils.StringToBytes(d.lastName); + packet.QueryReplies[i].Group = + Utils.StringToBytes(d.group); + packet.QueryReplies[i].Online = d.online; + packet.QueryReplies[i].Reputation = d.reputation; + i++; + } + + OutPacket(packet, ThrottleOutPacketType.Task); + } + + public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data) + { + DirEventsReplyPacket packet = (DirEventsReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirEventsReply); + + packet.AgentData = new DirEventsReplyPacket.AgentDataBlock(); + packet.AgentData.AgentID = AgentId; + + packet.QueryData = new DirEventsReplyPacket.QueryDataBlock(); + packet.QueryData.QueryID = queryID; + + packet.QueryReplies = new DirEventsReplyPacket.QueryRepliesBlock[ + data.Length]; + + int i = 0; + foreach (DirEventsReplyData d in data) + { + packet.QueryReplies[i] = new DirEventsReplyPacket.QueryRepliesBlock(); + packet.QueryReplies[i].OwnerID = d.ownerID; + packet.QueryReplies[i].Name = + Utils.StringToBytes(d.name); + packet.QueryReplies[i].EventID = d.eventID; + packet.QueryReplies[i].Date = + Utils.StringToBytes(d.date); + packet.QueryReplies[i].UnixTime = d.unixTime; + packet.QueryReplies[i].EventFlags = d.eventFlags; + i++; + } + + OutPacket(packet, ThrottleOutPacketType.Task); + } + + public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data) + { + DirGroupsReplyPacket packet = (DirGroupsReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirGroupsReply); + + packet.AgentData = new DirGroupsReplyPacket.AgentDataBlock(); + packet.AgentData.AgentID = AgentId; + + packet.QueryData = new DirGroupsReplyPacket.QueryDataBlock(); + packet.QueryData.QueryID = queryID; + + packet.QueryReplies = new DirGroupsReplyPacket.QueryRepliesBlock[ + data.Length]; + + int i = 0; + foreach (DirGroupsReplyData d in data) + { + packet.QueryReplies[i] = new DirGroupsReplyPacket.QueryRepliesBlock(); + packet.QueryReplies[i].GroupID = d.groupID; + packet.QueryReplies[i].GroupName = + Utils.StringToBytes(d.groupName); + packet.QueryReplies[i].Members = d.members; + packet.QueryReplies[i].SearchOrder = d.searchOrder; + i++; + } + + OutPacket(packet, ThrottleOutPacketType.Task); + } + + public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data) + { + DirClassifiedReplyPacket packet = (DirClassifiedReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirClassifiedReply); + + packet.AgentData = new DirClassifiedReplyPacket.AgentDataBlock(); + packet.AgentData.AgentID = AgentId; + + packet.QueryData = new DirClassifiedReplyPacket.QueryDataBlock(); + packet.QueryData.QueryID = queryID; + + packet.QueryReplies = new DirClassifiedReplyPacket.QueryRepliesBlock[ + data.Length]; + + int i = 0; + foreach (DirClassifiedReplyData d in data) + { + packet.QueryReplies[i] = new DirClassifiedReplyPacket.QueryRepliesBlock(); + packet.QueryReplies[i].ClassifiedID = d.classifiedID; + packet.QueryReplies[i].Name = + Utils.StringToBytes(d.name); + packet.QueryReplies[i].ClassifiedFlags = d.classifiedFlags; + packet.QueryReplies[i].CreationDate = d.creationDate; + packet.QueryReplies[i].ExpirationDate = d.expirationDate; + packet.QueryReplies[i].PriceForListing = d.price; + i++; + } + + OutPacket(packet, ThrottleOutPacketType.Task); + } + + public void SendDirLandReply(UUID queryID, DirLandReplyData[] data) + { + DirLandReplyPacket packet = (DirLandReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirLandReply); + + packet.AgentData = new DirLandReplyPacket.AgentDataBlock(); + packet.AgentData.AgentID = AgentId; + + packet.QueryData = new DirLandReplyPacket.QueryDataBlock(); + packet.QueryData.QueryID = queryID; + + packet.QueryReplies = new DirLandReplyPacket.QueryRepliesBlock[ + data.Length]; + + int i = 0; + foreach (DirLandReplyData d in data) + { + packet.QueryReplies[i] = new DirLandReplyPacket.QueryRepliesBlock(); + packet.QueryReplies[i].ParcelID = d.parcelID; + packet.QueryReplies[i].Name = + Utils.StringToBytes(d.name); + packet.QueryReplies[i].Auction = d.auction; + packet.QueryReplies[i].ForSale = d.forSale; + packet.QueryReplies[i].SalePrice = d.salePrice; + packet.QueryReplies[i].ActualArea = d.actualArea; + i++; + } + + OutPacket(packet, ThrottleOutPacketType.Task); + } + + public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data) + { + DirPopularReplyPacket packet = (DirPopularReplyPacket)PacketPool.Instance.GetPacket(PacketType.DirPopularReply); + + packet.AgentData = new DirPopularReplyPacket.AgentDataBlock(); + packet.AgentData.AgentID = AgentId; + + packet.QueryData = new DirPopularReplyPacket.QueryDataBlock(); + packet.QueryData.QueryID = queryID; + + packet.QueryReplies = new DirPopularReplyPacket.QueryRepliesBlock[ + data.Length]; + + int i = 0; + foreach (DirPopularReplyData d in data) + { + packet.QueryReplies[i] = new DirPopularReplyPacket.QueryRepliesBlock(); + packet.QueryReplies[i].ParcelID = d.parcelID; + packet.QueryReplies[i].Name = + Utils.StringToBytes(d.name); + packet.QueryReplies[i].Dwell = d.dwell; + i++; + } + + OutPacket(packet, ThrottleOutPacketType.Task); + } + public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) { MapItemReplyPacket mirplk = new MapItemReplyPacket(); diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index d0fbfb9..acad64a 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -325,6 +325,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC public event ObjectOwner OnObjectOwner; public event DirPlacesQuery OnDirPlacesQuery; + public event DirFindQuery OnDirFindQuery; + public event DirLandQuery OnDirLandQuery; + public event DirPopularQuery OnDirPopularQuery; + public event DirClassifiedQuery OnDirClassifiedQuery; public event MapItemRequest OnMapItemRequest; @@ -899,6 +903,30 @@ namespace OpenSim.Region.Environment.Modules.World.NPC { } + public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data) + { + } + + public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data) + { + } + + public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data) + { + } + + public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data) + { + } + + public void SendDirLandReply(UUID queryID, DirLandReplyData[] data) + { + } + + public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data) + { + } + public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) { } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 6c2831e..ef78cb5 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -210,16 +210,21 @@ namespace OpenSim.Region.Examples.SimpleModule public event SetScriptRunning OnSetScriptRunning; public event UpdateVector OnAutoPilotGo; - public event TerrainUnacked OnUnackedTerrain; + public event TerrainUnacked OnUnackedTerrain; - public event RegionHandleRequest OnRegionHandleRequest; - public event ParcelInfoRequest OnParcelInfoRequest; + public event RegionHandleRequest OnRegionHandleRequest; + public event ParcelInfoRequest OnParcelInfoRequest; - public event ActivateGesture OnActivateGesture; - public event DeactivateGesture OnDeactivateGesture; - public event ObjectOwner OnObjectOwner; + public event ActivateGesture OnActivateGesture; + public event DeactivateGesture OnDeactivateGesture; + public event ObjectOwner OnObjectOwner; + + public event DirPlacesQuery OnDirPlacesQuery; + public event DirFindQuery OnDirFindQuery; + public event DirLandQuery OnDirLandQuery; + public event DirPopularQuery OnDirPopularQuery; + public event DirClassifiedQuery OnDirClassifiedQuery; - public event DirPlacesQuery OnDirPlacesQuery; public event MapItemRequest OnMapItemRequest; @@ -896,6 +901,30 @@ namespace OpenSim.Region.Examples.SimpleModule { } + public void SendDirPeopleReply(UUID queryID, DirPeopleReplyData[] data) + { + } + + public void SendDirEventsReply(UUID queryID, DirEventsReplyData[] data) + { + } + + public void SendDirGroupsReply(UUID queryID, DirGroupsReplyData[] data) + { + } + + public void SendDirClassifiedReply(UUID queryID, DirClassifiedReplyData[] data) + { + } + + public void SendDirLandReply(UUID queryID, DirLandReplyData[] data) + { + } + + public void SendDirPopularReply(UUID queryID, DirPopularReplyData[] data) + { + } + public void SendMapItemReply(mapItemReply[] replies, uint mapitemtype, uint flags) { } -- cgit v1.1