Пример #1
0
        }         // end Avatars_OnDirPeopleReply()

        /// <summary>
        /// name2key (avatar name to UUID)
        /// </summary>
        /// <param name="b">RESTbot object</param>
        /// <param name="name">Name of avatar to check</param>
        /// <returns>UUID of corresponding avatar, if it exists</returns>
        public static UUID getKey(RestBot b, String name)
        {
            DebugUtilities.WriteInfo("getKey(): Looking up key for " + name);
            b.Client.Directory.DirPeopleReply += Avatars_OnDirPeopleReply;
            name = name.ToLower();
            DebugUtilities.WriteDebug("getKey(): Looking up: " + name);
            DebugUtilities
            .WriteDebug("getKey(): Key not in cache, requesting directory lookup");                     // how do you know? (gwyneth 20220128)
            lock (KeyLookupEvents)
            {
                KeyLookupEvents.Add(name, new AutoResetEvent(false));
            }
            DebugUtilities
            .WriteDebug("getKey(): Lookup Event added, KeyLookupEvents now has a total of " +
                        KeyLookupEvents.Count.ToString() +
                        " entries");
            DirFindQueryPacket find = new DirFindQueryPacket();

            find.AgentData.AgentID    = b.Client.Self.AgentID;          // was Network and not Self
            find.AgentData.SessionID  = b.Client.Self.SessionID;
            find.QueryData.QueryFlags = 1;

            //find.QueryData.QueryText = Helpers.StringToField(name);
            find.QueryData.QueryText  = Utils.StringToBytes(name);
            find.QueryData.QueryID    = new UUID("00000000000000000000000000000001");
            find.QueryData.QueryStart = 0;

            b.Client.Network.SendPacket((Packet)find);
            DebugUtilities
            .WriteDebug("getKey(): Packet sent - KLE has " +
                        KeyLookupEvents.Count.ToString() +
                        " entries.. now waiting");
            if (!KeyLookupEvents[name].WaitOne(15000, true))
            {
                DebugUtilities
                .WriteWarning("getKey(): timed out on avatar name lookup for " +
                              name);
            }
            DebugUtilities.WriteDebug("getKey(): Waiting done!");
            lock (KeyLookupEvents)
            {
                KeyLookupEvents.Remove(name);
            }
            DebugUtilities
            .WriteDebug($"getKey(): Done with KLE, now has {KeyLookupEvents.Count.ToString()} entries");
            UUID response = new UUID();             // hopefully this sets the response to UUID.Zero first... (gwyneth 20220128)

            if (avatarKeys.ContainsKey(name))
            {
                response = avatarKeys[name];
                lock (avatarKeys)
                {
                    avatarKeys.Remove(name);
                }
            }
            b.Client.Directory.DirPeopleReply -= Avatars_OnDirPeopleReply;
            return(response);
        }         // end getKey()
Пример #2
0
        public LLUUID StartGroupSearch(DirFindFlags findFlags, string searchText, int queryStart, LLUUID queryID)
        {
            DirFindQueryPacket find = new DirFindQueryPacket();

            find.AgentData.AgentID    = Client.Self.AgentID;
            find.AgentData.SessionID  = Client.Self.SessionID;
            find.QueryData.QueryFlags = (uint)findFlags;
            find.QueryData.QueryText  = Helpers.StringToField(searchText);
            find.QueryData.QueryID    = queryID;
            find.QueryData.QueryStart = queryStart;
            Client.Network.SendPacket(find);
            return(queryID);
        }
Пример #3
0
        public UUID StartPeopleSearch(DirFindFlags findFlags, string searchText, int queryStart, UUID queryID)
        {
            DirFindQueryPacket find = new DirFindQueryPacket();

            find.AgentData.AgentID    = Client.Self.AgentID;
            find.AgentData.SessionID  = Client.Self.SessionID;
            find.QueryData.QueryFlags = (uint)findFlags;
            find.QueryData.QueryText  = Utils.StringToBytes(searchText);
            find.QueryData.QueryID    = queryID;
            find.QueryData.QueryStart = queryStart;

            Client.Network.SendPacket(find);

            return(queryID);
        }
