aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar
diff options
context:
space:
mode:
authorDahlia Trimble2009-01-10 09:15:23 +0000
committerDahlia Trimble2009-01-10 09:15:23 +0000
commit630ce5b26446883043aa5e6541a4550d0e918659 (patch)
tree5128485b0d8e94c96593b352a421623cbd053acb /OpenSim/Region/Environment/Modules/Avatar
parentInclude the changes from StrawBerryFride's patch to (diff)
downloadopensim-SC_OLD-630ce5b26446883043aa5e6541a4550d0e918659.zip
opensim-SC_OLD-630ce5b26446883043aa5e6541a4550d0e918659.tar.gz
opensim-SC_OLD-630ce5b26446883043aa5e6541a4550d0e918659.tar.bz2
opensim-SC_OLD-630ce5b26446883043aa5e6541a4550d0e918659.tar.xz
Revert progressive texture patch from r8001 until issues can be addressed
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs73
1 files changed, 39 insertions, 34 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
index ed77b2e..4a03ecd 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenMetaverse.Packets;
33using log4net; 34using log4net;
34using Nini.Config; 35using Nini.Config;
35using Nwc.XmlRpc; 36using Nwc.XmlRpc;
@@ -101,10 +102,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
101 102
102 private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>(); 103 private Dictionary<UUID, ulong> m_rootAgents = new Dictionary<UUID, ulong>();
103 104
104 private Dictionary<UUID, UUID> m_pendingCallingcardRequests = new Dictionary<UUID,UUID>(); 105 private Dictionary<UUID, UUID> m_pendingCallingcardRequests = new Dictionary<UUID, UUID>();
105 106
106 private Scene m_initialScene; // saves a lookup if we don't have a specific scene 107 private Scene m_initialScene; // saves a lookup if we don't have a specific scene
107 private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong,Scene>(); 108 private Dictionary<ulong, Scene> m_scenes = new Dictionary<ulong, Scene>();
108 private IMessageTransferModule m_TransferModule = null; 109 private IMessageTransferModule m_TransferModule = null;
109 110
110 #region IRegionModule Members 111 #region IRegionModule Members
@@ -124,9 +125,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
124 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) 125 if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle))
125 m_scenes[scene.RegionInfo.RegionHandle] = scene; 126 m_scenes[scene.RegionInfo.RegionHandle] = scene;
126 } 127 }
127 128
128 scene.RegisterModuleInterface<IFriendsModule>(this); 129 scene.RegisterModuleInterface<IFriendsModule>(this);
129 130
130 scene.EventManager.OnNewClient += OnNewClient; 131 scene.EventManager.OnNewClient += OnNewClient;
131 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 132 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
132 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 133 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
@@ -179,7 +180,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
179 lock (m_rootAgents) 180 lock (m_rootAgents)
180 { 181 {
181 List<ScenePresence> friendsHere = new List<ScenePresence>(); 182 List<ScenePresence> friendsHere = new List<ScenePresence>();
182 183
183 try 184 try
184 { 185 {
185 UUID agentID = new UUID((string)requestData["agentID"]); 186 UUID agentID = new UUID((string)requestData["agentID"]);
@@ -212,7 +213,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
212 } 213 }
213 } 214 }
214 } 215 }
215 catch(Exception e) 216 catch (Exception e)
216 { 217 {
217 m_log.Warn("[FRIENDS]: Got exception while parsing presence_update_bulk request:", e); 218 m_log.Warn("[FRIENDS]: Got exception while parsing presence_update_bulk request:", e);
218 } 219 }
@@ -374,24 +375,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
374 } 375 }
375 return returnAgent; 376 return returnAgent;
376 } 377 }
377 378
378 public void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage) 379 public void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage)
379 { 380 {
380 CachedUserInfo userInfo = m_initialScene.CommsManager.UserProfileCacheService.GetUserDetails(fromUserId); 381 CachedUserInfo userInfo = m_initialScene.CommsManager.UserProfileCacheService.GetUserDetails(fromUserId);
381 382
382 if (userInfo != null) 383 if (userInfo != null)
383 { 384 {
384 GridInstantMessage msg = new GridInstantMessage( 385 GridInstantMessage msg = new GridInstantMessage(
385 toUserClient.Scene, fromUserId, userInfo.UserProfile.Name, toUserClient.AgentId, 386 toUserClient.Scene, fromUserId, userInfo.UserProfile.Name, toUserClient.AgentId,
386 (byte)InstantMessageDialog.FriendshipOffered, offerMessage, false, Vector3.Zero); 387 (byte)InstantMessageDialog.FriendshipOffered, offerMessage, false, Vector3.Zero);
387 388
388 FriendshipOffered(msg); 389 FriendshipOffered(msg);
389 } 390 }
390 else 391 else
391 { 392 {
392 m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId); 393 m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId);
393 } 394 }
394 } 395 }
395 396
396 #region FriendRequestHandling 397 #region FriendRequestHandling
397 398
@@ -413,7 +414,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
413 FriendshipDeclined(client, im); 414 FriendshipDeclined(client, im);
414 } 415 }
415 } 416 }
416 417
417 /// <summary> 418 /// <summary>
418 /// Invoked when a user offers a friendship. 419 /// Invoked when a user offers a friendship.
419 /// </summary> 420 /// </summary>
@@ -448,14 +449,14 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
448 // If new friend is local, it will send an IM to the viewer. 449 // If new friend is local, it will send an IM to the viewer.
449 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server 450 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server
450 m_TransferModule.SendInstantMessage(im, 451 m_TransferModule.SendInstantMessage(im,
451 delegate(bool success) 452 delegate(bool success)
452 { 453 {
453 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 454 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
454 } 455 }
455 ); 456 );
456 } 457 }
457 } 458 }
458 459
459 /// <summary> 460 /// <summary>
460 /// Invoked when a user accepts a friendship offer. 461 /// Invoked when a user accepts a friendship offer.
461 /// </summary> 462 /// </summary>
@@ -464,9 +465,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
464 private void FriendshipAccepted(IClientAPI client, GridInstantMessage im) 465 private void FriendshipAccepted(IClientAPI client, GridInstantMessage im)
465 { 466 {
466 m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})", 467 m_log.DebugFormat("[FRIEND]: 39 - from client {0}, agent {2} {3}, imsession {4} to {5}: {6} (dialog {7})",
467 client.AgentId, im.fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog); 468 client.AgentId, im.fromAgentID, im.fromAgentName, im.imSessionID, im.toAgentID, im.message, im.dialog);
468 } 469 }
469 470
470 /// <summary> 471 /// <summary>
471 /// Invoked when a user declines a friendship offer. 472 /// Invoked when a user declines a friendship offer.
472 /// </summary> 473 /// </summary>
@@ -477,7 +478,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
477 { 478 {
478 UUID fromAgentID = new UUID(im.fromAgentID); 479 UUID fromAgentID = new UUID(im.fromAgentID);
479 UUID toAgentID = new UUID(im.toAgentID); 480 UUID toAgentID = new UUID(im.toAgentID);
480 481
481 // declining the friendship offer causes a type 40 IM being sent to the (possibly remote) initiator 482 // declining the friendship offer causes a type 40 IM being sent to the (possibly remote) initiator
482 // toAgentID is initiator, fromAgentID declined friendship 483 // toAgentID is initiator, fromAgentID declined friendship
483 m_log.DebugFormat("[FRIEND]: 40 - from client {0}, agent {1} {2}, imsession {3} to {4}: {5} (dialog {6})", 484 m_log.DebugFormat("[FRIEND]: 40 - from client {0}, agent {1} {2}, imsession {3} to {4}: {5} (dialog {6})",
@@ -487,14 +488,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
487 // Send the decline to whoever is the destination. 488 // Send the decline to whoever is the destination.
488 GridInstantMessage msg = new GridInstantMessage(client.Scene, fromAgentID, client.Name, toAgentID, 489 GridInstantMessage msg = new GridInstantMessage(client.Scene, fromAgentID, client.Name, toAgentID,
489 im.dialog, im.message, im.offline != 0, im.Position); 490 im.dialog, im.message, im.offline != 0, im.Position);
490 491
491 // If new friend is local, it will send an IM to the viewer. 492 // If new friend is local, it will send an IM to the viewer.
492 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server 493 // If new friend is remote, it will cause a OnGridInstantMessage on the remote server
493 m_TransferModule.SendInstantMessage(msg, 494 m_TransferModule.SendInstantMessage(msg,
494 delegate(bool success) { 495 delegate(bool success)
496 {
495 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 497 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
496 } 498 }
497 ); 499 );
498 } 500 }
499 501
500 private void OnGridInstantMessage(GridInstantMessage msg) 502 private void OnGridInstantMessage(GridInstantMessage msg)
@@ -510,7 +512,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
510 { 512 {
511 // this should succeed as we *know* the root agent is here. 513 // this should succeed as we *know* the root agent is here.
512 m_TransferModule.SendInstantMessage(msg, 514 m_TransferModule.SendInstantMessage(msg,
513 delegate(bool success) { 515 delegate(bool success)
516 {
514 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 517 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
515 } 518 }
516 ); 519 );
@@ -566,7 +569,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
566 client.Name, client.AgentId, agentID, friendID); 569 client.Name, client.AgentId, agentID, friendID);
567 570
568 // store the new friend persistently for both avatars 571 // store the new friend persistently for both avatars
569 m_initialScene.StoreAddFriendship(friendID, agentID, (uint) FriendRights.CanSeeOnline); 572 m_initialScene.StoreAddFriendship(friendID, agentID, (uint)FriendRights.CanSeeOnline);
570 573
571 // The cache entries aren't valid anymore either, as we just added a friend to both sides. 574 // The cache entries aren't valid anymore either, as we just added a friend to both sides.
572 lock (m_friendLists) 575 lock (m_friendLists)
@@ -609,7 +612,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
609 if (m_TransferModule != null) 612 if (m_TransferModule != null)
610 { 613 {
611 m_TransferModule.SendInstantMessage(msg, 614 m_TransferModule.SendInstantMessage(msg,
612 delegate(bool success) { 615 delegate(bool success)
616 {
613 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 617 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
614 } 618 }
615 ); 619 );
@@ -633,7 +637,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
633 if (m_TransferModule != null) 637 if (m_TransferModule != null)
634 { 638 {
635 m_TransferModule.SendInstantMessage(msg, 639 m_TransferModule.SendInstantMessage(msg,
636 delegate(bool success) { 640 delegate(bool success)
641 {
637 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success); 642 m_log.DebugFormat("[FRIEND]: sending IM success = {0}", success);
638 } 643 }
639 ); 644 );
@@ -809,16 +814,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
809 // I can't believe that we have Dictionaries, but no Sets, considering Java introduced them years ago... 814 // I can't believe that we have Dictionaries, but no Sets, considering Java introduced them years ago...
810 List<UUID> friendIDsToSendTo = new List<UUID>(); 815 List<UUID> friendIDsToSendTo = new List<UUID>();
811 List<UUID> candidateFriendIDsToReceive = new List<UUID>(); 816 List<UUID> candidateFriendIDsToReceive = new List<UUID>();
812 817
813 foreach (FriendListItem item in friendList) 818 foreach (FriendListItem item in friendList)
814 { 819 {
815 if (((item.FriendListOwnerPerms | item.FriendPerms) & (uint)FriendRights.CanSeeOnline) != 0) 820 if (((item.FriendListOwnerPerms | item.FriendPerms) & (uint)FriendRights.CanSeeOnline) != 0)
816 { 821 {
817 // friend is allowed to see my presence => add 822 // friend is allowed to see my presence => add
818 if ((item.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) 823 if ((item.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0)
819 friendIDsToSendTo.Add(item.Friend); 824 friendIDsToSendTo.Add(item.Friend);
820 825
821 if ((item.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) 826 if ((item.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0)
822 candidateFriendIDsToReceive.Add(item.Friend); 827 candidateFriendIDsToReceive.Add(item.Friend);
823 } 828 }
824 } 829 }
@@ -857,7 +862,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
857 if (iAmOnline) 862 if (iAmOnline)
858 { 863 {
859 List<UUID> friendIDsToReceive = new List<UUID>(); 864 List<UUID> friendIDsToReceive = new List<UUID>();
860 865
861 for (int i = candidateFriendIDsToReceive.Count - 1; i >= 0; --i) 866 for (int i = candidateFriendIDsToReceive.Count - 1; i >= 0; --i)
862 { 867 {
863 UUID uuid = candidateFriendIDsToReceive[i]; 868 UUID uuid = candidateFriendIDsToReceive[i];
@@ -867,11 +872,11 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
867 friendIDsToReceive.Add(uuid); 872 friendIDsToReceive.Add(uuid);
868 } 873 }
869 } 874 }
870 875
871 m_log.DebugFormat( 876 m_log.DebugFormat(
872 "[FRIEND]: Sending {0} online friends to {1}", friendIDsToReceive.Count, client.Name); 877 "[FRIEND]: Sending {0} online friends to {1}", friendIDsToReceive.Count, client.Name);
873 878
874 if (friendIDsToReceive.Count > 0) 879 if (friendIDsToReceive.Count > 0)
875 client.SendAgentOnline(friendIDsToReceive.ToArray()); 880 client.SendAgentOnline(friendIDsToReceive.ToArray());
876 881
877 // clear them for a possible second iteration; we don't have to repeat this 882 // clear them for a possible second iteration; we don't have to repeat this
@@ -914,7 +919,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
914 if (friendIDsToSendTo.Count > 0) 919 if (friendIDsToSendTo.Count > 0)
915 { 920 {
916 // sort them into regions 921 // sort them into regions
917 Dictionary<ulong, List<UUID>> friendsInRegion = new Dictionary<ulong,List<UUID>>(); 922 Dictionary<ulong, List<UUID>> friendsInRegion = new Dictionary<ulong, List<UUID>>();
918 foreach (UUID uuid in friendIDsToSendTo) 923 foreach (UUID uuid in friendIDsToSendTo)
919 { 924 {
920 ulong handle = friendRegions[uuid].regionHandle; // this can't fail as we filtered above already 925 ulong handle = friendRegions[uuid].regionHandle; // this can't fail as we filtered above already
@@ -993,5 +998,5 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
993 } 998 }
994 } 999 }
995 1000
996 #endregion 1001 #endregion
997} 1002}