aboutsummaryrefslogtreecommitdiffstatshomepage
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
parentMantis #2728 (diff)
downloadopensim-SC_OLD-c1320112a9365a95fd2f08af6a97dde8199adf17.zip
opensim-SC_OLD-c1320112a9365a95fd2f08af6a97dde8199adf17.tar.gz
opensim-SC_OLD-c1320112a9365a95fd2f08af6a97dde8199adf17.tar.bz2
opensim-SC_OLD-c1320112a9365a95fd2f08af6a97dde8199adf17.tar.xz
* Add a method to allow friendship offers to a logged in client from an offline user directly from the server
-rw-r--r--OpenSim/Framework/UserProfileData.cs8
-rw-r--r--OpenSim/Region/Environment/Interfaces/IFriendsModule.cs49
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Friends/FriendsModule.cs27
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/InstantMessage/MessageTransferModule.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs1
6 files changed, 81 insertions, 7 deletions
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs
index b6f309d..51678e4 100644
--- a/OpenSim/Framework/UserProfileData.cs
+++ b/OpenSim/Framework/UserProfileData.cs
@@ -200,6 +200,14 @@ namespace OpenSim.Framework
200 get { return _surname; } 200 get { return _surname; }
201 set { _surname = value; } 201 set { _surname = value; }
202 } 202 }
203
204 /// <value>
205 /// The concatentation of the various name components.
206 /// </value>
207 public string Name
208 {
209 get { return String.Format("{0} {1}", _firstname, _surname); }
210 }
203 211
204 public string Email 212 public string Email
205 { 213 {
diff --git a/OpenSim/Region/Environment/Interfaces/IFriendsModule.cs b/OpenSim/Region/Environment/Interfaces/IFriendsModule.cs
new file mode 100644
index 0000000..5d3376c
--- /dev/null
+++ b/OpenSim/Region/Environment/Interfaces/IFriendsModule.cs
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using OpenMetaverse;
29using OpenSim.Framework;
30
31namespace OpenSim.Region.Environment.Interfaces
32{
33 public interface IFriendsModule
34 {
35 /// <summary>
36 /// Offer a friendship to a user from the server end rather than by direct initiation from a client.
37 /// </summary>
38 /// <param name="fromUserId">
39 /// A user with this id must existing in the user data store, but need not be logged on.
40 /// </param>
41 /// <param name="toUserClient">
42 /// An actually logged in client to which the offer is being made.
43 /// FIXME: This is somewhat too tightly coupled - it should arguably be possible to offer friendships even if the
44 /// receiving user is not currently online.
45 /// </param>
46 /// <param name="offerMessage"></param>
47 void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
48 }
49}
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)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 06354cf..d4d5b90 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2270,7 +2270,6 @@ namespace OpenSim.Region.Environment.Scenes
2270 client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale; 2270 client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale;
2271 client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; 2271 client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam;
2272 client.OnUpdatePrimShape += m_sceneGraph.UpdatePrimShape; 2272 client.OnUpdatePrimShape += m_sceneGraph.UpdatePrimShape;
2273 //client.OnRequestMapBlocks += RequestMapBlocks; // handled in a module now.
2274 client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; 2273 client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture;
2275 client.OnTeleportLocationRequest += RequestTeleportLocation; 2274 client.OnTeleportLocationRequest += RequestTeleportLocation;
2276 client.OnTeleportLandmarkRequest += RequestTeleportLandmark; 2275 client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 5b2da4f..89911ec 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2564,7 +2564,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2564 if ((m_host.TaskInventory[InventorySelf()].PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0) 2564 if ((m_host.TaskInventory[InventorySelf()].PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
2565 { 2565 {
2566 presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID); 2566 presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID);
2567
2568 } 2567 }
2569 } 2568 }
2570 } 2569 }