Пример #4
0
        /// <summary>
        /// Search Events - ALL options
        /// </summary>
        /// <param name="searchText">string text to search for e.g.: live music</param>
        /// <param name="showMature">Include mature events in results</param>
        /// <param name="eventDay">"u" for now and upcoming events, -or- number of days since/until event is scheduled
        /// For example "0" = Today, "1" = tomorrow, "2" = following day, "-1" = yesterday, etc.</param>
        /// <param name="queryStart">Page # to show, 0 for First Page</param>
        /// <param name="category">EventCategory event is listed under.</param>
        /// <param name="queryID">a LLUUID that can be used to track queries with results.</param>
        /// <returns>UUID of query to correlate results in callback.</returns>
        public LLUUID StartEventsSearch(string searchText, bool showMature, string eventDay, uint queryStart, EventCategories category, LLUUID queryID)
        {
            DirFindQueryPacket find = new DirFindQueryPacket();

            find.AgentData.AgentID   = Client.Self.AgentID;
            find.AgentData.SessionID = Client.Self.SessionID;

            find.QueryData.QueryID    = queryID;
            find.QueryData.QueryText  = Helpers.StringToField(eventDay + "|" + (int)category + "|" + searchText);
            find.QueryData.QueryFlags = showMature ? (uint)32 : (uint)8224;
            find.QueryData.QueryStart = (int)queryStart;

            Client.Network.SendPacket(find);
            return(queryID);
        }
Пример #5
0
        /// <summary>
        /// name2key (avatar name to UUID)
        /// </summary>
        /// <param name="b">RESTbot object</param>
        /// <param name="name">Name of avatar to check</param>
        /// <returns>UUID of corresponding avatar, if it exists</returns>
        public UUID getKey(RestBot b, String name)
        {
            DebugUtilities
            .WriteInfo($"{session} {MethodName} Looking up key for {name}");
            name = name.ToLower();
            DebugUtilities.WriteDebug($"Looking up: {name}");
            DebugUtilities
            .WriteDebug("Key not in cache, requesting directory lookup");
            lock (KeyLookupEvents)
            {
                KeyLookupEvents.Add(name, new AutoResetEvent(false));
            }
            DebugUtilities
            .WriteDebug($"Lookup Event added, KeyLookupEvents now has a total of {KeyLookupEvents.Count.ToString()} entries");
            DirFindQueryPacket find = new DirFindQueryPacket();

            find.AgentData.AgentID    = b.Client.Self.AgentID;          // was Network and not Self
            find.AgentData.SessionID  = b.Client.Self.SessionID;
            find.QueryData.QueryFlags = 1;

            //find.QueryData.QueryText = Helpers.StringToField(name);
            find.QueryData.QueryText  = Utils.StringToBytes(name);
            find.QueryData.QueryID    = new UUID("00000000000000000000000000000001");
            find.QueryData.QueryStart = 0;

            b.Client.Network.SendPacket((Packet)find);
            DebugUtilities
            .WriteDebug($"Packet sent - KLE has {KeyLookupEvents.Count.ToString()} entries... now waiting");
            KeyLookupEvents[name].WaitOne(15000, true);
            DebugUtilities.WriteDebug("Waiting done!");
            lock (KeyLookupEvents)
            {
                KeyLookupEvents.Remove(name);
            }
            DebugUtilities
            .WriteDebug($"Done with KLE, now has {KeyLookupEvents.Count.ToString()} entries");
            UUID response = new UUID();

            if (avatarKeys.ContainsKey(name))
            {
                response = avatarKeys[name];
                lock (avatarKeys)
                {
                    avatarKeys.Remove(name);
                }
            }
            return(response);
        }
