* Add a method to allow friendship offers to a logged in client from an offline user directly from the server
parent
b3c221a6d6
commit
c1320112a9
|
@ -200,6 +200,14 @@ namespace OpenSim.Framework
|
|||
get { return _surname; }
|
||||
set { _surname = value; }
|
||||
}
|
||||
|
||||
/// <value>
|
||||
/// The concatentation of the various name components.
|
||||
/// </value>
|
||||
public string Name
|
||||
{
|
||||
get { return String.Format("{0} {1}", _firstname, _surname); }
|
||||
}
|
||||
|
||||
public string Email
|
||||
{
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSim Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Region.Environment.Interfaces
|
||||
{
|
||||
public interface IFriendsModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Offer a friendship to a user from the server end rather than by direct initiation from a client.
|
||||
/// </summary>
|
||||
/// <param name="fromUserId">
|
||||
/// A user with this id must existing in the user data store, but need not be logged on.
|
||||
/// </param>
|
||||
/// <param name="toUserClient">
|
||||
/// An actually logged in client to which the offer is being made.
|
||||
/// FIXME: This is somewhat too tightly coupled - it should arguably be possible to offer friendships even if the
|
||||
/// receiving user is not currently online.
|
||||
/// </param>
|
||||
/// <param name="offerMessage"></param>
|
||||
void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage);
|
||||
}
|
||||
}
|
|
@ -80,7 +80,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
- Terminate Friendship messages (single)
|
||||
*/
|
||||
|
||||
public class FriendsModule : IRegionModule
|
||||
public class FriendsModule : IRegionModule, IFriendsModule
|
||||
{
|
||||
private class Transaction
|
||||
{
|
||||
|
@ -126,6 +126,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
m_scenes[scene.RegionInfo.RegionHandle] = scene;
|
||||
}
|
||||
|
||||
scene.RegisterModuleInterface<IFriendsModule>(this);
|
||||
|
||||
scene.EventManager.OnNewClient += OnNewClient;
|
||||
scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
|
||||
scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
|
||||
|
@ -375,6 +377,24 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
}
|
||||
return returnAgent;
|
||||
}
|
||||
|
||||
public void OfferFriendship(UUID fromUserId, IClientAPI toUserClient, string offerMessage)
|
||||
{
|
||||
CachedUserInfo userInfo = m_initialScene.CommsManager.UserProfileCacheService.GetUserDetails(fromUserId);
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
GridInstantMessage msg = new GridInstantMessage(
|
||||
toUserClient.Scene, fromUserId, userInfo.UserProfile.Name, toUserClient.AgentId,
|
||||
(byte)InstantMessageDialog.FriendshipOffered, offerMessage, false, Vector3.Zero);
|
||||
|
||||
FriendshipOffered(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[FRIENDS]: No user found for id {0} in OfferFriendship()", fromUserId);
|
||||
}
|
||||
}
|
||||
|
||||
#region FriendRequestHandling
|
||||
|
||||
|
@ -385,7 +405,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
|
||||
if (im.dialog == (byte)InstantMessageDialog.FriendshipOffered) // 38
|
||||
{
|
||||
FriendshipOffered(client, im);
|
||||
FriendshipOffered(im);
|
||||
}
|
||||
else if (im.dialog == (byte)InstantMessageDialog.FriendshipAccepted) // 39
|
||||
{
|
||||
|
@ -403,7 +423,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
/// May not currently be used - see OnApproveFriendRequest() instead
|
||||
/// <param name="im"></param>
|
||||
/// <param name="client"></param>
|
||||
private void FriendshipOffered(IClientAPI client, GridInstantMessage im)
|
||||
private void FriendshipOffered(GridInstantMessage im)
|
||||
{
|
||||
// this is triggered by the initiating agent:
|
||||
// A local agent offers friendship to some possibly remote friend.
|
||||
|
@ -422,7 +442,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Friends
|
|||
// be sneeky and use the initiator-UUID as transactionID. This means we can be stateless.
|
||||
// we have to look up the agent name on friendship-approval, though.
|
||||
im.imSessionID = im.fromAgentID;
|
||||
im.fromAgentName = client.Name;
|
||||
|
||||
if (m_TransferModule != null)
|
||||
{
|
||||
|
|
|
@ -99,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.InstantMessage
|
|||
{
|
||||
UUID toAgentID = new UUID(im.toAgentID);
|
||||
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM fromn {0} to {1}", im.fromAgentName, toAgentID.ToString());
|
||||
m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString());
|
||||
|
||||
// Try root avatar only first
|
||||
foreach (Scene scene in m_Scenes)
|
||||
|
|
|
@ -2270,7 +2270,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
client.OnUpdatePrimGroupScale += m_sceneGraph.UpdatePrimGroupScale;
|
||||
client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam;
|
||||
client.OnUpdatePrimShape += m_sceneGraph.UpdatePrimShape;
|
||||
//client.OnRequestMapBlocks += RequestMapBlocks; // handled in a module now.
|
||||
client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture;
|
||||
client.OnTeleportLocationRequest += RequestTeleportLocation;
|
||||
client.OnTeleportLandmarkRequest += RequestTeleportLandmark;
|
||||
|
|
|
@ -2564,7 +2564,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if ((m_host.TaskInventory[InventorySelf()].PermsMask & ScriptBaseClass.PERMISSION_TAKE_CONTROLS) != 0)
|
||||
{
|
||||
presence.RegisterControlEventsToScript(controls, accept, pass_on, m_localID, m_itemID);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue