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