diff options
author | UbitUmarov | 2019-10-13 16:41:38 +0100 |
---|---|---|
committer | UbitUmarov | 2019-10-13 16:41:38 +0100 |
commit | 0273baaef67824da5cb2cc2de2593a8800ce3cb6 (patch) | |
tree | aa277a5c21c823a5e88e423748613a9536cee13f /OpenSim/Region | |
parent | add osResetAllScripts(LSL_Integer AllLinkset). use with care (diff) | |
download | opensim-SC-0273baaef67824da5cb2cc2de2593a8800ce3cb6.zip opensim-SC-0273baaef67824da5cb2cc2de2593a8800ce3cb6.tar.gz opensim-SC-0273baaef67824da5cb2cc2de2593a8800ce3cb6.tar.bz2 opensim-SC-0273baaef67824da5cb2cc2de2593a8800ce3cb6.tar.xz |
mantis 8598: filter dead groups from group search. honor querystart request. Viewers are very broken on this, seems protocol was made by someone with no idea about lludp
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-x | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs | 29 |
2 files changed, 30 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 7c2a887..80ca67b 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -3850,19 +3850,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3850 | packet.QueryData = new DirGroupsReplyPacket.QueryDataBlock(); | 3850 | packet.QueryData = new DirGroupsReplyPacket.QueryDataBlock(); |
3851 | packet.QueryData.QueryID = queryID; | 3851 | packet.QueryData.QueryID = queryID; |
3852 | 3852 | ||
3853 | packet.QueryReplies = new DirGroupsReplyPacket.QueryRepliesBlock[ | 3853 | packet.QueryReplies = new DirGroupsReplyPacket.QueryRepliesBlock[data.Length]; |
3854 | data.Length]; | ||
3855 | 3854 | ||
3856 | int i = 0; | 3855 | int i = 0; |
3857 | foreach (DirGroupsReplyData d in data) | 3856 | foreach (DirGroupsReplyData d in data) |
3858 | { | 3857 | { |
3859 | packet.QueryReplies[i] = new DirGroupsReplyPacket.QueryRepliesBlock(); | 3858 | packet.QueryReplies[i] = new DirGroupsReplyPacket.QueryRepliesBlock(); |
3860 | packet.QueryReplies[i].GroupID = d.groupID; | 3859 | packet.QueryReplies[i].GroupID = d.groupID; |
3861 | packet.QueryReplies[i].GroupName = | 3860 | packet.QueryReplies[i].GroupName = Util.StringToBytes(d.groupName, 35); |
3862 | Utils.StringToBytes(d.groupName); | ||
3863 | packet.QueryReplies[i].Members = d.members; | 3861 | packet.QueryReplies[i].Members = d.members; |
3864 | packet.QueryReplies[i].SearchOrder = d.searchOrder; | 3862 | packet.QueryReplies[i].SearchOrder = d.searchOrder; |
3865 | i++; | 3863 | ++i; |
3866 | } | 3864 | } |
3867 | 3865 | ||
3868 | OutPacket(packet, ThrottleOutPacketType.Task); | 3866 | OutPacket(packet, ThrottleOutPacketType.Task); |
diff --git a/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs b/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs index c04d856..1026eae 100644 --- a/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Search/BasicSearchModule.cs | |||
@@ -186,10 +186,35 @@ namespace OpenSim.Region.CoreModules.Framework.Search | |||
186 | if (string.IsNullOrEmpty(queryText)) | 186 | if (string.IsNullOrEmpty(queryText)) |
187 | remoteClient.SendDirGroupsReply(queryID, new DirGroupsReplyData[0]); | 187 | remoteClient.SendDirGroupsReply(queryID, new DirGroupsReplyData[0]); |
188 | 188 | ||
189 | List<DirGroupsReplyData> answer = m_GroupsService.FindGroups(remoteClient, queryText); | ||
190 | if(answer.Count == 0) | ||
191 | { | ||
192 | remoteClient.SendDirGroupsReply(queryID, new DirGroupsReplyData[0]); | ||
193 | return; | ||
194 | } | ||
195 | |||
196 | // filter out groups with no members | ||
197 | DirGroupsReplyData[] result = new DirGroupsReplyData[answer.Count]; | ||
198 | int count = 0; | ||
199 | foreach(DirGroupsReplyData dgrd in answer) | ||
200 | { | ||
201 | if(dgrd.members > 0) | ||
202 | result[count++] = dgrd; | ||
203 | } | ||
204 | answer = null; | ||
205 | |||
206 | // viewers don't sent sorting, so results they show are a nice mess | ||
207 | if ((queryStart > 0) && (queryStart < count)) | ||
208 | { | ||
209 | int len = count - queryStart; | ||
210 | DirGroupsReplyData[] tmp = new DirGroupsReplyData[len]; | ||
211 | Array.Copy(result, queryStart, tmp, 0, len); | ||
212 | result = tmp; | ||
213 | } | ||
214 | |||
189 | // TODO: This currently ignores pretty much all the query flags including Mature and sort order | 215 | // TODO: This currently ignores pretty much all the query flags including Mature and sort order |
190 | remoteClient.SendDirGroupsReply(queryID, m_GroupsService.FindGroups(remoteClient, queryText).ToArray()); | 216 | remoteClient.SendDirGroupsReply(queryID, result); |
191 | } | 217 | } |
192 | |||
193 | } | 218 | } |
194 | 219 | ||
195 | #endregion Event Handlers | 220 | #endregion Event Handlers |