2007-03-09 20:26:07 +00:00
/ *
2009-10-10 06:38:07 +00:00
* Copyright ( c ) 2006 - 2009 , openmetaverse . org
2007-03-09 20:26:07 +00:00
* All rights reserved .
*
* - Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions are met :
*
* - Redistributions of source code must retain the above copyright notice , this
* list of conditions and the following disclaimer .
2008-07-21 21:12:59 +00:00
* - Neither the name of the openmetaverse . org nor the names
2007-03-09 20:26:07 +00:00
* of its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR
* CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS
* INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN
* CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE )
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE .
* /
using System ;
using System.Threading ;
2009-10-10 06:38:07 +00:00
using System.Collections.Generic ;
2008-07-21 21:12:59 +00:00
using OpenMetaverse.Packets ;
2009-05-09 22:46:38 +00:00
using OpenMetaverse.Interfaces ;
using OpenMetaverse.Messages.Linden ;
2007-03-09 20:26:07 +00:00
2008-07-21 21:12:59 +00:00
namespace OpenMetaverse
2007-03-09 20:26:07 +00:00
{
/// <summary>
2009-10-10 06:38:07 +00:00
/// Access to the data server which allows searching for land, events, people, etc
2007-03-09 20:26:07 +00:00
/// </summary>
public class DirectoryManager
{
2009-10-10 06:38:07 +00:00
#region Enums
/// <summary>Classified Ad categories</summary>
2007-03-09 20:26:07 +00:00
public enum ClassifiedCategories
{
2009-10-07 20:13:33 +00:00
/// <summary>Classified is listed in the Any category</summary>
2007-03-09 20:26:07 +00:00
Any = 0 ,
2009-10-07 20:13:33 +00:00
/// <summary>Classified is shopping related</summary>
2007-03-09 20:26:07 +00:00
Shopping ,
2009-10-07 20:13:33 +00:00
/// <summary>Classified is </summary>
2007-03-09 20:26:07 +00:00
LandRental ,
/// <summary></summary>
PropertyRental ,
/// <summary></summary>
SpecialAttraction ,
/// <summary></summary>
NewProducts ,
/// <summary></summary>
Employment ,
/// <summary></summary>
Wanted ,
/// <summary></summary>
Service ,
/// <summary></summary>
Personal
}
2009-10-10 06:38:07 +00:00
/// <summary>Event Categories</summary>
2008-01-01 00:29:51 +00:00
public enum EventCategories
{
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
All = 0 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Discussion = 18 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Sports = 19 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
LiveMusic = 20 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Commercial = 22 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Nightlife = 23 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Games = 24 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Pageants = 25 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Education = 26 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Arts = 27 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Charity = 28 ,
2009-10-07 20:13:33 +00:00
/// <summary></summary>
2008-01-01 00:29:51 +00:00
Miscellaneous = 29
}
2007-03-09 20:26:07 +00:00
/// <summary>
2009-10-08 02:56:37 +00:00
/// Query Flags used in many of the DirectoryManager methods to specify which query to execute and how to return the results.
///
2009-10-10 06:38:07 +00:00
/// Flags can be combined using the | (pipe) character, not all flags are available in all queries
2007-03-09 20:26:07 +00:00
/// </summary>
[Flags]
public enum DirFindFlags
{
2009-10-08 02:56:37 +00:00
/// <summary>Query the People database</summary>
2007-03-09 20:26:07 +00:00
People = 1 < < 0 ,
/// <summary></summary>
Online = 1 < < 1 ,
2008-07-30 06:51:51 +00:00
// <summary></summary>
2008-07-21 18:56:11 +00:00
//[Obsolete]
//Places = 1 << 2,
2007-03-09 20:26:07 +00:00
/// <summary></summary>
Events = 1 < < 3 ,
2009-10-10 06:38:07 +00:00
/// <summary>Query the Groups database</summary>
2007-03-09 20:26:07 +00:00
Groups = 1 < < 4 ,
2009-10-08 02:56:37 +00:00
/// <summary>Query the Events database</summary>
2007-03-09 20:26:07 +00:00
DateEvents = 1 < < 5 ,
2009-10-08 02:56:37 +00:00
/// <summary>Query the land holdings database for land owned by the currently connected agent</summary>
2007-03-09 20:26:07 +00:00
AgentOwned = 1 < < 6 ,
/// <summary></summary>
ForSale = 1 < < 7 ,
2009-10-08 02:56:37 +00:00
/// <summary>Query the land holdings database for land which is owned by a Group</summary>
2007-03-09 20:26:07 +00:00
GroupOwned = 1 < < 8 ,
2008-07-30 06:51:51 +00:00
// <summary></summary>
2008-07-21 18:56:11 +00:00
//[Obsolete]
//Auction = 1 << 9,
2009-10-08 02:56:37 +00:00
/// <summary>Specifies the query should pre sort the results based upon traffic
/// when searching the Places database</summary>
2007-03-09 20:26:07 +00:00
DwellSort = 1 < < 10 ,
/// <summary></summary>
PgSimsOnly = 1 < < 11 ,
/// <summary></summary>
PicturesOnly = 1 < < 12 ,
/// <summary></summary>
PgEventsOnly = 1 < < 13 ,
/// <summary></summary>
MatureSimsOnly = 1 < < 14 ,
2009-10-08 02:56:37 +00:00
/// <summary>Specifies the query should pre sort the results in an ascending order when searching the land sales database.
/// This flag is only used when searching the land sales database</summary>
2007-03-09 20:26:07 +00:00
SortAsc = 1 < < 15 ,
2009-10-08 02:56:37 +00:00
/// <summary>Specifies the query should pre sort the results using the SalePrice field when searching the land sales database.
/// This flag is only used when searching the land sales database</summary>
2007-03-09 20:26:07 +00:00
PricesSort = 1 < < 16 ,
2009-10-08 02:56:37 +00:00
/// <summary>Specifies the query should pre sort the results by calculating the average price/sq.m (SalePrice / Area) when searching the land sales database.
/// This flag is only used when searching the land sales database</summary>
2007-03-09 20:26:07 +00:00
PerMeterSort = 1 < < 17 ,
2009-10-08 02:56:37 +00:00
/// <summary>Specifies the query should pre sort the results using the ParcelSize field when searching the land sales database.
/// This flag is only used when searching the land sales database</summary>
2007-03-09 20:26:07 +00:00
AreaSort = 1 < < 18 ,
2009-10-08 02:56:37 +00:00
/// <summary>Specifies the query should pre sort the results using the Name field when searching the land sales database.
/// This flag is only used when searching the land sales database</summary>
2007-03-09 20:26:07 +00:00
NameSort = 1 < < 19 ,
2009-10-08 02:56:37 +00:00
/// <summary>When set, only parcels less than the specified Price will be included when searching the land sales database.
/// This flag is only used when searching the land sales database</summary>
2007-03-09 20:26:07 +00:00
LimitByPrice = 1 < < 20 ,
2009-10-08 02:56:37 +00:00
/// <summary>When set, only parcels greater than the specified Size will be included when searching the land sales database.
/// This flag is only used when searching the land sales database</summary>
2009-10-05 21:56:55 +00:00
LimitByArea = 1 < < 21 ,
/// <summary></summary>
FilterMature = 1 < < 22 ,
/// <summary></summary>
PGOnly = 1 < < 23 ,
2009-11-06 15:17:35 +00:00
/// <summary>Include PG land in results. This flag is used when searching both the Groups, Events and Land sales databases</summary>
2009-10-05 21:56:55 +00:00
IncludePG = 1 < < 24 ,
2009-11-06 15:17:35 +00:00
/// <summary>Include Mature land in results. This flag is used when searching both the Groups, Events and Land sales databases</summary>
2009-10-05 21:56:55 +00:00
IncludeMature = 1 < < 25 ,
2009-11-06 15:17:35 +00:00
/// <summary>Include Adult land in results. This flag is used when searching both the Groups, Events and Land sales databases</summary>
2009-10-05 21:56:55 +00:00
IncludeAdult = 1 < < 26 ,
/// <summary></summary>
2009-10-10 06:38:07 +00:00
AdultOnly = 1 < < 27
2007-03-09 20:26:07 +00:00
}
/// <summary>
2008-03-14 07:11:13 +00:00
/// Land types to search dataserver for
2007-03-09 20:26:07 +00:00
/// </summary>
[Flags]
public enum SearchTypeFlags
{
2009-10-05 21:56:55 +00:00
/// <summary>Search Auction, Mainland and Estate</summary>
Any = - 1 ,
2008-03-14 07:11:13 +00:00
/// <summary>Land which is currently up for auction</summary>
2007-03-09 20:26:07 +00:00
Auction = 1 < < 1 ,
2008-07-30 06:51:51 +00:00
// <summary>Land available to new landowners (formerly the FirstLand program)</summary>
2008-07-21 18:56:11 +00:00
//[Obsolete]
//Newbie = 1 << 2,
2008-03-14 07:11:13 +00:00
/// <summary>Parcels which are on the mainland (Linden owned) continents</summary>
2007-03-09 20:26:07 +00:00
Mainland = 1 < < 3 ,
2008-03-14 07:11:13 +00:00
/// <summary>Parcels which are on privately owned simulators</summary>
2007-03-09 20:26:07 +00:00
Estate = 1 < < 4
}
2008-01-01 00:29:51 +00:00
2009-10-08 02:56:37 +00:00
/// <summary>
/// The content rating of the event
/// </summary>
2008-01-01 00:29:51 +00:00
public enum EventFlags
{
2009-10-08 02:56:37 +00:00
/// <summary>Event is PG</summary>
PG = 0 ,
/// <summary>Event is Mature</summary>
Mature = 1 ,
/// <summary>Event is Adult</summary>
Adult = 2
2008-01-01 00:29:51 +00:00
}
2009-10-07 20:13:33 +00:00
/// <summary>
/// Classified Ad Options
/// </summary>
/// <remarks>There appear to be two formats the flags are packed in.
/// This set of flags is for the newer style</remarks>
[Flags]
public enum ClassifiedFlags : byte
{
2009-10-16 02:53:53 +00:00
/// <summary></summary>
2009-10-07 20:13:33 +00:00
None = 1 < < 0 ,
2009-10-16 02:53:53 +00:00
/// <summary></summary>
2009-10-07 20:13:33 +00:00
Mature = 1 < < 1 ,
2009-10-16 02:53:53 +00:00
/// <summary></summary>
2009-10-07 20:13:33 +00:00
Enabled = 1 < < 2 ,
// HasPrice = 1 << 3, // Deprecated
2009-10-16 02:53:53 +00:00
/// <summary></summary>
2009-10-07 20:13:33 +00:00
UpdateTime = 1 < < 4 ,
2009-10-16 02:53:53 +00:00
/// <summary></summary>
2009-10-10 06:38:07 +00:00
AutoRenew = 1 < < 5
2009-10-07 20:13:33 +00:00
}
/// <summary>
/// Classified ad query options
/// </summary>
[Flags]
public enum ClassifiedQueryFlags
{
/// <summary>Include all ads in results</summary>
All = PG | Mature | Adult ,
/// <summary>Include PG ads in results</summary>
PG = 1 < < 2 ,
/// <summary>Include Mature ads in results</summary>
Mature = 1 < < 3 ,
/// <summary>Include Adult ads in results</summary>
2009-10-10 06:38:07 +00:00
Adult = 1 < < 6 ,
}
/// <summary>
/// The For Sale flag in PlacesReplyData
/// </summary>
public enum PlacesFlags : byte
{
/// <summary>Parcel is not listed for sale</summary>
NotForSale = 0 ,
/// <summary>Parcel is For Sale</summary>
ForSale = 128
}
#endregion
#region Structs
/// <summary>
/// A classified ad on the grid
/// </summary>
public struct Classified
{
/// <summary>UUID for this ad, useful for looking up detailed
/// information about it</summary>
public UUID ID ;
/// <summary>The title of this classified ad</summary>
public string Name ;
/// <summary>Flags that show certain options applied to the classified</summary>
public ClassifiedFlags Flags ;
/// <summary>Creation date of the ad</summary>
public DateTime CreationDate ;
/// <summary>Expiration date of the ad</summary>
public DateTime ExpirationDate ;
/// <summary>Price that was paid for this ad</summary>
public int Price ;
/// <summary>Print the struct data as a string</summary>
/// <returns>A string containing the field name, and field value</returns>
public override string ToString ( )
{
return Helpers . StructToString ( this ) ;
}
2007-03-09 20:26:07 +00:00
}
/// <summary>
/// A parcel retrieved from the dataserver such as results from the
2009-10-08 02:56:37 +00:00
/// "For-Sale" listings or "Places" Search
2007-03-09 20:26:07 +00:00
/// </summary>
public struct DirectoryParcel
{
2009-10-08 02:56:37 +00:00
/// <summary>The unique dataserver parcel ID</summary>
/// <remarks>This id is used to obtain additional information from the entry
/// by using the <see cref="ParcelManager.InfoRequest"/> method</remarks>
2008-07-25 05:15:05 +00:00
public UUID ID ;
2009-10-08 02:56:37 +00:00
/// <summary>A string containing the name of the parcel</summary>
2007-03-09 20:26:07 +00:00
public string Name ;
2009-10-08 02:56:37 +00:00
/// <summary>The size of the parcel</summary>
/// <remarks>This field is not returned for Places searches</remarks>
2007-03-09 20:26:07 +00:00
public int ActualArea ;
2009-10-08 02:56:37 +00:00
/// <summary>The price of the parcel</summary>
/// <remarks>This field is not returned for Places searches</remarks>
2007-03-09 20:26:07 +00:00
public int SalePrice ;
2009-10-08 02:56:37 +00:00
/// <summary>If True, this parcel is flagged to be auctioned</summary>
2007-03-09 20:26:07 +00:00
public bool Auction ;
2009-10-08 02:56:37 +00:00
/// <summary>If true, this parcel is currently set for sale</summary>
2007-03-09 20:26:07 +00:00
public bool ForSale ;
2009-08-24 14:23:02 +00:00
/// <summary>Parcel traffic</summary>
public float Dwell ;
2009-10-08 02:56:37 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Print the struct data as a string</summary>
/// <returns>A string containing the field name, and field value</returns>
2009-10-08 02:56:37 +00:00
public override string ToString ( )
2009-10-10 06:38:07 +00:00
{
return Helpers . StructToString ( this ) ;
2009-10-08 02:56:37 +00:00
}
2007-03-09 20:26:07 +00:00
}
2008-03-14 07:11:13 +00:00
/// <summary>
/// An Avatar returned from the dataserver
/// </summary>
2009-08-24 14:23:02 +00:00
public struct AgentSearchData
2007-08-20 20:38:36 +00:00
{
2008-03-14 07:11:13 +00:00
/// <summary>Online status of agent</summary>
2009-10-10 06:38:07 +00:00
/// <remarks>This field appears to be obsolete and always returns false</remarks>
2007-04-23 01:39:14 +00:00
public bool Online ;
2009-10-10 06:38:07 +00:00
/// <summary>The agents first name</summary>
2007-04-23 01:39:14 +00:00
public string FirstName ;
2009-10-10 06:38:07 +00:00
/// <summary>The agents last name</summary>
2007-04-23 01:39:14 +00:00
public string LastName ;
2009-10-10 06:38:07 +00:00
/// <summary>The agents <see cref="UUID"/></summary>
2008-07-25 05:15:05 +00:00
public UUID AgentID ;
2009-10-10 06:38:07 +00:00
/// <summary>Print the struct data as a string</summary>
/// <returns>A string containing the field name, and field value</returns>
public override string ToString ( )
{
return Helpers . StructToString ( this ) ;
}
2007-04-23 01:39:14 +00:00
}
2009-10-07 20:13:33 +00:00
2007-08-16 19:41:30 +00:00
/// <summary>
/// Response to a "Groups" Search
/// </summary>
public struct GroupSearchData
{
2009-10-10 06:38:07 +00:00
/// <summary>The Group ID</summary>
2008-07-25 05:15:05 +00:00
public UUID GroupID ;
2009-10-10 06:38:07 +00:00
/// <summary>The name of the group</summary>
2007-08-16 19:41:30 +00:00
public string GroupName ;
2009-10-10 06:38:07 +00:00
/// <summary>The current number of members</summary>
2007-08-16 19:41:30 +00:00
public int Members ;
2009-10-10 06:38:07 +00:00
/// <summary>Print the struct data as a string</summary>
/// <returns>A string containing the field name, and field value</returns>
public override string ToString ( )
{
return Helpers . StructToString ( this ) ;
}
2007-08-16 19:41:30 +00:00
}
2007-08-20 20:38:36 +00:00
/// <summary>
2009-10-10 06:38:07 +00:00
/// Parcel information returned from a <see cref="StartPlacesSearch"/> request
/// <para>
/// Represents one of the following:
/// A parcel of land on the grid that has its Show In Search flag set
/// A parcel of land owned by the agent making the request
/// A parcel of land owned by a group the agent making the request is a member of
/// </para>
/// <para>
/// In a request for Group Land, the First record will contain an empty record
/// </para>
/// Note: This is not the same as searching the land for sale data source
2007-08-20 20:38:36 +00:00
/// </summary>
public struct PlacesSearchData
{
2009-10-10 06:38:07 +00:00
/// <summary>The ID of the Agent of Group that owns the parcel</summary>
2008-07-25 05:15:05 +00:00
public UUID OwnerID ;
2009-10-10 06:38:07 +00:00
/// <summary>The name</summary>
2007-08-20 20:38:36 +00:00
public string Name ;
2009-10-10 06:38:07 +00:00
/// <summary>The description</summary>
2007-08-20 20:38:36 +00:00
public string Desc ;
2009-10-10 06:38:07 +00:00
/// <summary>The Size of the parcel</summary>
2007-08-20 20:38:36 +00:00
public int ActualArea ;
2009-10-10 06:38:07 +00:00
/// <summary>The billable Size of the parcel, for mainland
/// parcels this will match the ActualArea field. For Group owned land this will be 10 percent smaller
/// than the ActualArea. For Estate land this will always be 0</summary>
2007-08-20 20:38:36 +00:00
public int BillableArea ;
2009-10-10 06:38:07 +00:00
/// <summary>Indicates the ForSale status of the parcel</summary>
public PlacesFlags Flags ;
/// <summary>The Gridwide X position</summary>
2007-08-20 20:38:36 +00:00
public float GlobalX ;
2009-10-10 06:38:07 +00:00
/// <summary>The Gridwide Y position</summary>
2007-08-20 20:38:36 +00:00
public float GlobalY ;
2009-10-10 06:38:07 +00:00
/// <summary>The Z position of the parcel, or 0 if no landing point set</summary>
2007-08-20 20:38:36 +00:00
public float GlobalZ ;
2009-10-10 06:38:07 +00:00
/// <summary>The name of the Region the parcel is located in</summary>
2007-08-20 20:38:36 +00:00
public string SimName ;
2009-10-10 06:38:07 +00:00
/// <summary>The Asset ID of the parcels Snapshot texture</summary>
2008-07-25 05:15:05 +00:00
public UUID SnapshotID ;
2009-10-10 06:38:07 +00:00
/// <summary>The calculated visitor traffic</summary>
2007-08-20 20:38:36 +00:00
public float Dwell ;
2009-10-10 06:38:07 +00:00
/// <summary>The billing product SKU</summary>
/// <remarks>Known values are:
/// <list type="table">
/// <item><term>023</term><description>Mainland / Full Region</description></item>
/// <item><term>024</term><description>Estate / Full Region</description></item>
/// <item><term>027</term><description>Estate / Openspace</description></item>
/// <item><term>029</term><description>Estate / Homestead</description></item>
/// <item><term>129</term><description>Mainland / Homestead (Linden Owned)</description></item>
/// </list>
/// </remarks>
public string SKU ;
/// <summary>No longer used, will always be 0</summary>
2009-08-24 14:23:02 +00:00
public int Price ;
2009-10-10 06:38:07 +00:00
/// <summary>Get a SL URL for the parcel</summary>
/// <returns>A string, containing a standard SLURL</returns>
public string ToSLurl ( )
{
float x , y ;
Helpers . GlobalPosToRegionHandle ( this . GlobalX , this . GlobalY , out x , out y ) ;
return "secondlife://" + this . SimName + "/" + x + "/" + y + "/" + this . GlobalZ ;
}
/// <summary>Print the struct data as a string</summary>
/// <returns>A string containing the field name, and field value</returns>
public override string ToString ( )
{
return Helpers . StructToString ( this ) ;
}
2007-08-20 20:38:36 +00:00
}
2008-01-01 00:29:51 +00:00
/// <summary>
2009-10-10 06:38:07 +00:00
/// An "Event" Listing summary
2008-01-01 00:29:51 +00:00
/// </summary>
public struct EventsSearchData
{
2009-10-10 06:38:07 +00:00
/// <summary>The ID of the event creator</summary>
2008-07-25 05:15:05 +00:00
public UUID Owner ;
2009-10-10 06:38:07 +00:00
/// <summary>The name of the event</summary>
2008-01-01 00:29:51 +00:00
public string Name ;
2009-10-10 06:38:07 +00:00
/// <summary>The events ID</summary>
2008-01-01 00:29:51 +00:00
public uint ID ;
2009-10-10 06:38:07 +00:00
/// <summary>A string containing the short date/time the event will begin</summary>
2008-01-01 00:29:51 +00:00
public string Date ;
2009-10-10 06:38:07 +00:00
/// <summary>The event start time in Unixtime (seconds since epoch)</summary>
2008-01-01 00:29:51 +00:00
public uint Time ;
2009-10-10 06:38:07 +00:00
/// <summary>The events maturity rating</summary>
2008-01-01 00:29:51 +00:00
public EventFlags Flags ;
2009-10-10 06:38:07 +00:00
/// <summary>Print the struct data as a string</summary>
/// <returns>A string containing the field name, and field value</returns>
public override string ToString ( )
{
return Helpers . StructToString ( this ) ;
}
2008-01-01 00:29:51 +00:00
}
2007-03-09 20:26:07 +00:00
2008-01-01 00:29:51 +00:00
/// <summary>
2009-10-10 06:38:07 +00:00
/// The details of an "Event"
2008-01-01 00:29:51 +00:00
/// </summary>
public struct EventInfo
{
2009-10-10 06:38:07 +00:00
/// <summary>The events ID</summary>
2009-08-24 14:23:02 +00:00
public uint ID ;
2009-10-10 06:38:07 +00:00
/// <summary>The ID of the event creator</summary>
2009-08-24 14:23:02 +00:00
public UUID Creator ;
2009-10-10 06:38:07 +00:00
/// <summary>The name of the event</summary>
2008-01-01 00:29:51 +00:00
public string Name ;
2009-10-10 06:38:07 +00:00
/// <summary>The category</summary>
2008-01-01 00:29:51 +00:00
public EventCategories Category ;
2009-10-10 06:38:07 +00:00
/// <summary>The events description</summary>
2008-01-01 00:29:51 +00:00
public string Desc ;
2009-10-10 06:38:07 +00:00
/// <summary>The short date/time the event will begin</summary>
2008-01-01 00:29:51 +00:00
public string Date ;
2009-10-10 06:38:07 +00:00
/// <summary>The event start time in Unixtime (seconds since epoch) UTC adjusted</summary>
public uint DateUTC ;
/// <summary>The length of the event in minutes</summary>
public uint Duration ;
/// <summary>0 if no cover charge applies</summary>
public uint Cover ;
/// <summary>The cover charge amount in L$ if applicable</summary>
public uint Amount ;
/// <summary>The name of the region where the event is being held</summary>
2008-01-01 00:29:51 +00:00
public string SimName ;
2009-10-10 06:38:07 +00:00
/// <summary>The gridwide location of the event</summary>
2008-07-25 05:15:05 +00:00
public Vector3d GlobalPos ;
2009-10-10 06:38:07 +00:00
/// <summary>The maturity rating</summary>
2008-01-01 00:29:51 +00:00
public EventFlags Flags ;
2009-10-10 06:38:07 +00:00
/// <summary>Get a SL URL for the parcel where the event is hosted</summary>
/// <returns>A string, containing a standard SLURL</returns>
public string ToSLurl ( )
{
float x , y ;
Helpers . GlobalPosToRegionHandle ( ( float ) this . GlobalPos . X , ( float ) this . GlobalPos . Y , out x , out y ) ;
return "secondlife://" + this . SimName + "/" + x + "/" + y + "/" + this . GlobalPos . Z ;
}
/// <summary>Print the struct data as a string</summary>
/// <returns>A string containing the field name, and field value</returns>
public override string ToString ( )
{
return Helpers . StructToString ( this ) ;
}
2008-01-01 00:29:51 +00:00
}
2009-10-10 06:38:07 +00:00
#endregion Structs
#region Event delegates , Raise Events
/// <summary>The event subscribers. null if no subcribers</summary>
private EventHandler < EventInfoReplyEventArgs > m_EventInfoReply ;
2007-03-09 20:26:07 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raises the EventInfoReply event</summary>
/// <param name="e">An EventInfoReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnEventInfo ( EventInfoReplyEventArgs e )
{
EventHandler < EventInfoReplyEventArgs > handler = m_EventInfoReply ;
if ( handler ! = null )
handler ( this , e ) ;
}
2007-03-09 20:26:07 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Thread sync lock object</summary>
private readonly object m_EventDetailLock = new object ( ) ;
2007-08-20 20:38:36 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raised when the data server responds to a <see cref="EventInfoRequest"/> request.</summary>
public event EventHandler < EventInfoReplyEventArgs > EventInfoReply
{
add { lock ( m_EventDetailLock ) { m_EventInfoReply + = value ; } }
remove { lock ( m_EventDetailLock ) { m_EventInfoReply - = value ; } }
}
/// <summary>The event subscribers. null if no subcribers</summary>
private EventHandler < DirEventsReplyEventArgs > m_DirEvents ;
2009-08-24 14:23:02 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raises the DirEventsReply event</summary>
/// <param name="e">An DirEventsReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnDirEvents ( DirEventsReplyEventArgs e )
{
EventHandler < DirEventsReplyEventArgs > handler = m_DirEvents ;
if ( handler ! = null )
handler ( this , e ) ;
}
2009-08-24 14:23:02 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Thread sync lock object</summary>
private readonly object m_DirEventsLock = new object ( ) ;
2007-08-20 20:38:36 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raised when the data server responds to a <see cref="StartEventsSearch"/> request.</summary>
public event EventHandler < DirEventsReplyEventArgs > DirEventsReply
{
add { lock ( m_DirEventsLock ) { m_DirEvents + = value ; } }
remove { lock ( m_DirEventsLock ) { m_DirEvents - = value ; } }
}
/// <summary>The event subscribers. null if no subcribers</summary>
private EventHandler < PlacesReplyEventArgs > m_Places ;
2008-01-01 00:29:51 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raises the PlacesReply event</summary>
/// <param name="e">A PlacesReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnPlaces ( PlacesReplyEventArgs e )
{
EventHandler < PlacesReplyEventArgs > handler = m_Places ;
if ( handler ! = null )
handler ( this , e ) ;
}
2008-01-01 00:29:51 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Thread sync lock object</summary>
private readonly object m_PlacesLock = new object ( ) ;
2007-03-09 20:26:07 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raised when the data server responds to a <see cref="StartPlacesSearch"/> request.</summary>
public event EventHandler < PlacesReplyEventArgs > PlacesReply
{
add { lock ( m_PlacesLock ) { m_Places + = value ; } }
remove { lock ( m_PlacesLock ) { m_Places - = value ; } }
}
/// <summary>The event subscribers. null if no subcribers</summary>
private EventHandler < DirPlacesReplyEventArgs > m_DirPlaces ;
2007-03-09 20:26:07 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raises the DirPlacesReply event</summary>
/// <param name="e">A DirPlacesReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnDirPlaces ( DirPlacesReplyEventArgs e )
{
EventHandler < DirPlacesReplyEventArgs > handler = m_DirPlaces ;
if ( handler ! = null )
handler ( this , e ) ;
}
2007-08-16 19:41:30 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Thread sync lock object</summary>
private readonly object m_DirPlacesLock = new object ( ) ;
/// <summary>Raised when the data server responds to a <see cref="StartDirPlacesSearch"/> request.</summary>
public event EventHandler < DirPlacesReplyEventArgs > DirPlacesReply
{
add { lock ( m_DirPlacesLock ) { m_DirPlaces + = value ; } }
remove { lock ( m_DirPlacesLock ) { m_DirPlaces - = value ; } }
}
/// <summary>The event subscribers. null if no subcribers</summary>
private EventHandler < DirClassifiedsReplyEventArgs > m_DirClassifieds ;
2009-08-24 14:23:02 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raises the DirClassifiedsReply event</summary>
/// <param name="e">A DirClassifiedsReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnDirClassifieds ( DirClassifiedsReplyEventArgs e )
{
EventHandler < DirClassifiedsReplyEventArgs > handler = m_DirClassifieds ;
if ( handler ! = null )
handler ( this , e ) ;
}
/// <summary>Thread sync lock object</summary>
private readonly object m_DirClassifiedsLock = new object ( ) ;
2007-08-20 20:38:36 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raised when the data server responds to a <see cref="StartClassifiedSearch"/> request.</summary>
public event EventHandler < DirClassifiedsReplyEventArgs > DirClassifiedsReply
{
add { lock ( m_DirClassifiedsLock ) { m_DirClassifieds + = value ; } }
remove { lock ( m_DirClassifiedsLock ) { m_DirClassifieds - = value ; } }
}
/// <summary>The event subscribers. null if no subcribers</summary>
private EventHandler < DirGroupsReplyEventArgs > m_DirGroups ;
/// <summary>Raises the DirGroupsReply event</summary>
/// <param name="e">A DirGroupsReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnDirGroups ( DirGroupsReplyEventArgs e )
{
EventHandler < DirGroupsReplyEventArgs > handler = m_DirGroups ;
if ( handler ! = null )
handler ( this , e ) ;
}
2008-01-01 00:29:51 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Thread sync lock object</summary>
private readonly object m_DirGroupsLock = new object ( ) ;
2008-01-01 00:29:51 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Raised when the data server responds to a <see cref="StartGroupSearch"/> request.</summary>
public event EventHandler < DirGroupsReplyEventArgs > DirGroupsReply
{
add { lock ( m_DirGroupsLock ) { m_DirGroups + = value ; } }
remove { lock ( m_DirGroupsLock ) { m_DirGroups - = value ; } }
}
/// <summary>The event subscribers. null if no subcribers</summary>
private EventHandler < DirPeopleReplyEventArgs > m_DirPeople ;
/// <summary>Raises the DirPeopleReply event</summary>
/// <param name="e">A DirPeopleReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnDirPeople ( DirPeopleReplyEventArgs e )
{
EventHandler < DirPeopleReplyEventArgs > handler = m_DirPeople ;
if ( handler ! = null )
handler ( this , e ) ;
}
/// <summary>Thread sync lock object</summary>
private readonly object m_DirPeopleLock = new object ( ) ;
/// <summary>Raised when the data server responds to a <see cref="StartPeopleSearch"/> request.</summary>
public event EventHandler < DirPeopleReplyEventArgs > DirPeopleReply
{
add { lock ( m_DirPeopleLock ) { m_DirPeople + = value ; } }
remove { lock ( m_DirPeopleLock ) { m_DirPeople - = value ; } }
}
/// <summary>The event subscribers. null if no subcribers</summary>
private EventHandler < DirLandReplyEventArgs > m_DirLandReply ;
/// <summary>Raises the DirLandReply event</summary>
/// <param name="e">A DirLandReplyEventArgs object containing the
/// data returned from the data server</param>
protected virtual void OnDirLand ( DirLandReplyEventArgs e )
{
EventHandler < DirLandReplyEventArgs > handler = m_DirLandReply ;
if ( handler ! = null )
handler ( this , e ) ;
}
/// <summary>Thread sync lock object</summary>
private readonly object m_DirLandLock = new object ( ) ;
/// <summary>Raised when the data server responds to a <see cref="StartLandSearch"/> request.</summary>
public event EventHandler < DirLandReplyEventArgs > DirLandReply
{
add { lock ( m_DirLandLock ) { m_DirLandReply + = value ; } }
remove { lock ( m_DirLandLock ) { m_DirLandReply - = value ; } }
}
#endregion
#region Private Members
2008-07-21 21:12:59 +00:00
private GridClient Client ;
2009-10-10 06:38:07 +00:00
#endregion
2007-03-09 20:26:07 +00:00
2009-10-10 06:38:07 +00:00
#region Constructors
2009-10-07 20:13:33 +00:00
/// <summary>
/// Constructs a new instance of the DirectoryManager class
/// </summary>
/// <param name="client">An instance of GridClient</param>
2008-07-21 21:12:59 +00:00
public DirectoryManager ( GridClient client )
2007-03-09 20:26:07 +00:00
{
Client = client ;
2009-10-10 06:38:07 +00:00
2009-10-28 08:01:52 +00:00
Client . Network . RegisterCallback ( PacketType . DirClassifiedReply , DirClassifiedReplyHandler ) ;
2009-10-08 02:56:37 +00:00
// Deprecated, replies come in over capabilities
2009-10-28 08:01:52 +00:00
Client . Network . RegisterCallback ( PacketType . DirLandReply , DirLandReplyHandler ) ;
2009-09-27 20:19:45 +00:00
Client . Network . RegisterEventCallback ( "DirLandReply" , DirLandReplyEventHandler ) ;
2009-10-28 08:01:52 +00:00
Client . Network . RegisterCallback ( PacketType . DirPeopleReply , DirPeopleReplyHandler ) ;
Client . Network . RegisterCallback ( PacketType . DirGroupsReply , DirGroupsReplyHandler ) ;
2009-05-09 22:46:38 +00:00
// Deprecated as of viewer 1.2.3
2009-10-28 08:01:52 +00:00
Client . Network . RegisterCallback ( PacketType . PlacesReply , PlacesReplyHandler ) ;
2009-05-09 22:46:38 +00:00
Client . Network . RegisterEventCallback ( "PlacesReply" , PlacesReplyEventHandler ) ;
2009-10-28 08:01:52 +00:00
Client . Network . RegisterCallback ( PacketType . DirEventsReply , EventsReplyHandler ) ;
Client . Network . RegisterCallback ( PacketType . EventInfoReply , EventInfoReplyHandler ) ;
Client . Network . RegisterCallback ( PacketType . DirPlacesReply , DirPlacesReplyHandler ) ;
2009-10-07 20:13:33 +00:00
}
2007-04-23 01:39:14 +00:00
2009-10-10 06:38:07 +00:00
#endregion
#region Public Methods
2009-10-07 20:13:33 +00:00
// Obsoleted due to new Adult search option
[Obsolete("Use Overload with ClassifiedQueryFlags option instead")]
public UUID StartClassifiedSearch ( string searchText , ClassifiedCategories category , bool mature )
{
return UUID . Zero ;
2007-03-09 20:26:07 +00:00
}
2009-10-07 20:13:33 +00:00
/// <summary>
/// Query the data server for a list of classified ads containing the specified string.
/// Defaults to searching for classified placed in any category, and includes PG, Adult and Mature
/// results.
///
2009-10-08 02:56:37 +00:00
/// Responses are sent 16 per response packet, there is no way to know how many results a query reply will contain however assuming
2009-10-07 20:13:33 +00:00
/// the reply packets arrived ordered, a response with less than 16 entries would indicate all results have been received
2009-10-08 02:56:37 +00:00
///
/// The <see cref="OnClassifiedReply"/> event is raised when a response is received from the simulator
2009-10-07 20:13:33 +00:00
/// </summary>
/// <param name="searchText">A string containing a list of keywords to search for</param>
/// <returns>A UUID to correlate the results when the <see cref="OnClassifiedReply"/> event is raised</returns>
public UUID StartClassifiedSearch ( string searchText )
2007-03-09 20:26:07 +00:00
{
2009-10-10 06:38:07 +00:00
return StartClassifiedSearch ( searchText , ClassifiedCategories . Any , ClassifiedQueryFlags . All ) ;
2009-10-07 20:13:33 +00:00
}
/// <summary>
/// Query the data server for a list of classified ads which contain specified keywords (Overload)
2009-10-08 02:56:37 +00:00
///
/// The <see cref="OnClassifiedReply"/> event is raised when a response is received from the simulator
2009-10-07 20:13:33 +00:00
/// </summary>
/// <param name="searchText">A string containing a list of keywords to search for</param>
/// <param name="category">The category to search</param>
/// <param name="queryFlags">A set of flags which can be ORed to modify query options
/// such as classified maturity rating.</param>
/// <returns>A UUID to correlate the results when the <see cref="OnClassifiedReply"/> event is raised</returns>
/// <example>
/// Search classified ads containing the key words "foo" and "bar" in the "Any" category that are either PG or Mature
/// <code>
/// UUID searchID = StartClassifiedSearch("foo bar", ClassifiedCategories.Any, ClassifiedQueryFlags.PG | ClassifiedQueryFlags.Mature);
/// </code>
/// </example>
/// <remarks>
/// Responses are sent 16 at a time, there is no way to know how many results a query reply will contain however assuming
/// the reply packets arrived ordered, a response with less than 16 entries would indicate all results have been received
/// </remarks>
public UUID StartClassifiedSearch ( string searchText , ClassifiedCategories category , ClassifiedQueryFlags queryFlags )
2009-10-10 06:38:07 +00:00
{
2007-03-09 20:26:07 +00:00
DirClassifiedQueryPacket query = new DirClassifiedQueryPacket ( ) ;
2008-07-25 05:15:05 +00:00
UUID queryID = UUID . Random ( ) ;
2007-03-09 20:26:07 +00:00
2007-11-06 09:26:10 +00:00
query . AgentData . AgentID = Client . Self . AgentID ;
query . AgentData . SessionID = Client . Self . SessionID ;
2009-10-07 20:13:33 +00:00
query . QueryData . Category = ( uint ) category ;
query . QueryData . QueryFlags = ( uint ) queryFlags ;
2007-03-09 20:26:07 +00:00
query . QueryData . QueryID = queryID ;
2008-08-12 22:38:02 +00:00
query . QueryData . QueryText = Utils . StringToBytes ( searchText ) ;
2007-03-09 20:26:07 +00:00
Client . Network . SendPacket ( query ) ;
return queryID ;
}
2009-08-24 14:23:02 +00:00
/// <summary>
2009-10-08 02:56:37 +00:00
/// Starts search for places (Overloaded)
///
/// The <see cref="OnDirPlacesReply"/> event is raised when a response is received from the simulator
2009-08-24 14:23:02 +00:00
/// </summary>
/// <param name="searchText">Search text</param>
2009-10-08 14:52:56 +00:00
/// <param name="queryStart">Each request is limited to 100 places
/// being returned. To get the first 100 result entries of a request use 0,
/// from 100-199 use 1, 200-299 use 2, etc.</param>
2009-10-08 02:56:37 +00:00
/// <returns>A UUID to correlate the results when the <see cref="OnDirPlacesReply"/> event is raised</returns>
public UUID StartDirPlacesSearch ( string searchText , int queryStart )
2009-08-24 14:23:02 +00:00
{
2009-10-08 02:56:37 +00:00
return StartDirPlacesSearch ( searchText , DirFindFlags . DwellSort | DirFindFlags . IncludePG | DirFindFlags . IncludeMature
| DirFindFlags . IncludeAdult , ParcelCategory . Any , queryStart ) ;
}
/// <summary>
/// Queries the dataserver for parcels of land which are flagged to be shown in search
///
/// The <see cref="OnDirPlacesReply"/> event is raised when a response is received from the simulator
/// </summary>
/// <param name="searchText">A string containing a list of keywords to search for separated by a space character</param>
/// <param name="queryFlags">A set of flags which can be ORed to modify query options
/// such as classified maturity rating.</param>
/// <param name="category">The category to search</param>
/// <param name="queryStart">Each request is limited to 100 places
/// being returned. To get the first 100 result entries of a request use 0,
/// from 100-199 use 1, 200-299 use 2, etc.</param>
/// <returns>A UUID to correlate the results when the <see cref="OnDirPlacesReply"/> event is raised</returns>
/// <example>
/// Search places containing the key words "foo" and "bar" in the "Any" category that are either PG or Adult
/// <code>
/// UUID searchID = StartDirPlacesSearch("foo bar", DirFindFlags.DwellSort | DirFindFlags.IncludePG | DirFindFlags.IncludeAdult, ParcelCategory.Any, 0);
/// </code>
/// </example>
/// <remarks>
/// Additional information on the results can be obtained by using the ParcelManager.InfoRequest method
/// </remarks>
public UUID StartDirPlacesSearch ( string searchText , DirFindFlags queryFlags , ParcelCategory category , int queryStart )
2009-10-10 06:38:07 +00:00
{
2009-08-24 14:23:02 +00:00
DirPlacesQueryPacket query = new DirPlacesQueryPacket ( ) ;
2009-10-10 06:38:07 +00:00
2009-10-08 02:56:37 +00:00
UUID queryID = UUID . Random ( ) ;
2009-10-10 06:38:07 +00:00
2009-08-24 14:23:02 +00:00
query . AgentData . AgentID = Client . Self . AgentID ;
query . AgentData . SessionID = Client . Self . SessionID ;
2009-10-08 02:56:37 +00:00
query . QueryData . Category = ( sbyte ) category ;
query . QueryData . QueryFlags = ( uint ) queryFlags ;
2009-08-24 14:23:02 +00:00
query . QueryData . QueryID = queryID ;
query . QueryData . QueryText = Utils . StringToBytes ( searchText ) ;
2009-10-08 02:56:37 +00:00
query . QueryData . QueryStart = queryStart ;
2009-08-24 14:23:02 +00:00
query . QueryData . SimName = Utils . StringToBytes ( string . Empty ) ;
Client . Network . SendPacket ( query ) ;
return queryID ;
}
2007-03-09 20:26:07 +00:00
/// <summary>
/// Starts a search for land sales using the directory
2009-10-08 02:56:37 +00:00
///
/// The <see cref="OnDirLandReply"/> event is raised when a response is received from the simulator
2007-03-09 20:26:07 +00:00
/// </summary>
/// <param name="typeFlags">What type of land to search for. Auction,
2009-10-10 06:38:07 +00:00
/// estate, mainland, "first land", etc</param>
2007-03-09 20:26:07 +00:00
/// <remarks>The OnDirLandReply event handler must be registered before
/// calling this function. There is no way to determine how many
/// results will be returned, or how many times the callback will be
/// fired other than you won't get more than 100 total parcels from
/// each query.</remarks>
2009-10-10 06:38:07 +00:00
public void StartLandSearch ( SearchTypeFlags typeFlags )
2007-03-09 20:26:07 +00:00
{
2009-10-10 06:38:07 +00:00
StartLandSearch ( DirFindFlags . SortAsc | DirFindFlags . PerMeterSort , typeFlags , 0 , 0 , 0 ) ;
2007-03-09 20:26:07 +00:00
}
/// <summary>
/// Starts a search for land sales using the directory
2009-10-08 02:56:37 +00:00
///
/// The <seealso cref="OnDirLandReply"/> event is raised when a response is received from the simulator
2007-03-09 20:26:07 +00:00
/// </summary>
/// <param name="typeFlags">What type of land to search for. Auction,
/// estate, mainland, "first land", etc</param>
/// <param name="priceLimit">Maximum price to search for</param>
/// <param name="areaLimit">Maximum area to search for</param>
/// <param name="queryStart">Each request is limited to 100 parcels
/// being returned. To get the first 100 parcels of a request use 0,
2009-10-10 06:38:07 +00:00
/// from 100-199 use 1, 200-299 use 2, etc.</param>
2007-03-09 20:26:07 +00:00
/// <remarks>The OnDirLandReply event handler must be registered before
/// calling this function. There is no way to determine how many
/// results will be returned, or how many times the callback will be
/// fired other than you won't get more than 100 total parcels from
/// each query.</remarks>
2009-10-10 06:38:07 +00:00
public void StartLandSearch ( SearchTypeFlags typeFlags , int priceLimit , int areaLimit , int queryStart )
2007-03-09 20:26:07 +00:00
{
2009-10-10 06:38:07 +00:00
StartLandSearch ( DirFindFlags . SortAsc | DirFindFlags . PerMeterSort | DirFindFlags . LimitByPrice |
2007-03-09 20:26:07 +00:00
DirFindFlags . LimitByArea , typeFlags , priceLimit , areaLimit , queryStart ) ;
}
/// <summary>
2009-10-10 06:38:07 +00:00
/// Send a request to the data server for land sales listings
2007-03-09 20:26:07 +00:00
/// </summary>
2009-10-08 02:56:37 +00:00
///
/// <param name="findFlags">Flags sent to specify query options
///
/// Available flags:
/// Specify the parcel rating with one or more of the following:
/// IncludePG IncludeMature IncludeAdult
///
/// Specify the field to pre sort the results with ONLY ONE of the following:
/// PerMeterSort NameSort AreaSort PricesSort
///
/// Specify the order the results are returned in, if not specified the results are pre sorted in a Descending Order
/// SortAsc
///
/// Specify additional filters to limit the results with one or both of the following:
/// LimitByPrice LimitByArea
///
/// Flags can be combined by separating them with the | (pipe) character
///
/// Additional details can be found in <see cref="DirFindFlags"/>
/// </param>
2007-03-09 20:26:07 +00:00
/// <param name="typeFlags">What type of land to search for. Auction,
2009-10-08 02:56:37 +00:00
/// Estate or Mainland</param>
/// <param name="priceLimit">Maximum price to search for when the
/// DirFindFlags.LimitByPrice flag is specified in findFlags</param>
/// <param name="areaLimit">Maximum area to search for when the
/// DirFindFlags.LimitByArea flag is specified in findFlags</param>
2007-03-09 20:26:07 +00:00
/// <param name="queryStart">Each request is limited to 100 parcels
/// being returned. To get the first 100 parcels of a request use 0,
2007-04-17 20:48:18 +00:00
/// from 100-199 use 100, 200-299 use 200, etc.</param>
2009-10-08 02:56:37 +00:00
/// <remarks><para>The <seealso cref="OnDirLandReply"/> event will be raised with the response from the simulator
///
/// There is no way to determine how many results will be returned, or how many times the callback will be
2007-03-09 20:26:07 +00:00
/// fired other than you won't get more than 100 total parcels from
2009-10-08 02:56:37 +00:00
/// each reply.</para>
///
/// <para>Any land set for sale to either anybody or specific to the connected agent will be included in the
/// results if the land is included in the query</para></remarks>
/// <example>
/// <code>
/// // request all mainland, any maturity rating that is larger than 512 sq.m
/// StartLandSearch(DirFindFlags.SortAsc | DirFindFlags.PerMeterSort | DirFindFlags.LimitByArea | DirFindFlags.IncludePG | DirFindFlags.IncludeMature | DirFindFlags.IncludeAdult, SearchTypeFlags.Mainland, 0, 512, 0);
/// </code></example>
2009-10-10 06:38:07 +00:00
public void StartLandSearch ( DirFindFlags findFlags , SearchTypeFlags typeFlags , int priceLimit ,
2007-03-09 20:26:07 +00:00
int areaLimit , int queryStart )
{
DirLandQueryPacket query = new DirLandQueryPacket ( ) ;
2007-11-06 09:26:10 +00:00
query . AgentData . AgentID = Client . Self . AgentID ;
query . AgentData . SessionID = Client . Self . SessionID ;
2007-03-09 20:26:07 +00:00
query . QueryData . Area = areaLimit ;
query . QueryData . Price = priceLimit ;
query . QueryData . QueryStart = queryStart ;
query . QueryData . SearchType = ( uint ) typeFlags ;
query . QueryData . QueryFlags = ( uint ) findFlags ;
2009-10-10 06:38:07 +00:00
query . QueryData . QueryID = UUID . Random ( ) ;
2007-03-09 20:26:07 +00:00
2009-10-10 06:38:07 +00:00
Client . Network . SendPacket ( query ) ;
2007-03-09 20:26:07 +00:00
}
2009-10-10 06:38:07 +00:00
2007-08-16 19:41:30 +00:00
/// <summary>
2009-10-10 06:38:07 +00:00
/// Search for Groups
2007-08-16 19:41:30 +00:00
/// </summary>
2009-10-10 06:38:07 +00:00
/// <param name="searchText">The name or portion of the name of the group you wish to search for</param>
2009-11-06 15:17:35 +00:00
/// <param name="queryStart">Start from the match number</param>
2009-10-07 20:13:33 +00:00
/// <returns></returns>
2009-10-10 06:38:07 +00:00
public UUID StartGroupSearch ( string searchText , int queryStart )
2009-11-06 15:17:35 +00:00
{
return StartGroupSearch ( searchText , queryStart , DirFindFlags . Groups | DirFindFlags . IncludePG
| DirFindFlags . IncludeMature | DirFindFlags . IncludeAdult ) ;
}
/// <summary>
/// Search for Groups
/// </summary>
/// <param name="searchText">The name or portion of the name of the group you wish to search for</param>
/// <param name="queryStart">Start from the match number</param>
/// <param name="flags">Search flags</param>
/// <returns></returns>
public UUID StartGroupSearch ( string searchText , int queryStart , DirFindFlags flags )
2007-08-16 19:41:30 +00:00
{
DirFindQueryPacket find = new DirFindQueryPacket ( ) ;
2007-11-06 09:26:10 +00:00
find . AgentData . AgentID = Client . Self . AgentID ;
find . AgentData . SessionID = Client . Self . SessionID ;
2009-11-06 15:17:35 +00:00
find . QueryData . QueryFlags = ( uint ) flags ;
2008-08-12 22:38:02 +00:00
find . QueryData . QueryText = Utils . StringToBytes ( searchText ) ;
2009-10-10 06:38:07 +00:00
find . QueryData . QueryID = UUID . Random ( ) ;
2007-08-16 19:41:30 +00:00
find . QueryData . QueryStart = queryStart ;
2009-10-10 06:38:07 +00:00
2007-08-16 19:41:30 +00:00
Client . Network . SendPacket ( find ) ;
2007-03-09 20:26:07 +00:00
2009-10-10 06:38:07 +00:00
return find . QueryData . QueryID ;
2007-07-19 06:42:25 +00:00
}
2009-10-10 06:38:07 +00:00
2009-10-07 20:13:33 +00:00
/// <summary>
2009-10-10 06:38:07 +00:00
/// Search the People directory for other avatars
2009-10-07 20:13:33 +00:00
/// </summary>
2009-10-10 06:38:07 +00:00
/// <param name="searchText">The name or portion of the name of the avatar you wish to search for</param>
2009-10-07 20:13:33 +00:00
/// <param name="queryStart"></param>
/// <returns></returns>
2009-10-10 06:38:07 +00:00
public UUID StartPeopleSearch ( string searchText , int queryStart )
2007-07-19 06:42:25 +00:00
{
2007-04-23 01:39:14 +00:00
DirFindQueryPacket find = new DirFindQueryPacket ( ) ;
2007-11-06 09:26:10 +00:00
find . AgentData . AgentID = Client . Self . AgentID ;
find . AgentData . SessionID = Client . Self . SessionID ;
2009-10-10 06:38:07 +00:00
find . QueryData . QueryFlags = ( uint ) DirFindFlags . People ;
2008-08-12 22:38:02 +00:00
find . QueryData . QueryText = Utils . StringToBytes ( searchText ) ;
2009-10-10 06:38:07 +00:00
find . QueryData . QueryID = UUID . Random ( ) ;
2007-05-14 10:18:54 +00:00
find . QueryData . QueryStart = queryStart ;
2007-08-20 20:38:36 +00:00
2007-04-23 01:39:14 +00:00
Client . Network . SendPacket ( find ) ;
2007-08-20 20:38:36 +00:00
2009-10-10 06:38:07 +00:00
return find . QueryData . QueryID ;
2007-04-23 01:39:14 +00:00
}
2009-10-10 06:38:07 +00:00
2007-08-20 20:38:36 +00:00
/// <summary>
2009-10-10 06:38:07 +00:00
/// Search Places for parcels of land you personally own
2007-08-20 20:38:36 +00:00
/// </summary>
2008-07-25 05:15:05 +00:00
public UUID StartPlacesSearch ( )
2007-08-20 20:38:36 +00:00
{
2009-08-24 14:23:02 +00:00
return StartPlacesSearch ( DirFindFlags . AgentOwned , ParcelCategory . Any , String . Empty , String . Empty ,
2009-10-10 06:38:07 +00:00
UUID . Zero , UUID . Random ( ) ) ;
2007-08-20 20:38:36 +00:00
}
/// <summary>
2009-10-10 06:38:07 +00:00
/// Searches Places for land owned by the specified group
2007-08-20 20:38:36 +00:00
/// </summary>
2009-10-10 06:38:07 +00:00
/// <param name="groupID">ID of the group you want to recieve land list for (You must be a member of the group)</param>
2007-08-20 20:38:36 +00:00
/// <returns>Transaction (Query) ID which can be associated with results from your request.</returns>
2009-10-10 06:38:07 +00:00
public UUID StartPlacesSearch ( UUID groupID )
2007-08-20 20:38:36 +00:00
{
2009-10-10 06:38:07 +00:00
return StartPlacesSearch ( DirFindFlags . GroupOwned , ParcelCategory . Any , String . Empty , String . Empty ,
groupID , UUID . Random ( ) ) ;
2007-08-20 20:38:36 +00:00
}
/// <summary>
2009-10-10 06:38:07 +00:00
/// Search the Places directory for parcels that are listed in search and contain the specified keywords
2007-08-20 20:38:36 +00:00
/// </summary>
2009-10-10 06:38:07 +00:00
/// <param name="searchText">A string containing the keywords to search for</param>
2007-08-20 20:38:36 +00:00
/// <returns>Transaction (Query) ID which can be associated with results from your request.</returns>
2009-10-10 06:38:07 +00:00
public UUID StartPlacesSearch ( string searchText )
2007-08-20 20:38:36 +00:00
{
2009-10-10 06:38:07 +00:00
return StartPlacesSearch ( DirFindFlags . DwellSort | DirFindFlags . IncludePG | DirFindFlags . IncludeMature | DirFindFlags . IncludeAdult ,
ParcelCategory . Any , searchText , String . Empty , UUID . Zero , UUID . Random ( ) ) ;
2007-08-20 20:38:36 +00:00
}
/// <summary>
/// Search Places - All Options
/// </summary>
/// <param name="findFlags">One of the Values from the DirFindFlags struct, ie: AgentOwned, GroupOwned, etc.</param>
/// <param name="searchCategory">One of the values from the SearchCategory Struct, ie: Any, Linden, Newcomer</param>
2009-10-08 02:56:37 +00:00
/// <param name="searchText">A string containing a list of keywords to search for separated by a space character</param>
2007-08-20 20:38:36 +00:00
/// <param name="simulatorName">String Simulator Name to search in</param>
/// <param name="groupID">LLUID of group you want to recieve results for</param>
/// <param name="transactionID">Transaction (Query) ID which can be associated with results from your request.</param>
/// <returns>Transaction (Query) ID which can be associated with results from your request.</returns>
2009-10-10 06:38:07 +00:00
public UUID StartPlacesSearch ( DirFindFlags findFlags , ParcelCategory searchCategory , string searchText , string simulatorName ,
UUID groupID , UUID transactionID )
2007-08-20 20:38:36 +00:00
{
PlacesQueryPacket find = new PlacesQueryPacket ( ) ;
2007-11-06 09:26:10 +00:00
find . AgentData . AgentID = Client . Self . AgentID ;
find . AgentData . SessionID = Client . Self . SessionID ;
2007-08-20 20:38:36 +00:00
find . AgentData . QueryID = groupID ;
find . TransactionData . TransactionID = transactionID ;
2008-08-12 22:38:02 +00:00
find . QueryData . QueryText = Utils . StringToBytes ( searchText ) ;
2007-08-20 20:38:36 +00:00
find . QueryData . QueryFlags = ( uint ) findFlags ;
find . QueryData . Category = ( sbyte ) searchCategory ;
2008-08-12 22:38:02 +00:00
find . QueryData . SimName = Utils . StringToBytes ( simulatorName ) ;
2009-08-24 14:23:02 +00:00
2007-08-20 20:38:36 +00:00
Client . Network . SendPacket ( find ) ;
return transactionID ;
}
2008-01-01 00:29:51 +00:00
/// <summary>
2009-10-08 02:56:37 +00:00
/// Search All Events with specifid searchText in all categories, includes PG, Mature and Adult
2008-01-01 00:29:51 +00:00
/// </summary>
2009-10-08 02:56:37 +00:00
/// <param name="searchText">A string containing a list of keywords to search for separated by a space character</param>
/// <param name="queryStart">Each request is limited to 100 entries
/// being returned. To get the first group of entries of a request use 0,
/// from 100-199 use 100, 200-299 use 200, etc.</param>
2008-01-01 00:29:51 +00:00
/// <returns>UUID of query to correlate results in callback.</returns>
2009-10-08 02:56:37 +00:00
public UUID StartEventsSearch ( string searchText , uint queryStart )
2008-01-01 00:29:51 +00:00
{
2009-10-10 06:38:07 +00:00
return StartEventsSearch ( searchText , DirFindFlags . DateEvents | DirFindFlags . IncludePG | DirFindFlags . IncludeMature | DirFindFlags . IncludeAdult ,
"u" , queryStart , EventCategories . All ) ;
2008-01-01 00:29:51 +00:00
}
/// <summary>
2009-10-08 02:56:37 +00:00
/// Search Events
2008-01-01 00:29:51 +00:00
/// </summary>
2009-10-08 02:56:37 +00:00
/// <param name="searchText">A string containing a list of keywords to search for separated by a space character</param>
/// <param name="queryFlags">One or more of the following flags: DateEvents, IncludePG, IncludeMature, IncludeAdult
/// from the <see cref="DirFindFlags"/> Enum
///
/// Multiple flags can be combined by separating the flags with the | (pipe) character</param>
/// <param name="eventDay">"u" for in-progress and upcoming events, -or- number of days since/until event is scheduled
2008-01-01 00:29:51 +00:00
/// For example "0" = Today, "1" = tomorrow, "2" = following day, "-1" = yesterday, etc.</param>
2009-10-08 02:56:37 +00:00
/// <param name="queryStart">Each request is limited to 100 entries
/// being returned. To get the first group of entries of a request use 0,
/// from 100-199 use 100, 200-299 use 200, etc.</param>
2008-01-01 00:29:51 +00:00
/// <param name="category">EventCategory event is listed under.</param>
/// <returns>UUID of query to correlate results in callback.</returns>
2009-10-08 02:56:37 +00:00
public UUID StartEventsSearch ( string searchText , DirFindFlags queryFlags , string eventDay , uint queryStart , EventCategories category )
2008-01-01 00:29:51 +00:00
{
DirFindQueryPacket find = new DirFindQueryPacket ( ) ;
find . AgentData . AgentID = Client . Self . AgentID ;
find . AgentData . SessionID = Client . Self . SessionID ;
2009-08-24 14:23:02 +00:00
2009-10-08 02:56:37 +00:00
UUID queryID = UUID . Random ( ) ;
2008-01-01 00:29:51 +00:00
find . QueryData . QueryID = queryID ;
2008-08-12 22:38:02 +00:00
find . QueryData . QueryText = Utils . StringToBytes ( eventDay + "|" + ( int ) category + "|" + searchText ) ;
2009-10-08 02:56:37 +00:00
find . QueryData . QueryFlags = ( uint ) queryFlags ;
2008-01-01 00:29:51 +00:00
find . QueryData . QueryStart = ( int ) queryStart ;
Client . Network . SendPacket ( find ) ;
return queryID ;
}
2009-10-10 06:38:07 +00:00
2008-01-01 00:29:51 +00:00
/// <summary>Requests Event Details</summary>
2009-10-10 06:38:07 +00:00
/// <param name="eventID">ID of Event returned from the <see cref="StartEventsSearch"/> method</param>
2008-01-01 00:29:51 +00:00
public void EventInfoRequest ( uint eventID )
{
EventInfoRequestPacket find = new EventInfoRequestPacket ( ) ;
find . AgentData . AgentID = Client . Self . AgentID ;
find . AgentData . SessionID = Client . Self . SessionID ;
find . EventData . EventID = eventID ;
Client . Network . SendPacket ( find ) ;
}
2009-10-10 06:38:07 +00:00
#endregion
2009-10-08 02:56:37 +00:00
2007-11-30 23:19:05 +00:00
#region Blocking Functions
2009-10-08 02:56:37 +00:00
[Obsolete("Use the async StartPeoplSearch method instead")]
2007-11-30 23:19:05 +00:00
public bool PeopleSearch ( DirFindFlags findFlags , string searchText , int queryStart ,
int timeoutMS , out List < AgentSearchData > results )
{
AutoResetEvent searchEvent = new AutoResetEvent ( false ) ;
2009-10-10 06:38:07 +00:00
UUID id = UUID . Zero ;
2007-11-30 23:19:05 +00:00
List < AgentSearchData > people = null ;
2009-10-10 06:38:07 +00:00
EventHandler < DirPeopleReplyEventArgs > callback =
delegate ( object sender , DirPeopleReplyEventArgs e )
2007-11-30 23:19:05 +00:00
{
2009-10-10 06:38:07 +00:00
if ( id = = e . QueryID )
2007-11-30 23:19:05 +00:00
{
2009-10-10 06:38:07 +00:00
people = e . MatchedPeople ;
2007-11-30 23:19:05 +00:00
searchEvent . Set ( ) ;
}
} ;
2009-10-10 06:38:07 +00:00
DirPeopleReply + = callback ;
id = StartPeopleSearch ( searchText , queryStart ) ;
2007-11-30 23:19:05 +00:00
searchEvent . WaitOne ( timeoutMS , false ) ;
2009-10-10 06:38:07 +00:00
DirPeopleReply - = callback ;
2007-11-30 23:19:05 +00:00
results = people ;
return ( results ! = null ) ;
}
#endregion Blocking Functions
#region Packet Handlers
2009-10-28 08:01:52 +00:00
/// <summary>Process an incoming packet and raise the appropriate events</summary>
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void DirClassifiedReplyHandler ( object sender , PacketReceivedEventArgs e )
2007-03-09 20:26:07 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_DirClassifieds ! = null )
2007-03-09 20:26:07 +00:00
{
2009-10-28 08:01:52 +00:00
DirClassifiedReplyPacket reply = ( DirClassifiedReplyPacket ) e . Packet ;
2007-03-09 20:26:07 +00:00
List < Classified > classifieds = new List < Classified > ( ) ;
foreach ( DirClassifiedReplyPacket . QueryRepliesBlock block in reply . QueryReplies )
{
Classified classified = new Classified ( ) ;
2008-08-12 22:38:02 +00:00
classified . CreationDate = Utils . UnixTimeToDateTime ( block . CreationDate ) ;
classified . ExpirationDate = Utils . UnixTimeToDateTime ( block . ExpirationDate ) ;
2009-10-07 20:13:33 +00:00
classified . Flags = ( ClassifiedFlags ) block . ClassifiedFlags ;
2007-03-09 20:26:07 +00:00
classified . ID = block . ClassifiedID ;
2008-08-12 22:38:02 +00:00
classified . Name = Utils . BytesToString ( block . Name ) ;
2007-03-09 20:26:07 +00:00
classified . Price = block . PriceForListing ;
classifieds . Add ( classified ) ;
}
2009-10-10 06:38:07 +00:00
OnDirClassifieds ( new DirClassifiedsReplyEventArgs ( classifieds ) ) ;
2007-03-09 20:26:07 +00:00
}
}
2009-10-28 08:01:52 +00:00
/// <summary>Process an incoming packet and raise the appropriate events</summary>
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void DirLandReplyHandler ( object sender , PacketReceivedEventArgs e )
2007-03-09 20:26:07 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_DirLandReply ! = null )
2007-03-09 20:26:07 +00:00
{
List < DirectoryParcel > parcelsForSale = new List < DirectoryParcel > ( ) ;
2009-10-28 08:01:52 +00:00
DirLandReplyPacket reply = ( DirLandReplyPacket ) e . Packet ;
2007-03-09 20:26:07 +00:00
foreach ( DirLandReplyPacket . QueryRepliesBlock block in reply . QueryReplies )
{
DirectoryParcel dirParcel = new DirectoryParcel ( ) ;
dirParcel . ActualArea = block . ActualArea ;
dirParcel . ID = block . ParcelID ;
2008-08-12 22:38:02 +00:00
dirParcel . Name = Utils . BytesToString ( block . Name ) ;
2007-03-09 20:26:07 +00:00
dirParcel . SalePrice = block . SalePrice ;
dirParcel . Auction = block . Auction ;
2009-09-27 20:19:45 +00:00
dirParcel . ForSale = block . ForSale ;
parcelsForSale . Add ( dirParcel ) ;
}
2009-10-10 06:38:07 +00:00
OnDirLand ( new DirLandReplyEventArgs ( parcelsForSale ) ) ;
2009-09-27 20:19:45 +00:00
}
}
2009-10-10 06:38:07 +00:00
/// <summary>Process an incoming <see cref="DirLandReplyMessage"/> event message</summary>
/// <param name="capsKey">The Unique Capabilities Key</param>
/// <param name="message">The <see cref="DirLandReplyMessage"/> event message containing the data</param>
/// <param name="simulator">The simulator the message originated from</param>
protected void DirLandReplyEventHandler ( string capsKey , IMessage message , Simulator simulator )
2009-09-27 20:19:45 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_DirLandReply ! = null )
2009-09-27 20:19:45 +00:00
{
List < DirectoryParcel > parcelsForSale = new List < DirectoryParcel > ( ) ;
DirLandReplyMessage reply = ( DirLandReplyMessage ) message ;
foreach ( DirLandReplyMessage . QueryReply block in reply . QueryReplies )
{
DirectoryParcel dirParcel = new DirectoryParcel ( ) ;
dirParcel . ActualArea = block . ActualArea ;
dirParcel . ID = block . ParcelID ;
dirParcel . Name = block . Name ;
dirParcel . SalePrice = block . SalePrice ;
dirParcel . Auction = block . Auction ;
2007-03-09 20:26:07 +00:00
dirParcel . ForSale = block . ForSale ;
parcelsForSale . Add ( dirParcel ) ;
}
2009-10-10 06:38:07 +00:00
OnDirLand ( new DirLandReplyEventArgs ( parcelsForSale ) ) ;
2007-03-09 20:26:07 +00:00
}
}
2007-04-23 01:39:14 +00:00
2009-10-28 08:01:52 +00:00
/// <summary>Process an incoming packet and raise the appropriate events</summary>
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void DirPeopleReplyHandler ( object sender , PacketReceivedEventArgs e )
2007-04-23 01:39:14 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_DirPeople ! = null )
2007-04-23 01:39:14 +00:00
{
2009-10-28 08:01:52 +00:00
DirPeopleReplyPacket peopleReply = e . Packet as DirPeopleReplyPacket ;
2007-04-23 01:39:14 +00:00
List < AgentSearchData > matches = new List < AgentSearchData > ( peopleReply . QueryReplies . Length ) ;
2009-08-24 14:23:02 +00:00
foreach ( DirPeopleReplyPacket . QueryRepliesBlock reply in peopleReply . QueryReplies )
{
2007-04-23 01:39:14 +00:00
AgentSearchData searchData = new AgentSearchData ( ) ;
searchData . Online = reply . Online ;
2008-08-12 22:38:02 +00:00
searchData . FirstName = Utils . BytesToString ( reply . FirstName ) ;
searchData . LastName = Utils . BytesToString ( reply . LastName ) ;
2007-04-23 01:39:14 +00:00
searchData . AgentID = reply . AgentID ;
matches . Add ( searchData ) ;
}
2009-10-10 06:38:07 +00:00
OnDirPeople ( new DirPeopleReplyEventArgs ( peopleReply . QueryData . QueryID , matches ) ) ;
2007-04-23 01:39:14 +00:00
}
}
2007-08-16 19:41:30 +00:00
2009-10-28 08:01:52 +00:00
/// <summary>Process an incoming packet and raise the appropriate events</summary>
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void DirGroupsReplyHandler ( object sender , PacketReceivedEventArgs e )
2007-08-16 19:41:30 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_DirGroups ! = null )
2007-08-16 19:41:30 +00:00
{
2009-10-28 08:01:52 +00:00
Packet packet = e . Packet ;
2009-10-10 06:38:07 +00:00
DirGroupsReplyPacket groupsReply = ( DirGroupsReplyPacket ) packet ;
2007-08-16 19:41:30 +00:00
List < GroupSearchData > matches = new List < GroupSearchData > ( groupsReply . QueryReplies . Length ) ;
foreach ( DirGroupsReplyPacket . QueryRepliesBlock reply in groupsReply . QueryReplies )
{
GroupSearchData groupsData = new GroupSearchData ( ) ;
groupsData . GroupID = reply . GroupID ;
2008-08-12 22:38:02 +00:00
groupsData . GroupName = Utils . BytesToString ( reply . GroupName ) ;
2007-08-16 19:41:30 +00:00
groupsData . Members = reply . Members ;
matches . Add ( groupsData ) ;
}
2009-10-10 06:38:07 +00:00
OnDirGroups ( new DirGroupsReplyEventArgs ( groupsReply . QueryData . QueryID , matches ) ) ;
2007-08-16 19:41:30 +00:00
}
}
2007-08-20 20:38:36 +00:00
2009-10-10 06:38:07 +00:00
/// <summary>Process an incoming <see cref="PlacesReplyMessage"/> event message</summary>
/// <param name="capsKey">The Unique Capabilities Key</param>
/// <param name="message">The <see cref="PlacesReplyMessage"/> event message containing the data</param>
/// <param name="simulator">The simulator the message originated from</param>
protected void PlacesReplyEventHandler ( string capsKey , IMessage message , Simulator simulator )
2009-05-09 22:46:38 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_Places ! = null )
2009-05-09 22:46:38 +00:00
{
2009-08-24 14:23:02 +00:00
PlacesReplyMessage replyMessage = ( PlacesReplyMessage ) message ;
2009-05-09 22:46:38 +00:00
List < PlacesSearchData > places = new List < PlacesSearchData > ( ) ;
2009-08-24 14:23:02 +00:00
for ( int i = 0 ; i < replyMessage . QueryDataBlocks . Length ; i + + )
2009-05-09 22:46:38 +00:00
{
PlacesSearchData place = new PlacesSearchData ( ) ;
place . ActualArea = replyMessage . QueryDataBlocks [ i ] . ActualArea ;
place . BillableArea = replyMessage . QueryDataBlocks [ i ] . BillableArea ;
place . Desc = replyMessage . QueryDataBlocks [ i ] . Description ;
place . Dwell = replyMessage . QueryDataBlocks [ i ] . Dwell ;
2009-10-10 06:38:07 +00:00
place . Flags = ( DirectoryManager . PlacesFlags ) ( byte ) replyMessage . QueryDataBlocks [ i ] . Flags ;
2009-05-09 22:46:38 +00:00
place . GlobalX = replyMessage . QueryDataBlocks [ i ] . GlobalX ;
place . GlobalY = replyMessage . QueryDataBlocks [ i ] . GlobalY ;
place . GlobalZ = replyMessage . QueryDataBlocks [ i ] . GlobalZ ;
place . Name = replyMessage . QueryDataBlocks [ i ] . Name ;
place . OwnerID = replyMessage . QueryDataBlocks [ i ] . OwnerID ;
place . Price = replyMessage . QueryDataBlocks [ i ] . Price ;
place . SimName = replyMessage . QueryDataBlocks [ i ] . SimName ;
place . SnapshotID = replyMessage . QueryDataBlocks [ i ] . SnapShotID ;
2009-10-10 06:38:07 +00:00
place . SKU = replyMessage . QueryDataBlocks [ i ] . ProductSku ;
2009-05-09 22:46:38 +00:00
places . Add ( place ) ;
}
2009-10-10 06:38:07 +00:00
OnPlaces ( new PlacesReplyEventArgs ( replyMessage . QueryID , places ) ) ;
2009-05-09 22:46:38 +00:00
}
}
2009-10-28 08:01:52 +00:00
/// <summary>Process an incoming packet and raise the appropriate events</summary>
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void PlacesReplyHandler ( object sender , PacketReceivedEventArgs e )
2007-08-20 20:38:36 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_Places ! = null )
2007-08-20 20:38:36 +00:00
{
2009-10-28 08:01:52 +00:00
Packet packet = e . Packet ;
2007-08-20 20:38:36 +00:00
PlacesReplyPacket placesReply = packet as PlacesReplyPacket ;
List < PlacesSearchData > places = new List < PlacesSearchData > ( ) ;
foreach ( PlacesReplyPacket . QueryDataBlock block in placesReply . QueryData )
{
PlacesSearchData place = new PlacesSearchData ( ) ;
place . OwnerID = block . OwnerID ;
2008-08-12 22:38:02 +00:00
place . Name = Utils . BytesToString ( block . Name ) ;
place . Desc = Utils . BytesToString ( block . Desc ) ;
2007-08-20 20:38:36 +00:00
place . ActualArea = block . ActualArea ;
place . BillableArea = block . BillableArea ;
2009-10-10 06:38:07 +00:00
place . Flags = ( PlacesFlags ) block . Flags ;
2007-08-20 20:38:36 +00:00
place . GlobalX = block . GlobalX ;
place . GlobalY = block . GlobalY ;
place . GlobalZ = block . GlobalZ ;
2008-08-12 22:38:02 +00:00
place . SimName = Utils . BytesToString ( block . SimName ) ;
2007-08-20 20:38:36 +00:00
place . SnapshotID = block . SnapshotID ;
place . Dwell = block . Dwell ;
place . Price = block . Price ;
2009-08-24 14:23:02 +00:00
2007-08-20 20:38:36 +00:00
places . Add ( place ) ;
}
2009-10-10 06:38:07 +00:00
OnPlaces ( new PlacesReplyEventArgs ( placesReply . TransactionData . TransactionID , places ) ) ;
2007-08-20 20:38:36 +00:00
}
}
2007-11-30 23:19:05 +00:00
2009-10-28 08:01:52 +00:00
/// <summary>Process an incoming packet and raise the appropriate events</summary>
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void EventsReplyHandler ( object sender , PacketReceivedEventArgs e )
2008-01-01 00:29:51 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_DirEvents ! = null )
2008-01-01 00:29:51 +00:00
{
2009-10-28 08:01:52 +00:00
Packet packet = e . Packet ;
2009-10-10 06:38:07 +00:00
DirEventsReplyPacket eventsReply = ( DirEventsReplyPacket ) packet ;
2008-01-01 00:29:51 +00:00
List < EventsSearchData > matches = new List < EventsSearchData > ( eventsReply . QueryReplies . Length ) ;
foreach ( DirEventsReplyPacket . QueryRepliesBlock reply in eventsReply . QueryReplies )
{
EventsSearchData eventsData = new EventsSearchData ( ) ;
eventsData . Owner = reply . OwnerID ;
2008-08-12 22:38:02 +00:00
eventsData . Name = Utils . BytesToString ( reply . Name ) ;
2008-01-01 00:29:51 +00:00
eventsData . ID = reply . EventID ;
2008-08-12 22:38:02 +00:00
eventsData . Date = Utils . BytesToString ( reply . Date ) ;
2008-01-01 00:29:51 +00:00
eventsData . Time = reply . UnixTime ;
eventsData . Flags = ( EventFlags ) reply . EventFlags ;
matches . Add ( eventsData ) ;
}
2009-10-10 06:38:07 +00:00
OnDirEvents ( new DirEventsReplyEventArgs ( eventsReply . QueryData . QueryID , matches ) ) ;
2008-01-01 00:29:51 +00:00
}
}
2009-08-24 14:23:02 +00:00
2009-10-28 08:01:52 +00:00
/// <summary>Process an incoming packet and raise the appropriate events</summary>
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void EventInfoReplyHandler ( object sender , PacketReceivedEventArgs e )
2008-01-01 00:29:51 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_EventInfoReply ! = null )
2008-01-01 00:29:51 +00:00
{
2009-10-28 08:01:52 +00:00
Packet packet = e . Packet ;
2008-01-01 00:29:51 +00:00
EventInfoReplyPacket eventReply = ( EventInfoReplyPacket ) packet ;
EventInfo evinfo = new EventInfo ( ) ;
evinfo . ID = eventReply . EventData . EventID ;
2008-08-12 22:38:02 +00:00
evinfo . Name = Utils . BytesToString ( eventReply . EventData . Name ) ;
evinfo . Desc = Utils . BytesToString ( eventReply . EventData . Desc ) ;
2008-01-01 00:29:51 +00:00
evinfo . Amount = eventReply . EventData . Amount ;
2008-10-06 22:34:38 +00:00
evinfo . Category = ( EventCategories ) Utils . BytesToUInt ( eventReply . EventData . Category ) ;
2008-01-01 00:29:51 +00:00
evinfo . Cover = eventReply . EventData . Cover ;
2008-08-12 22:38:02 +00:00
evinfo . Creator = ( UUID ) Utils . BytesToString ( eventReply . EventData . Creator ) ;
evinfo . Date = Utils . BytesToString ( eventReply . EventData . Date ) ;
2008-01-01 00:29:51 +00:00
evinfo . DateUTC = eventReply . EventData . DateUTC ;
evinfo . Duration = eventReply . EventData . Duration ;
evinfo . Flags = ( EventFlags ) eventReply . EventData . EventFlags ;
2008-08-12 22:38:02 +00:00
evinfo . SimName = Utils . BytesToString ( eventReply . EventData . SimName ) ;
2008-01-01 00:29:51 +00:00
evinfo . GlobalPos = eventReply . EventData . GlobalPos ;
2009-10-10 06:38:07 +00:00
OnEventInfo ( new EventInfoReplyEventArgs ( evinfo ) ) ;
2008-01-01 00:29:51 +00:00
}
}
2009-10-28 08:01:52 +00:00
/// <summary>Process an incoming packet and raise the appropriate events</summary>
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void DirPlacesReplyHandler ( object sender , PacketReceivedEventArgs e )
2009-08-24 14:23:02 +00:00
{
2009-10-10 06:38:07 +00:00
if ( m_DirPlaces ! = null )
2009-08-24 14:23:02 +00:00
{
2009-10-28 08:01:52 +00:00
Packet packet = e . Packet ;
2009-08-24 14:23:02 +00:00
DirPlacesReplyPacket reply = ( DirPlacesReplyPacket ) packet ;
List < DirectoryParcel > result = new List < DirectoryParcel > ( ) ;
for ( int i = 0 ; i < reply . QueryReplies . Length ; i + + )
{
DirectoryParcel p = new DirectoryParcel ( ) ;
p . ID = reply . QueryReplies [ i ] . ParcelID ;
p . Name = Utils . BytesToString ( reply . QueryReplies [ i ] . Name ) ;
p . Dwell = reply . QueryReplies [ i ] . Dwell ;
p . Auction = reply . QueryReplies [ i ] . Auction ;
2009-10-10 06:38:07 +00:00
p . ForSale = reply . QueryReplies [ i ] . ForSale ;
2009-08-24 14:23:02 +00:00
result . Add ( p ) ;
}
2009-10-10 06:38:07 +00:00
OnDirPlaces ( new DirPlacesReplyEventArgs ( reply . QueryData [ 0 ] . QueryID , result ) ) ;
2009-08-24 14:23:02 +00:00
}
}
2007-11-30 23:19:05 +00:00
#endregion Packet Handlers
2007-03-09 20:26:07 +00:00
}
2009-10-10 06:38:07 +00:00
#region DirectoryManager EventArgs Classes
/// <summary>Contains the Event data returned from the data server from an EventInfoRequest</summary>
public class EventInfoReplyEventArgs : EventArgs
{
private readonly DirectoryManager . EventInfo m_MatchedEvent ;
/// <summary>
/// A single EventInfo object containing the details of an event
/// </summary>
public DirectoryManager . EventInfo MatchedEvent { get { return m_MatchedEvent ; } }
/// <summary>Construct a new instance of the EventInfoReplyEventArgs class</summary>
/// <param name="matchedEvent">A single EventInfo object containing the details of an event</param>
public EventInfoReplyEventArgs ( DirectoryManager . EventInfo matchedEvent )
{
this . m_MatchedEvent = matchedEvent ;
}
}
/// <summary>Contains the "Event" detail data returned from the data server</summary>
public class DirEventsReplyEventArgs : EventArgs
{
private readonly UUID m_QueryID ;
/// <summary>The ID returned by <see cref="DirectoryManager.StartEventsSearch"/></summary>
public UUID QueryID { get { return m_QueryID ; } }
private readonly List < DirectoryManager . EventsSearchData > m_matchedEvents ;
/// <summary>A list of "Events" returned by the data server</summary>
public List < DirectoryManager . EventsSearchData > MatchedEvents { get { return m_matchedEvents ; } }
/// <summary>Construct a new instance of the DirEventsReplyEventArgs class</summary>
/// <param name="queryID">The ID of the query returned by the data server.
/// This will correlate to the ID returned by the <see cref="StartEventsSearch"/> method</param>
/// <param name="matchedEvents">A list containing the "Events" returned by the search query</param>
public DirEventsReplyEventArgs ( UUID queryID , List < DirectoryManager . EventsSearchData > matchedEvents )
{
this . m_QueryID = queryID ;
this . m_matchedEvents = matchedEvents ;
}
}
/// <summary>Contains the "Event" list data returned from the data server</summary>
public class PlacesReplyEventArgs : EventArgs
{
private readonly UUID m_QueryID ;
/// <summary>The ID returned by <see cref="DirectoryManager.StartPlacesSearch"/></summary>
public UUID QueryID { get { return m_QueryID ; } }
private readonly List < DirectoryManager . PlacesSearchData > m_MatchedPlaces ;
/// <summary>A list of "Places" returned by the data server</summary>
public List < DirectoryManager . PlacesSearchData > MatchedPlaces { get { return m_MatchedPlaces ; } }
2009-10-10 07:19:26 +00:00
/// <summary>Construct a new instance of PlacesReplyEventArgs class</summary>
2009-10-10 06:38:07 +00:00
/// <param name="queryID">The ID of the query returned by the data server.
/// This will correlate to the ID returned by the <see cref="StartPlacesSearch"/> method</param>
/// <param name="matchedPlaces">A list containing the "Places" returned by the data server query</param>
public PlacesReplyEventArgs ( UUID queryID , List < DirectoryManager . PlacesSearchData > matchedPlaces )
{
this . m_QueryID = queryID ;
this . m_MatchedPlaces = matchedPlaces ;
}
}
/// <summary>Contains the places data returned from the data server</summary>
public class DirPlacesReplyEventArgs : EventArgs
{
private readonly UUID m_QueryID ;
/// <summary>The ID returned by <see cref="DirectoryManager.StartDirPlacesSearch"/></summary>
public UUID QueryID { get { return m_QueryID ; } }
private readonly List < DirectoryManager . DirectoryParcel > m_MatchedParcels ;
/// <summary>A list containing Places data returned by the data server</summary>
public List < DirectoryManager . DirectoryParcel > MatchedParcels { get { return m_MatchedParcels ; } }
2009-10-10 07:19:26 +00:00
/// <summary>Construct a new instance of the DirPlacesReplyEventArgs class</summary>
2009-10-10 06:38:07 +00:00
/// <param name="queryID">The ID of the query returned by the data server.
/// This will correlate to the ID returned by the <see cref="StartDirPlacesSearch"/> method</param>
2009-10-10 07:19:26 +00:00
/// <param name="matchedParcels">A list containing land data returned by the data server</param>
2009-10-10 06:38:07 +00:00
public DirPlacesReplyEventArgs ( UUID queryID , List < DirectoryManager . DirectoryParcel > matchedParcels )
{
this . m_QueryID = queryID ;
this . m_MatchedParcels = matchedParcels ;
}
}
/// <summary>Contains the classified data returned from the data server</summary>
public class DirClassifiedsReplyEventArgs : EventArgs
{
private readonly List < DirectoryManager . Classified > m_Classifieds ;
2009-10-10 07:19:26 +00:00
/// <summary>A list containing Classified Ads returned by the data server</summary>
2009-10-10 06:38:07 +00:00
public List < DirectoryManager . Classified > Classifieds { get { return m_Classifieds ; } }
2009-10-10 07:19:26 +00:00
/// <summary>Construct a new instance of the DirClassifiedsReplyEventArgs class</summary>
/// <param name="classifieds">A list of classified ad data returned from the data server</param>
2009-10-10 06:38:07 +00:00
public DirClassifiedsReplyEventArgs ( List < DirectoryManager . Classified > classifieds )
{
this . m_Classifieds = classifieds ;
}
}
/// <summary>Contains the group data returned from the data server</summary>
public class DirGroupsReplyEventArgs : EventArgs
{
private readonly UUID m_QueryID ;
/// <summary>The ID returned by <see cref="DirectoryManager.StartGroupSearch"/></summary>
public UUID QueryID { get { return m_QueryID ; } }
private readonly List < DirectoryManager . GroupSearchData > m_matchedGroups ;
2009-10-10 07:19:26 +00:00
/// <summary>A list containing Groups data returned by the data server</summary>
2009-10-10 06:38:07 +00:00
public List < DirectoryManager . GroupSearchData > MatchedGroups { get { return m_matchedGroups ; } }
2009-10-10 07:19:26 +00:00
/// <summary>Construct a new instance of the DirGroupsReplyEventArgs class</summary>
/// <param name="queryID">The ID of the query returned by the data server.
/// This will correlate to the ID returned by the <see cref="StartGroupSearch"/> method</param>
/// <param name="matchedGroups">A list of groups data returned by the data server</param>
2009-10-10 06:38:07 +00:00
public DirGroupsReplyEventArgs ( UUID queryID , List < DirectoryManager . GroupSearchData > matchedGroups )
{
this . m_QueryID = queryID ;
this . m_matchedGroups = matchedGroups ;
}
}
/// <summary>Contains the people data returned from the data server</summary>
public class DirPeopleReplyEventArgs : EventArgs
{
private readonly UUID m_QueryID ;
/// <summary>The ID returned by <see cref="DirectoryManager.StartPeopleSearch"/></summary>
public UUID QueryID { get { return m_QueryID ; } }
private readonly List < DirectoryManager . AgentSearchData > m_MatchedPeople ;
2009-10-10 07:19:26 +00:00
/// <summary>A list containing People data returned by the data server</summary>
2009-10-10 06:38:07 +00:00
public List < DirectoryManager . AgentSearchData > MatchedPeople { get { return m_MatchedPeople ; } }
2009-10-10 07:19:26 +00:00
/// <summary>Construct a new instance of the DirPeopleReplyEventArgs class</summary>
/// <param name="queryID">The ID of the query returned by the data server.
/// This will correlate to the ID returned by the <see cref="StartPeopleSearch"/> method</param>
/// <param name="matchedPeople">A list of people data returned by the data server</param>
2009-10-10 06:38:07 +00:00
public DirPeopleReplyEventArgs ( UUID queryID , List < DirectoryManager . AgentSearchData > matchedPeople )
{
this . m_QueryID = queryID ;
this . m_MatchedPeople = matchedPeople ;
}
}
/// <summary>Contains the land sales data returned from the data server</summary>
public class DirLandReplyEventArgs : EventArgs
{
private readonly List < DirectoryManager . DirectoryParcel > m_DirParcels ;
2009-10-10 07:19:26 +00:00
/// <summary>A list containing land forsale data returned by the data server</summary>
2009-10-10 06:38:07 +00:00
public List < DirectoryManager . DirectoryParcel > DirParcels { get { return m_DirParcels ; } }
2009-10-10 07:19:26 +00:00
/// <summary>Construct a new instance of the DirLandReplyEventArgs class</summary>
/// <param name="dirParcels">A list of parcels for sale returned by the data server</param>
2009-10-10 06:38:07 +00:00
public DirLandReplyEventArgs ( List < DirectoryManager . DirectoryParcel > dirParcels )
{
this . m_DirParcels = dirParcels ;
}
}
#endregion
2007-03-09 20:26:07 +00:00
}