aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie2010-03-02 05:23:55 +0000
committerMelanie2010-03-02 05:23:55 +0000
commita9580ebb496637323548b75c2bda605790b18a6b (patch)
tree3ab1221f389679c1a7a45efcebb60157c72bbe3f
parentMerge branch 'presence-refactor' of melanie@opensimulator.org:/var/git/opensim (diff)
parentMerge branch 'presence-refactor' of ssh://diva@opensimulator.org/var/git/open... (diff)
downloadopensim-SC_OLD-a9580ebb496637323548b75c2bda605790b18a6b.zip
opensim-SC_OLD-a9580ebb496637323548b75c2bda605790b18a6b.tar.gz
opensim-SC_OLD-a9580ebb496637323548b75c2bda605790b18a6b.tar.bz2
opensim-SC_OLD-a9580ebb496637323548b75c2bda605790b18a6b.tar.xz
Merge branch 'presence-refactor'
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs49
1 files changed, 41 insertions, 8 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 555fb00..de324c0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -309,21 +309,54 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
309 return; 309 return;
310 } 310 }
311 311
312 client = LocateClientObject(agentID); 312 //
313 if (client == null) 313 // Send the friends online
314 { 314 //
315 m_log.DebugFormat("[FRIENDS MODULE]: agent's client {0} not found in local scene", agentID);
316 return;
317 }
318
319 List<UUID> online = GetOnlineFriends(agentID); 315 List<UUID> online = GetOnlineFriends(agentID);
320
321 if (online.Count > 0) 316 if (online.Count > 0)
322 { 317 {
323 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count); 318 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
324 client.SendAgentOnline(online.ToArray()); 319 client.SendAgentOnline(online.ToArray());
325 } 320 }
326 321
322 //
323 // Send outstanding friendship offers
324 //
325 if (m_Friends.ContainsKey(agentID))
326 {
327 List<string> outstanding = new List<string>();
328
329 foreach (FriendInfo fi in m_Friends[agentID].Friends)
330 if (fi.TheirFlags == -1)
331 outstanding.Add(fi.Friend);
332
333 GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero);
334 foreach (string fid in outstanding)
335 {
336 try
337 {
338 im.fromAgentID = new Guid(fid);
339 }
340 catch
341 {
342 continue;
343 }
344
345 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
346 im.fromAgentName = account.FirstName + " " + account.LastName;
347
348 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
349 PresenceInfo presence = PresenceInfo.GetOnlinePresence(presences);
350 if (presence != null)
351 im.offline = 0;
352
353 im.imSessionID = im.fromAgentID;
354
355 // Finally
356 LocalFriendshipOffered(agentID, im);
357 }
358 }
359
327 lock (m_NeedsListOfFriends) 360 lock (m_NeedsListOfFriends)
328 m_NeedsListOfFriends.Remove(agentID); 361 m_NeedsListOfFriends.Remove(agentID);
329 } 362 }