mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
Megapatch that fixes/adds: friend offer/deny/accept, friendship termination,
on-/offline updates, calling cards for friends. This adds methods in the DB layer and changes the MessagingServer, so a full update (incl. UGAIM) is necessary to get it working. Older regions shouldn't break, nor should older UGAIM break newer regions, but friends/presence will only work with all concerned parts (UGAIM, source region and destination region) at this revision (or later). I added the DB code for MSSQL, too, but couldn't test that. BEWARE: May contain bugs.
This commit is contained in:
@@ -50,6 +50,12 @@ namespace OpenSim.Framework.Communications
|
||||
}
|
||||
protected IUserService m_userService;
|
||||
|
||||
public IMessagingService MessageService
|
||||
{
|
||||
get { return m_messageService; }
|
||||
}
|
||||
protected IMessagingService m_messageService;
|
||||
|
||||
public IGridServices GridService
|
||||
{
|
||||
get { return m_gridService; }
|
||||
@@ -370,6 +376,21 @@ namespace OpenSim.Framework.Communications
|
||||
return m_userService.GetUserFriendList(friendlistowner);
|
||||
}
|
||||
|
||||
public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
|
||||
{
|
||||
return m_messageService.GetFriendRegionInfos(uuids);
|
||||
}
|
||||
|
||||
public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online)
|
||||
{
|
||||
return m_interRegion.InformFriendsInOtherRegion(agentId, destRegionHandle, friends, online);
|
||||
}
|
||||
|
||||
public bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID)
|
||||
{
|
||||
return m_interRegion.TriggerTerminateFriend(regionHandle, agentID, exFriendID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Packet Handlers
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
@@ -46,5 +47,42 @@ namespace OpenSim.Framework.Communications
|
||||
bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID);
|
||||
|
||||
bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID);
|
||||
|
||||
/// <summary>
|
||||
/// Try to inform friends in the given region about online status of agent.
|
||||
/// </summary>
|
||||
/// <param name="agentId">
|
||||
/// The <see cref="UUID"/> of the agent.
|
||||
/// </param>
|
||||
/// <param name="destRegionHandle">
|
||||
/// The regionHandle of the region.
|
||||
/// </param>
|
||||
/// <param name="friends">
|
||||
/// A List of <see cref="UUID"/>s of friends to inform in the given region.
|
||||
/// </param>
|
||||
/// <param name="online">
|
||||
/// Is the agent online or offline
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A list of friends that couldn't be reached on this region.
|
||||
/// </returns>
|
||||
List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online);
|
||||
|
||||
/// <summary>
|
||||
/// Send TerminateFriend of exFriendID to agent agentID in region regionHandle.
|
||||
/// </summary>
|
||||
/// <param name="regionHandle">
|
||||
/// The handle of the region agentID is in (hopefully).
|
||||
/// </param>
|
||||
/// <param name="agentID">
|
||||
/// The agent to send the packet to.
|
||||
/// </param>
|
||||
/// <param name="exFriendID">
|
||||
/// The ex-friends ID.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// Whether the packet could be sent. False if the agent couldn't be found in the region.
|
||||
/// </returns>
|
||||
bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID);
|
||||
}
|
||||
}
|
||||
|
||||
37
OpenSim/Framework/Communications/IMessagingService.cs
Normal file
37
OpenSim/Framework/Communications/IMessagingService.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
public interface IMessagingService
|
||||
{
|
||||
Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids);
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Statistics;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
@@ -42,7 +43,7 @@ namespace OpenSim.Framework.Communications
|
||||
/// <summary>
|
||||
/// Base class for user management (create, read, etc)
|
||||
/// </summary>
|
||||
public abstract class UserManagerBase : IUserService, IUserServiceAdmin, IAvatarService
|
||||
public abstract class UserManagerBase : IUserService, IUserServiceAdmin, IAvatarService, IMessagingService
|
||||
{
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
@@ -285,6 +286,27 @@ namespace OpenSim.Framework.Communications
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
|
||||
{
|
||||
foreach (IUserDataPlugin plugin in _plugins)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<UUID, FriendRegionInfo> result = plugin.GetFriendRegionInfos(uuids);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Info("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void StoreWebLoginKey(UUID agentID, UUID webLoginKey)
|
||||
{
|
||||
foreach (IUserDataPlugin plugin in _plugins)
|
||||
|
||||
@@ -35,9 +35,9 @@ namespace OpenSim.Framework
|
||||
public UUID FriendListOwner;
|
||||
|
||||
// These are what the list owner gives the friend permission to do
|
||||
public uint FriendListOwnerPerms;
|
||||
|
||||
// These are what the friend gives the listowner permission to do
|
||||
public uint FriendListOwnerPerms;
|
||||
public uint FriendPerms;
|
||||
|
||||
public bool onlinestatus = false;
|
||||
|
||||
37
OpenSim/Framework/FriendRegionInfo.cs
Normal file
37
OpenSim/Framework/FriendRegionInfo.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 System;
|
||||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public class FriendRegionInfo
|
||||
{
|
||||
public bool isOnline;
|
||||
public ulong regionHandle;
|
||||
}
|
||||
}
|
||||
@@ -925,6 +925,8 @@ namespace OpenSim.Framework
|
||||
void SendAcceptCallingCard(UUID transactionID);
|
||||
void SendDeclineCallingCard(UUID transactionID);
|
||||
|
||||
void SendTerminateFriend(UUID exFriendID);
|
||||
|
||||
void KillEndDone();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +135,17 @@ namespace OpenSim.Framework
|
||||
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
||||
List<FriendListItem> GetUserFriendList(UUID friendlistowner);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of <see cref="FriendRegionInfo/>s for the specified UUIDs.
|
||||
/// </summary>
|
||||
/// <param name="uuids">
|
||||
/// A <see cref="List"/> of <see cref="UUID/>s to fetch info for
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A <see cref="Dictionary"/>, mapping the <see cref="UUID"/>s to <see cref="FriendRegionInfo"/>s.
|
||||
/// </returns>
|
||||
Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
|
||||
/// </summary>
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace OpenSim.Framework
|
||||
public string HttpSSLCN = "";
|
||||
public uint httpSSLPort = 9001;
|
||||
|
||||
public string MessagingURL = String.Empty;
|
||||
|
||||
public NetworkServersInfo()
|
||||
{
|
||||
@@ -102,6 +103,9 @@ namespace OpenSim.Framework
|
||||
"http://127.0.0.1:" +
|
||||
InventoryConfig.DefaultHttpPort.ToString());
|
||||
secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true);
|
||||
|
||||
MessagingURL = config.Configs["Network"].GetString("messaging_server_url",
|
||||
"http://127.0.0.1:" + MessageServerConfig.DefaultHttpPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,7 +586,18 @@ namespace OpenSim.Framework.Servers
|
||||
XmlRpcMethod method;
|
||||
if (m_rpcHandlers.TryGetValue(methodName, out method))
|
||||
{
|
||||
xmlRpcResponse = method(xmlRprcRequest);
|
||||
try
|
||||
{
|
||||
xmlRpcResponse = method(xmlRprcRequest);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
// if the registered XmlRpc method threw an exception, we pass a fault-code along
|
||||
xmlRpcResponse = new XmlRpcResponse();
|
||||
// Code probably set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
|
||||
xmlRpcResponse.SetFault(-32603, String.Format("Requested method [{0}] threw exception: {1}",
|
||||
methodName, e.Message));
|
||||
}
|
||||
// if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here
|
||||
response.KeepAlive = m_rpcHandlersKeepAlive[methodName];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user