diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs | 27 |
1 files changed, 23 insertions, 4 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 | { |