diff options
author | Homer Horwitz | 2008-11-26 19:50:03 +0000 |
---|---|---|
committer | Homer Horwitz | 2008-11-26 19:50:03 +0000 |
commit | 557559abd3d38b590e7b847753a701afdd69bac5 (patch) | |
tree | 4440abedf33e81c4f5fdab2699cb16915ae3795d | |
parent | * restore deleted method documentation, some to IRegionDataStore and some to ... (diff) | |
download | opensim-SC_OLD-557559abd3d38b590e7b847753a701afdd69bac5.zip opensim-SC_OLD-557559abd3d38b590e7b847753a701afdd69bac5.tar.gz opensim-SC_OLD-557559abd3d38b590e7b847753a701afdd69bac5.tar.bz2 opensim-SC_OLD-557559abd3d38b590e7b847753a701afdd69bac5.tar.xz |
Added local lookup before we ask the messaging server.
Still not tested. May contain bugs.
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs index 94032fd..c811833 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/PresenceModule.cs | |||
@@ -143,12 +143,32 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
143 | PresenceInfo[] result = new PresenceInfo[users.Length]; | 143 | PresenceInfo[] result = new PresenceInfo[users.Length]; |
144 | if (m_Gridmode) | 144 | if (m_Gridmode) |
145 | { | 145 | { |
146 | // TODO process local info first and only do a server lookup if necessary. | 146 | // first check the local information |
147 | Dictionary<UUID, FriendRegionInfo> infos = m_initialScene.GetFriendRegionInfos(new List<UUID>(users)); | 147 | List<UUID> uuids = new List<UUID>(); // the uuids to check remotely |
148 | for (int i = 0; i < users.Length; ++i) | 148 | List<int> indices = new List<int>(); // just for performance. |
149 | lock (m_RootAgents) | ||
150 | { | ||
151 | for (int i = 0; i < uuids.Count; ++i) | ||
152 | { | ||
153 | Scene scene; | ||
154 | if (m_RootAgents.TryGetValue(users[i], out scene)) | ||
155 | { | ||
156 | result[i] = new PresenceInfo(users[i], scene.RegionInfo.RegionID); | ||
157 | } | ||
158 | else | ||
159 | { | ||
160 | uuids.Add(users[i]); | ||
161 | indices.Add(i); | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | |||
166 | // now we have filtered out all the local root agents. The rest we have to request info about | ||
167 | Dictionary<UUID, FriendRegionInfo> infos = m_initialScene.GetFriendRegionInfos(uuids); | ||
168 | for (int i = 0; i < uuids.Count; ++i) | ||
149 | { | 169 | { |
150 | FriendRegionInfo info; | 170 | FriendRegionInfo info; |
151 | if (infos.TryGetValue(users[i], out info) && info.isOnline) | 171 | if (infos.TryGetValue(uuids[i], out info) && info.isOnline) |
152 | { | 172 | { |
153 | UUID regionID = info.regionID; | 173 | UUID regionID = info.regionID; |
154 | if (regionID == UUID.Zero) | 174 | if (regionID == UUID.Zero) |
@@ -158,9 +178,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage | |||
158 | RegionInfo regionInfo = m_initialScene.RequestNeighbouringRegionInfo(info.regionHandle); | 178 | RegionInfo regionInfo = m_initialScene.RequestNeighbouringRegionInfo(info.regionHandle); |
159 | regionID = regionInfo.RegionID; | 179 | regionID = regionInfo.RegionID; |
160 | } | 180 | } |
161 | result[i] = new PresenceInfo(users[i], regionID); | 181 | result[indices[i]] = new PresenceInfo(uuids[i], regionID); |
162 | } | 182 | } |
163 | else result[i] = new PresenceInfo(users[i], UUID.Zero); | 183 | else result[indices[i]] = new PresenceInfo(uuids[i], UUID.Zero); |
164 | } | 184 | } |
165 | } | 185 | } |
166 | else | 186 | else |