예제 #1
0
 protected void Name2KeyEvent(object sender, DirPeopleReplyEventArgs e)
 {
     foreach (DirectoryManager.AgentSearchData pair in e.MatchedPeople)
     {
         AddAvatarToDB(pair.AgentID, "" + pair.FirstName + " " + pair.LastName + "");
     }
 }
예제 #2
0
        void Directory_DirPeopleReply(object sender, DirPeopleReplyEventArgs e)
        {
            if (e.QueryID != this.queryID)
            {
                return;
            }

            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => Directory_DirPeopleReply(sender, e)));
                return;
            }

            lvwFindPeople.BeginUpdate();

            foreach (DirectoryManager.AgentSearchData person in e.MatchedPeople)
            {
                string fullName = person.FirstName + " " + person.LastName;
                findPeopleResults.Add(fullName, person.AgentID);

                ListViewItem item = lvwFindPeople.Items.Add(fullName);
                item.SubItems.Add(person.Online ? "Yes" : "No");
            }

            lvwFindPeople.Sort();
            lvwFindPeople.EndUpdate();
        }
예제 #3
0
 public override void Directory_OnDirPeopleReply(object sender, DirPeopleReplyEventArgs e)
 {
     e.MatchedPeople.ForEach(data =>
     {
         AddName2Key(data.FirstName + " " + data.LastName, data.AgentID);
     });
 }
 private void Directory_OnDirPeopleReply(object sender, DirPeopleReplyEventArgs e)
 {
     BeginInvoke(new MethodInvoker(() =>
     {
         PeopleReply(e.QueryID, e.MatchedPeople);
     }));
 }
예제 #5
0
        //Separate thread
        private void Directory_OnDirPeopleReply(object sender, DirPeopleReplyEventArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke((MethodInvoker) delegate { Directory_OnDirPeopleReply(sender, e); });
                return;
            }

            BeginInvoke((MethodInvoker) delegate { PeopleReply(e.QueryID, e.MatchedPeople); });
        }
예제 #6
0
        private void KeyResolvHandler(object sender, DirPeopleReplyEventArgs e)
        {
            if (query != e.QueryID)
            {
                return;
            }

            resolvedMasterKey = e.MatchedPeople[0].AgentID;
            keyResolution.Set();
            query = UUID.Zero;
        }
예제 #7
0
        }         // end getName()

        /// <summary>
        /// Loop through all (pending) replies for UUID/Avatar names
        /// and process them if they contain any key we're looking for.
        /// </summary>
        /// <param name="sender">parameter ignored</param>
        /// <param name="e">List of UUID/Avatar names</param>
        /// <returns>void</returns>
        /// <remarks>using new Directory functionality</remarks>
        public static void Avatars_OnDirPeopleReply(
            object?sender,
            DirPeopleReplyEventArgs e
            )
        {
            if (e.MatchedPeople.Count < 1)
            {
                DebugUtilities
                .WriteWarning("Avatars_OnDirPeopleReply() - Error: empty people directory reply");
            }
            else
            {
                int replyCount = e.MatchedPeople.Count;

                DebugUtilities
                .WriteInfo("Avatars_OnDirPeopleReply() - Processing " +
                           replyCount.ToString() +
                           " DirPeople replies");
                for (int i = 0; i < replyCount; i++)
                {
                    string avatarName =
                        e.MatchedPeople[i].FirstName + " " + e.MatchedPeople[i].LastName;
                    UUID avatarKey = e.MatchedPeople[i].AgentID;
                    DebugUtilities
                    .WriteDebug("Avatars_OnDirPeopleReply() -  Reply " +
                                (i + 1).ToString() +
                                " of " +
                                replyCount.ToString() +
                                " Key : " +
                                avatarKey.ToString() +
                                " Name : " +
                                avatarName);

                    if (!avatarKeys.ContainsKey(avatarName))
                    {
                        /* || avatarKeys[avatarName] == null )	 // apparently dictionary entries cannot be null */
                        lock (avatarKeys)
                        {
                            avatarKeys[avatarName.ToLower()] = avatarKey;
                        }
                    }

                    lock (KeyLookupEvents)
                    {
                        if (KeyLookupEvents.ContainsKey(avatarName.ToLower()))
                        {
                            KeyLookupEvents[avatarName.ToLower()].Set();
                            DebugUtilities.WriteDebug(avatarName.ToLower() + " KLE set!");
                        }
                    }
                }
            }
        }         // end Avatars_OnDirPeopleReply()
예제 #8
0
 private void Directory_DirPeople(object sender, DirPeopleReplyEventArgs e)
 {
     if (e.MatchedPeople.Count > 0)
     {
         foreach (DirectoryManager.AgentSearchData agent in e.MatchedPeople)
         {
             WriteLine("{0} {1} ({2})", agent.FirstName, agent.LastName, agent.AgentID);
         }
     }
     else
     {
         WriteLine("Didn't find any people that matched your query :(");
     }
     waitQuery.Set();
 }
예제 #9
0
 void Directory_DirPeople(object sender, DirPeopleReplyEventArgs e)
 {
     if (e.MatchedPeople.Count > 0)
     {
         foreach (DirectoryManager.AgentSearchData agent in e.MatchedPeople)
         {
             Console.WriteLine("{0} {1} ({2})", agent.FirstName, agent.LastName, agent.AgentID);                   
         }
     }
     else
     {
         Console.WriteLine("Didn't find any people that matched your query :(");
     }
     waitQuery.Set();
 }
 private void PeopleSearchReply(object sender, DirPeopleReplyEventArgs e)
 {
     if (e.QueryID != QueryID)
     {
         return;
     }
     Importing.Client.Directory.DirPeopleReply -= PeopleSearchReply;
     foreach (var match in e.MatchedPeople)
     {
         if (match.FirstName + " " + match.LastName == NewName)
         {
             NewID = match.AgentID;
             return;
         }
     }
     WaitOnCreate.Set();
 }
