public ServerPacket PerformSearch(string query) { List <SearchResult> searchResult1 = SearchResultFactory.GetSearchResult(query); List <SearchResult> list1 = new List <SearchResult>(); List <SearchResult> list2 = new List <SearchResult>(); foreach (SearchResult searchResult2 in searchResult1) { if (searchResult2.userID != this.GetClient().GetHabbo().Id) { if (this.FriendshipExists(searchResult2.userID)) { list1.Add(searchResult2); } else { list2.Add(searchResult2); } } } ServerPacket reply = new ServerPacket(ServerPacketHeader.HabboSearchResultMessageComposer); reply.WriteInteger(list1.Count); foreach (SearchResult searchResult2 in list1) { searchResult2.Searialize(reply); } reply.WriteInteger(list2.Count); foreach (SearchResult searchResult2 in list2) { searchResult2.Searialize(reply); } return(reply); }
internal ServerMessage PerformSearch(string query) { List <SearchResult> results = SearchResultFactory.GetSearchResult(query); List <SearchResult> existingFriends = new List <SearchResult>(); List <SearchResult> othersUsers = new List <SearchResult>(); foreach (SearchResult result in results) { if (FriendshipExists(result.userID)) { existingFriends.Add(result); } else { othersUsers.Add(result); } } ServerMessage reply = new ServerMessage(435); reply.AppendInt32(existingFriends.Count); foreach (SearchResult result in existingFriends) { result.Searialize(reply); } reply.AppendInt32(othersUsers.Count); foreach (SearchResult result in othersUsers) { result.Searialize(reply); } return(reply); }
internal ServerMessage PerformSearch(string query) { var results = SearchResultFactory.GetSearchResult(query); var existingFriends = new List <SearchResult>(); var othersUsers = new List <SearchResult>(); foreach (var result in results) { if (result.userID == GetClient().GetHabbo().Id) { continue; } if (FriendshipExists(result.userID)) { existingFriends.Add(result); } else { othersUsers.Add(result); } } var reply = new ServerMessage(Outgoing.SearchFriend); reply.AppendInt32(existingFriends.Count); foreach (var result in existingFriends) { result.Searialize(reply); } reply.AppendInt32(othersUsers.Count); foreach (var result in othersUsers) { result.Searialize(reply); } return(reply); }