Example #1
0
 protected void DirPeopleReplyHandler(Packet packet, Simulator simulator)
 {
     if (OnDirPeopleReply != null)
     {
         DirPeopleReplyPacket   peopleReply = packet as DirPeopleReplyPacket;
         List <AgentSearchData> matches     = new List <AgentSearchData>(peopleReply.QueryReplies.Length);
         foreach (DirPeopleReplyPacket.QueryRepliesBlock reply in peopleReply.QueryReplies)
         {
             AgentSearchData searchData = new AgentSearchData();
             searchData.Online    = reply.Online;
             searchData.FirstName = Helpers.FieldToUTF8String(reply.FirstName);
             searchData.LastName  = Helpers.FieldToUTF8String(reply.LastName);
             searchData.AgentID   = reply.AgentID;
             matches.Add(searchData);
         }
         try { OnDirPeopleReply(peopleReply.QueryData.QueryID, matches); }
         catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); }
     }
 }
        /// <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)
        {
            if (m_DirPeople != null)
            {
                DirPeopleReplyPacket peopleReply = e.Packet as DirPeopleReplyPacket;
                List<AgentSearchData> matches = new List<AgentSearchData>(peopleReply.QueryReplies.Length);
                foreach (DirPeopleReplyPacket.QueryRepliesBlock reply in peopleReply.QueryReplies)
                {
                    AgentSearchData searchData = new AgentSearchData();
                    searchData.Online = reply.Online;
                    searchData.FirstName = Utils.BytesToString(reply.FirstName);
                    searchData.LastName = Utils.BytesToString(reply.LastName);
                    searchData.AgentID = reply.AgentID;
                    matches.Add(searchData);
                }

                OnDirPeople(new DirPeopleReplyEventArgs(peopleReply.QueryData.QueryID, matches));
            }
        }
Example #3
0
 protected void DirPeopleReplyHandler(Packet packet, Simulator simulator)
 {
     if (OnDirPeopleReply != null)
     {
         DirPeopleReplyPacket peopleReply = packet as DirPeopleReplyPacket;
         List<AgentSearchData> matches = new List<AgentSearchData>(peopleReply.QueryReplies.Length);
         foreach (DirPeopleReplyPacket.QueryRepliesBlock reply in peopleReply.QueryReplies) {
             AgentSearchData searchData = new AgentSearchData();
             searchData.Online = reply.Online;
             searchData.FirstName = Helpers.FieldToUTF8String(reply.FirstName);
             searchData.LastName = Helpers.FieldToUTF8String(reply.LastName);
             searchData.AgentID = reply.AgentID;
             matches.Add(searchData);
         }
         try { OnDirPeopleReply(peopleReply.QueryData.QueryID, matches); }
         catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); }
     }
 }