예제 #11
0
        public void Directory_DirPeopleReply(object sender, DirPeopleReplyEventArgs e)
        {
            Hashtable item = new Hashtable();

            item.Add("MessageType", "DirPeopleReply");
            List <Hashtable> results = new List <Hashtable>();

            foreach (DirectoryManager.AgentSearchData person in e.MatchedPeople)
            {
                Hashtable result = new Hashtable();
                result.Add("AgentID", person.AgentID);
                result.Add("FirstName", person.FirstName);
                result.Add("LastName", person.LastName);
                results.Add(result);
            }
            item.Add("Results", results);
            enqueue(item);
        }
예제 #12
0
        /*
         * // obsoleted packet call
         * public void Avatars_OnDirPeopleReply(Packet packet, Simulator simulator)
         * {
         *      DirPeopleReplyPacket reply = (DirPeopleReplyPacket)packet;
         *      DebugUtilities.WriteDebug("Got DirPeopleReply!");
         *      if (reply.QueryReplies.Length < 1) {
         *              DebugUtilities.WriteWarning(session + " {MethodName + " Error - empty people directory reply");
         *      } else {
         *              int replyCount = reply.QueryReplies.Length;
         *              DebugUtilities.WriteInfo(session + " {MethodName + " Proccesing {replyCount.ToString() + " DirPeople replies");
         *              for ( int i = 0 ; i <  replyCount ; i++ ) {
         *                      string avatarName = Utils.BytesToString(reply.QueryReplies[i].FirstName) + " {Utils.BytesToString(reply.QueryReplies[i].LastName);
         *                      UUID avatarKey = reply.QueryReplies[i].AgentID;
         *                      DebugUtilities.WriteDebug(session + " {MethodName + " Reply {(i + 1).ToString() + " of {replyCount.ToString() + " Key : {avatarKey.ToString() + " Name : {avatarName);
         *
         *                      if ( !avatarKeys.ContainsKey(avatarName) ) // || avatarKeys[avatarName] == null ) { // apparently dictionary entries cannot be null
         *                              lock ( avatarKeys ) {
         *                                      avatarKeys[avatarName.ToLower()] = avatarKey;
         *                              }
         *                      }
         *
         *                      lock(KeyLookupEvents)
         *                      {
         *                               if ( KeyLookupEvents.ContainsKey(avatarName.ToLower())) {
         *                                               KeyLookupEvents[avatarName.ToLower()].Set();
         *                                      DebugUtilities.WriteDebug(avatarName.ToLower() + " KLE set!");
         *                               }
         *                      }
         *              }
         *      }
         * } */
        /// <summary>
        /// Loop through all (pending) replies for UUID/Avatar names
        /// and process them if they contain any key we're looking for.
        /// </summary>
        /// <param name="sender">parameter ignored</param>
        /// <param name="e">List of UUID/Avatar names</param>
        /// <returns>void</returns>
        /// <remarks>using new Directory functionality</remarks>
        public void Avatars_OnDirPeopleReply(
            object?sender,
            DirPeopleReplyEventArgs e
            )
        {
            if (e.MatchedPeople.Count < 1)
            {
                DebugUtilities
                .WriteWarning($"{session} {MethodName} Error - empty people directory reply");
            }
            else
            {
                int replyCount = e.MatchedPeople.Count;

                DebugUtilities
                .WriteInfo($"{session} {MethodName} Processing {replyCount.ToString()} DirPeople replies");
                for (int i = 0; i < replyCount; i++)
                {
                    string avatarName = e.MatchedPeople[i].FirstName + e.MatchedPeople[i].LastName;
                    UUID   avatarKey  = e.MatchedPeople[i].AgentID;
                    DebugUtilities
                    .WriteDebug($"{session} {MethodName} Reply {(i + 1).ToString()} of {replyCount.ToString()} Key: {avatarKey.ToString()} Name: {avatarName}");

                    if (!avatarKeys.ContainsKey(avatarName))
                    {
                        /* || avatarKeys[avatarName] == null )	 // apparently dictionary entries cannot be null */
                        lock (avatarKeys)
                        {
                            avatarKeys[avatarName.ToLower()] = avatarKey;
                        }
                    }

                    lock (KeyLookupEvents)
                    {
                        if (KeyLookupEvents.ContainsKey(avatarName.ToLower()))
                        {
                            KeyLookupEvents[avatarName.ToLower()].Set();
                            DebugUtilities.WriteDebug($"{avatarName.ToLower()} KLE set!");
                        }
                    }
                }
            }
        }
예제 #13
0
        void Directory_DirPeopleReply(object sender, DirPeopleReplyEventArgs e)
        {
            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => Directory_DirPeopleReply(sender, e)));
                return;
            }

            if (console.QueryID != e.QueryID)
            {
                return;
            }

            totalResults       += e.MatchedPeople.Count;
            lblResultCount.Text = totalResults + " people found";

            txtPersonName.Enabled = true;
            btnFind.Enabled       = true;

            btnNext.Enabled     = (totalResults > 100);
            btnPrevious.Enabled = (startResult > 0);
        }
예제 #14
0
 private void name_search(object sender, DirPeopleReplyEventArgs e)
 {
     peopleSearchResults = e.MatchedPeople;
     mre.Set();
 }
예제 #15
0
 //Separate thread
 private void Directory_OnDirPeopleReply(object sender, DirPeopleReplyEventArgs e)
 {
     BeginInvoke((MethodInvoker) delegate {
         PeopleReply(queryID, e.MatchedPeople);
     });
 }