aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-12-23 17:16:47 +0000
committerJustin Clarke Casey2008-12-23 17:16:47 +0000
commitc1320112a9365a95fd2f08af6a97dde8199adf17 (patch)
treea472448d43e4bd1e27ab6f678036d03617a3adc6 /OpenSim/Region/Environment/Modules
parentMantis #2728 (diff)
downloadopensim-SC-c1320112a9365a95fd2f08af6a97dde8199adf17.zip
opensim-SC-c1320112a9365a95fd2f08af6a97dde8199adf17.tar.gz
opensim-SC-c1320112a9365a95fd2f08af6a97dde8199adf17.tar.bz2
opensim-SC-c1320112a9365a95fd2f08af6a97dde8199adf17.tar.xz
* Add a method to allow friendship offers to a logged in client from an offline user directly from the server
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs27
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/MessageTransferModule.cs2
2 files changed, 24 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
index 1346508..a1f0bf5 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
80 - Terminate Friendship messages (single) 80 - Terminate Friendship messages (single)
81 */ 81 */
82 82
83 public class FriendsModule : IRegionModule 83 public class FriendsModule : IRegionModule, IFriendsModule
84 { 84 {
85 private class Transaction 85 private class Transaction
86 { 86 {
@@ -126,6 +126,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
126 m_scenes[scene.RegionInfo.RegionHandle] = scene; 126 m_scenes[scene.RegionInfo.RegionHandle] = scene;
127 } 127 }
128 128
129 scene.RegisterModuleInterface<IFriendsModule>(this);
130
129 scene.EventManager.OnNewClient += OnNewClient; 131 scene.EventManager.OnNewClient += OnNewClient;
130 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; 132 scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
131 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 133 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
@@ -375,6 +377,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
375 } 377 }
376 return returnAgent; 378 return returnAgent;
377 } 379 }
380
381 public void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage)
382 {
383 CachedUserInfo userInfo = m_initialScene.CommsManager.UserProfileCacheService.GetUserDetails(fromUserId);
384
385 if (userInfo != null)
386 {
387 GridInstantMessage msg = new GridInstantMessage(
388 toUserClient.Scene, fromUserId, userInfo.UserProfile.Name, toUserClient.AgentId,
389 (byte)InstantMessageDialog.FriendshipOffered, offerMessage, false, Vector3.Zero);
390
391 FriendshipOffered(msg);
392 }
393 else
394 {
395 m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId);
396 }
397 }
378 398
379 #region FriendRequestHandling 399 #region FriendRequestHandling
380 400
@@ -385,7 +405,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
385 405
386 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38 406 if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38
387 { 407 {
388 FriendshipOffered(client, im); 408 FriendshipOffered(im);
389 } 409 }
390 else if (im.dialog == (byte)InstantMessageDialog.FriendshipAccepted) // 39 410 else if (im.dialog == (byte)InstantMessageDialog.FriendshipAccepted) // 39
391 { 411 {
@@ -403,7 +423,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
403 /// May not currently be used - see OnApproveFriendRequest() instead 423 /// May not currently be used - see OnApproveFriendRequest() instead
404 /// <param name="im"></param> 424 /// <param name="im"></param>
405 /// <param name="client"></param> 425 /// <param name="client"></param>
406 private void FriendshipOffered(IClientAPI client, GridInstantMessage im) 426 private void FriendshipOffered(GridInstantMessage im)
407 { 427 {
408 // this is triggered by the initiating agent: 428 // this is triggered by the initiating agent:
409 // A local agent offers friendship to some possibly remote friend. 429 // A local agent offers friendship to some possibly remote friend.
@@ -422,7 +442,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
422 // be sneeky and use the initiator-UUID as transactionID. This means we can be stateless. 442 // be sneeky and use the initiator-UUID as transactionID. This means we can be stateless.
423 // we have to look up the agent name on friendship-approval, though. 443 // we have to look up the agent name on friendship-approval, though.
424 im.imSessionID = im.fromAgentID; 444 im.imSessionID = im.fromAgentID;
425 im.fromAgentName = client.Name;
426 445
427 if (m_TransferModule != null) 446 if (m_TransferModule != null)
428 { 447 {
diff --git a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/MessageTransferModule.cs
index 3af65a6..838d42c 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
99 { 99 {
100 UUID toAgentID = new UUID(im.toAgentID); 100 UUID toAgentID = new UUID(im.toAgentID);
101 101
102 m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM fromn {0} to {1}", im.fromAgentName, toAgentID.ToString()); 102 m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString());
103 103
104 // Try root avatar only first 104 // Try root avatar only first
105 foreach (Scene scene in m_Scenes) 105 foreach (Scene scene in m_Scenes)