Пример #6
0
        private void cmdFind_Click(object sender, System.EventArgs e)
        {
            lstFind.Items.Clear();

            DirFindQueryPacket query = new DirFindQueryPacket();

            query.AgentData.AgentID    = client.Network.AgentID;
            query.AgentData.SessionID  = client.Network.SessionID;
            query.QueryData.QueryFlags = 1;
            query.QueryData.QueryID    = LLUUID.GenerateUUID();
            query.QueryData.QueryStart = 0;
            query.QueryData.QueryText  = Helpers.StringToField(txtFind.Text);
            query.Header.Reliable      = true;

            client.Network.SendPacket((Packet)query);
        }
        private void cmdFind_Click(object sender, System.EventArgs e)
        {
            lstFind.Items.Clear();

            DirFindQueryPacket query = new DirFindQueryPacket();

            query.AgentData.AgentID    = Client.Self.AgentID;
            query.AgentData.SessionID  = Client.Self.SessionID;
            query.QueryData.QueryFlags = 1;
            query.QueryData.QueryID    = UUID.Random();
            query.QueryData.QueryStart = 0;
            query.QueryData.QueryText  = Utils.StringToBytes(txtFind.Text);
            query.Header.Reliable      = true;

            Client.Network.SendPacket(query);
        }
Пример #8
0
        static void Main(string[] args)
        {
            SecondLife client;

            if (args.Length < 5)
            {
                Console.WriteLine("Usage: name2key [loginfirstname] [loginlastname] [password] [firstname] [lastname]");
                return;
            }

            client = new SecondLife();

            // Setup the callback
            client.Network.RegisterCallback(PacketType.DirPeopleReply, new PacketCallback(QueryHandler));

            // Setup the login values
            Dictionary <string, object> loginParams = NetworkManager.DefaultLoginValues(args[0], args[1], args[2],
                                                                                        "00:00:00:00:00:00", "last", "Win", "0", "name2key", "*****@*****.**");

            if (!client.Network.Login(loginParams))
            {
                // Login failed
                Console.WriteLine("ERROR: " + client.Network.LoginError);
                return;
            }

            // Send the Query
            DirFindQueryPacket find = new DirFindQueryPacket();

            find.AgentData.AgentID    = client.Network.AgentID;
            find.AgentData.SessionID  = client.Network.SessionID;
            find.QueryData.QueryFlags = 1;
            find.QueryData.QueryText  = Helpers.StringToField(args[3] + " " + args[4]);
            find.QueryData.QueryID    = new LLUUID("00000000000000000000000000000001");
            find.QueryData.QueryStart = 0;

            client.Network.SendPacket((Packet)find);

            while (waiting)
            {
                client.Tick();
            }

            client.Network.Logout();
        }
        /// <summary>
        /// Search the People directory for other avatars
        /// </summary>
        /// <param name="searchText">The name or portion of the name of the avatar you wish to search for</param>
        /// <param name="queryStart"></param>
        /// <returns></returns>
        public UUID StartPeopleSearch(string searchText, int queryStart)
        {
            DirFindQueryPacket find = new DirFindQueryPacket();
            find.AgentData.AgentID = Client.Self.AgentID;
            find.AgentData.SessionID = Client.Self.SessionID;
            find.QueryData.QueryFlags = (uint)DirFindFlags.People;
            find.QueryData.QueryText = Utils.StringToBytes(searchText);
            find.QueryData.QueryID = UUID.Random();
            find.QueryData.QueryStart = queryStart;

            Client.Network.SendPacket(find);

            return find.QueryData.QueryID;
        }
        /// <summary>
        /// Search Events
        /// </summary>
        /// <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
        /// For example "0" = Today, "1" = tomorrow, "2" = following day, "-1" = yesterday, etc.</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>
        /// <param name="category">EventCategory event is listed under.</param>
        /// <returns>UUID of query to correlate results in callback.</returns>
        public UUID StartEventsSearch(string searchText, DirFindFlags queryFlags, string eventDay, uint queryStart, EventCategories category)
        {
            DirFindQueryPacket find = new DirFindQueryPacket();
            find.AgentData.AgentID = Client.Self.AgentID;
            find.AgentData.SessionID = Client.Self.SessionID;

            UUID queryID = UUID.Random();

            find.QueryData.QueryID = queryID;
            find.QueryData.QueryText = Utils.StringToBytes(eventDay + "|" + (int)category + "|" + searchText);
            find.QueryData.QueryFlags = (uint)queryFlags;
            find.QueryData.QueryStart = (int)queryStart;

            Client.Network.SendPacket(find);
            return queryID;
        }
        private void cmdFind_Click(object sender, System.EventArgs e)
        {
            lstFind.Items.Clear();

            DirFindQueryPacket query = new DirFindQueryPacket();
            query.AgentData.AgentID = client.Network.AgentID;
            query.AgentData.SessionID = client.Network.SessionID;
            query.QueryData.QueryFlags = 1;
            query.QueryData.QueryID = LLUUID.Random();
            query.QueryData.QueryStart = 0;
            query.QueryData.QueryText = Helpers.StringToField(txtFind.Text);
            query.Header.Reliable = true;

            client.Network.SendPacket((Packet)query);
        }
        private void cmdFind_Click(object sender, System.EventArgs e)
        {
            lstFind.Items.Clear();

            DirFindQueryPacket query = new DirFindQueryPacket();
            query.AgentData.AgentID = Client.Self.AgentID;
            query.AgentData.SessionID = Client.Self.SessionID;
            query.QueryData.QueryFlags = 1;
            query.QueryData.QueryID = UUID.Random();
            query.QueryData.QueryStart = 0;
            query.QueryData.QueryText = Utils.StringToBytes(txtFind.Text);
            query.Header.Reliable = true;

            Client.Network.SendPacket(query);
        }
