aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/HypergridService
diff options
context:
space:
mode:
authorDiva Canto2011-05-26 10:04:48 -0700
committerDiva Canto2011-05-26 10:04:48 -0700
commit0c58a9e68074f3593920dc9f2356bbed96416497 (patch)
tree6bccb313c233ab6486195e8a3663cfa1d30c41b9 /OpenSim/Services/HypergridService
parentHG: Renamed, shuffled some interfaces around. Move them all to IHypergridServ... (diff)
downloadopensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.zip
opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.gz
opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.bz2
opensim-SC-0c58a9e68074f3593920dc9f2356bbed96416497.tar.xz
HG IM in grid mode working fairly well. Unknown target user references looked back in source user's User Agent service.
Diffstat (limited to 'OpenSim/Services/HypergridService')
-rw-r--r--OpenSim/Services/HypergridService/HGInstantMessageService.cs22
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs24
2 files changed, 38 insertions, 8 deletions
diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs
index 6178ca1..ca0fd7f 100644
--- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs
+++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs
@@ -64,8 +64,8 @@ namespace OpenSim.Services.HypergridService
64 64
65 protected static IInstantMessageSimConnector m_IMSimConnector; 65 protected static IInstantMessageSimConnector m_IMSimConnector;
66 66
67 protected Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>(); 67 protected static Dictionary<UUID, object> m_UserLocationMap = new Dictionary<UUID, object>();
68 private ExpiringCache<UUID, GridRegion> m_RegionCache; 68 private static ExpiringCache<UUID, GridRegion> m_RegionCache;
69 69
70 public HGInstantMessageService(IConfigSource config) 70 public HGInstantMessageService(IConfigSource config)
71 : this(config, null) 71 : this(config, null)
@@ -155,6 +155,8 @@ namespace OpenSim.Services.HypergridService
155 if (!firstTime) 155 if (!firstTime)
156 { 156 {
157 lookupAgent = true; 157 lookupAgent = true;
158 upd = null;
159 url = string.Empty;
158 } 160 }
159 } 161 }
160 else 162 else
@@ -168,7 +170,6 @@ namespace OpenSim.Services.HypergridService
168 // Are we needing to look-up an agent? 170 // Are we needing to look-up an agent?
169 if (lookupAgent) 171 if (lookupAgent)
170 { 172 {
171 bool isPresent = false;
172 // Non-cached user agent lookup. 173 // Non-cached user agent lookup.
173 PresenceInfo[] presences = m_PresenceService.GetAgents(new string[] { toAgentID.ToString() }); 174 PresenceInfo[] presences = m_PresenceService.GetAgents(new string[] { toAgentID.ToString() });
174 if (presences != null && presences.Length > 0) 175 if (presences != null && presences.Length > 0)
@@ -177,17 +178,17 @@ namespace OpenSim.Services.HypergridService
177 { 178 {
178 if (p.RegionID != UUID.Zero) 179 if (p.RegionID != UUID.Zero)
179 { 180 {
181 m_log.DebugFormat("[XXX]: Found presence in {0}", p.RegionID);
180 upd = p; 182 upd = p;
181 break; 183 break;
182 } 184 }
183 else
184 isPresent = true;
185 } 185 }
186 } 186 }
187 187
188 if (upd == null && isPresent) 188 if (upd == null)
189 { 189 {
190 // Let's check with the UAS if the user is elsewhere 190 // Let's check with the UAS if the user is elsewhere
191 m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service");
191 url = m_UserAgentService.LocateUser(toAgentID); 192 url = m_UserAgentService.LocateUser(toAgentID);
192 } 193 }
193 194
@@ -197,10 +198,10 @@ namespace OpenSim.Services.HypergridService
197 // This is one way to end the recursive loop 198 // This is one way to end the recursive loop
198 // 199 //
199 if (!firstTime && ((previousLocation is PresenceInfo && upd != null && upd.RegionID == ((PresenceInfo)previousLocation).RegionID) || 200 if (!firstTime && ((previousLocation is PresenceInfo && upd != null && upd.RegionID == ((PresenceInfo)previousLocation).RegionID) ||
200 (previousLocation is string && previousLocation.Equals(url)))) 201 (previousLocation is string && upd == null && previousLocation.Equals(url))))
201 { 202 {
202 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message"); 203 // m_log.Error("[GRID INSTANT MESSAGE]: Unable to deliver an instant message");
203 m_log.DebugFormat("[XXX] Fail 1 {0} {1}", previousLocation, url); 204 m_log.DebugFormat("[HG IM SERVICE]: Fail 2 {0} {1}", previousLocation, url);
204 205
205 return false; 206 return false;
206 } 207 }
@@ -242,9 +243,14 @@ namespace OpenSim.Services.HypergridService
242 } 243 }
243 244
244 if (reginfo != null) 245 if (reginfo != null)
246 {
245 imresult = InstantMessageServiceConnector.SendInstantMessage(reginfo.ServerURI, im); 247 imresult = InstantMessageServiceConnector.SendInstantMessage(reginfo.ServerURI, im);
248 }
246 else 249 else
250 {
251 m_log.DebugFormat("[HG IM SERVICE]: Failed to deliver message to {0}", reginfo.ServerURI);
247 return false; 252 return false;
253 }
248 254
249 if (imresult) 255 if (imresult)
250 { 256 {
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 59ad043..387547e 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -485,6 +485,30 @@ namespace OpenSim.Services.HypergridService
485 485
486 return string.Empty; 486 return string.Empty;
487 } 487 }
488
489 public string GetUUI(UUID userID, UUID targetUserID)
490 {
491 // Let's see if it's a local user
492 UserAccount account = m_UserAccountService.GetUserAccount(UUID.Zero, targetUserID);
493 if (account != null)
494 return targetUserID.ToString() + ";" + m_GridName + ";" + account.FirstName + " " + account.LastName ;
495
496 // Let's try the list of friends
497 FriendInfo[] friends = m_FriendsService.GetFriends(userID);
498 if (friends != null && friends.Length > 0)
499 {
500 foreach (FriendInfo f in friends)
501 if (f.Friend.StartsWith(targetUserID.ToString()))
502 {
503 // Let's remove the secret
504 UUID id; string tmp = string.Empty, secret = string.Empty;
505 if (Util.ParseUniversalUserIdentifier(f.Friend, out id, out tmp, out tmp, out tmp, out secret))
506 return f.Friend.Replace(secret, "0");
507 }
508 }
509
510 return string.Empty;
511 }
488 } 512 }
489 513
490 class TravelingAgentInfo 514 class TravelingAgentInfo