From 38e8853e5761d09a7e8f580dd277d9b99b834696 Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Sat, 1 Nov 2008 22:09:48 +0000 Subject: 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. --- .../Communications/CommunicationsManager.cs | 21 ++++++++++++ .../Communications/IInterRegionCommunications.cs | 38 ++++++++++++++++++++++ .../Framework/Communications/IMessagingService.cs | 37 +++++++++++++++++++++ .../Framework/Communications/UserManagerBase.cs | 24 +++++++++++++- 4 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Framework/Communications/IMessagingService.cs (limited to 'OpenSim/Framework/Communications') diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index dfe0fdc..bb4a853 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -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 GetFriendRegionInfos(List uuids) + { + return m_messageService.GetFriendRegionInfos(uuids); + } + + public List InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List 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 diff --git a/OpenSim/Framework/Communications/IInterRegionCommunications.cs b/OpenSim/Framework/Communications/IInterRegionCommunications.cs index 3dd5561..6b589b9 100644 --- a/OpenSim/Framework/Communications/IInterRegionCommunications.cs +++ b/OpenSim/Framework/Communications/IInterRegionCommunications.cs @@ -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); + + /// + /// Try to inform friends in the given region about online status of agent. + /// + /// + /// The of the agent. + /// + /// + /// The regionHandle of the region. + /// + /// + /// A List of s of friends to inform in the given region. + /// + /// + /// Is the agent online or offline + /// + /// + /// A list of friends that couldn't be reached on this region. + /// + List InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List friends, bool online); + + /// + /// Send TerminateFriend of exFriendID to agent agentID in region regionHandle. + /// + /// + /// The handle of the region agentID is in (hopefully). + /// + /// + /// The agent to send the packet to. + /// + /// + /// The ex-friends ID. + /// + /// + /// Whether the packet could be sent. False if the agent couldn't be found in the region. + /// + bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID); } } diff --git a/OpenSim/Framework/Communications/IMessagingService.cs b/OpenSim/Framework/Communications/IMessagingService.cs new file mode 100644 index 0000000..5d4cbf8 --- /dev/null +++ b/OpenSim/Framework/Communications/IMessagingService.cs @@ -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 GetFriendRegionInfos (List uuids); + } +} diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index ba9cf27..7189eee 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -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 /// /// Base class for user management (create, read, etc) /// - 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 GetFriendRegionInfos (List uuids) + { + foreach (IUserDataPlugin plugin in _plugins) + { + try + { + Dictionary 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) -- cgit v1.1