Пример #13
0
 public UUID StartGroupSearch(DirFindFlags findFlags, string searchText, int queryStart, UUID queryID)
 {
     DirFindQueryPacket find = new DirFindQueryPacket();
     find.AgentData.AgentID = Network.AgentID;
     find.AgentData.SessionID = Network.SessionID;
     find.QueryData.QueryFlags = (uint)findFlags;
     find.QueryData.QueryText = Utils.StringToBytes(searchText);
     find.QueryData.QueryID = queryID;
     find.QueryData.QueryStart = queryStart;
     Network.SendPacket(find);
     return queryID;
 }
Пример #14
0
        /// <summary>
        /// Search Events - ALL options
        /// </summary>
        /// <param name="searchText">string text to search for e.g.: live music</param>
        /// <param name="showMature">Include mature events in results</param>
        /// <param name="eventDay">"u" for now and upcoming events, -or- number of days since/until event is scheduled
        /// For example "0" = Today, "1" = tomorrow, "2" = following day, "-1" = yesterday, etc.</param>
        /// <param name="queryStart">Page # to show, 0 for First Page</param>
        /// <param name="category">EventCategory event is listed under.</param>
        /// <param name="queryID">a Guid that can be used to track queries with results.</param>
        /// <returns>Guid of query to correlate results in callback.</returns>
        public Guid StartEventsSearch(string searchText, bool showMature, string eventDay, uint queryStart, EventCategories category, Guid queryID)
        {
            DirFindQueryPacket find = new DirFindQueryPacket();
            find.AgentData.AgentID = Client.Self.AgentID;
            find.AgentData.SessionID = Client.Self.SessionID;
            
            find.QueryData.QueryID = queryID;
            find.QueryData.QueryText = Utils.StringToBytes(eventDay + "|" + (int)category + "|" + searchText);
            find.QueryData.QueryFlags = showMature ? (uint)32 : (uint)8224;
            find.QueryData.QueryStart = (int)queryStart;

            Client.Network.SendPacket(find);
            return queryID;
        }
Пример #15
0
        public Guid StartPeopleSearch(DirFindFlags findFlags, string searchText, int queryStart, Guid queryID)
        {
            DirFindQueryPacket find = new DirFindQueryPacket();
            find.AgentData.AgentID = Client.Self.AgentID;
            find.AgentData.SessionID = Client.Self.SessionID;
            find.QueryData.QueryFlags = (uint)findFlags;
            find.QueryData.QueryText = Utils.StringToBytes(searchText);
            find.QueryData.QueryID = queryID;
            find.QueryData.QueryStart = queryStart;

            Client.Network.SendPacket(find);

            return queryID;
        }
Пример #16
0
        static void Main(string[] args)
        {
            SecondLife client;

            if (args.Length < 5)
            {
                Console.WriteLine("Usage: name2key [loginfirstname] [loginlastname] [password] [firstname] [lastname]");
                return;
            }

            client = new SecondLife();

            // Setup the callback
            client.Network.RegisterCallback(PacketType.DirPeopleReply, new PacketCallback(QueryHandler));

            // Setup the login values
            Dictionary<string, object> loginParams = NetworkManager.DefaultLoginValues(args[0], args[1], args[2],
                "00:00:00:00:00:00", "last", "Win", "0", "name2key", "*****@*****.**");

            if (!client.Network.Login(loginParams))
            {
                // Login failed
                Console.WriteLine("ERROR: " + client.Network.LoginError);
                return;
            }

            // Send the Query
            DirFindQueryPacket find = new DirFindQueryPacket();
            find.AgentData.AgentID = client.Network.AgentID;
            find.AgentData.SessionID = client.Network.SessionID;
            find.QueryData.QueryFlags = 1;
            find.QueryData.QueryText = Helpers.StringToField(args[3] + " " + args[4]);
            find.QueryData.QueryID = new LLUUID("00000000000000000000000000000001");
            find.QueryData.QueryStart = 0;

            client.Network.SendPacket((Packet)find);

            while (waiting)
            {
                client.Tick();
            }

            client.Network.Logout();
        }
Пример #17
0
        public LLUUID StartPeopleSearch(DirFindFlags findFlags, string searchText, int queryStart, LLUUID queryID)
        {
            DirFindQueryPacket find = new DirFindQueryPacket();
            find.AgentData.AgentID = Client.Self.AgentID;
            find.AgentData.SessionID = Client.Self.SessionID;
            find.QueryData.QueryFlags = (uint)findFlags;
            find.QueryData.QueryText = Helpers.StringToField(searchText);
            find.QueryData.QueryID = queryID;
            find.QueryData.QueryStart = queryStart;

            Client.Network.SendPacket(find);

            return queryID;
        }
Пример #18
0
        public UUID getKey(RestBot b, String name)
        {
            DebugUtilities.WriteInfo(session + " " + MethodName + " Looking up key for " + name);
            name = name.ToLower();
            DebugUtilities.WriteDebug("Looking up: " + name);
            DebugUtilities.WriteDebug("Key not in cache, requesting directory lookup");
            lock ( KeyLookupEvents) {
                KeyLookupEvents.Add(name, new AutoResetEvent(false));
            }
            DebugUtilities.WriteDebug("Lookup Event added, KeyLookupEvents now has a total of " + KeyLookupEvents.Count.ToString() + " entries");
            DirFindQueryPacket find = new DirFindQueryPacket();
            find.AgentData.AgentID = b.Client.Self.AgentID;	// was Network and not Self
            find.AgentData.SessionID = b.Client.Self.SessionID;
            find.QueryData.QueryFlags = 1;
            //find.QueryData.QueryText = Helpers.StringToField(name);
            find.QueryData.QueryText = Utils.StringToBytes(name);
            find.QueryData.QueryID = new UUID("00000000000000000000000000000001");
            find.QueryData.QueryStart = 0;

            b.Client.Network.SendPacket((Packet) find);
            DebugUtilities.WriteDebug("Packet sent - KLE has " + KeyLookupEvents.Count.ToString() + " entries.. now waiting");
            KeyLookupEvents[name].WaitOne(15000,true);
            DebugUtilities.WriteDebug("Waiting done!");
            lock (KeyLookupEvents) {
                KeyLookupEvents.Remove(name);
            }
            DebugUtilities.WriteDebug("Done with KLE, now has " + KeyLookupEvents.Count.ToString() + " entries");
            UUID response = new UUID();
            if ( avatarKeys.ContainsKey(name) ) {
                response = avatarKeys[name];
                lock ( avatarKeys ) {
                    avatarKeys.Remove(name);
                }
            }
            return response;
        }