aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorHomer Horwitz2008-11-01 22:09:48 +0000
committerHomer Horwitz2008-11-01 22:09:48 +0000
commit38e8853e5761d09a7e8f580dd277d9b99b834696 (patch)
tree653fe4c9075a03c05a4b5782f7309afa83062e5c /OpenSim/Framework
parent* minor: Remove mono compiler warning (diff)
downloadopensim-SC_OLD-38e8853e5761d09a7e8f580dd277d9b99b834696.zip
opensim-SC_OLD-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.gz
opensim-SC_OLD-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.bz2
opensim-SC_OLD-38e8853e5761d09a7e8f580dd277d9b99b834696.tar.xz
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.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs21
-rw-r--r--OpenSim/Framework/Communications/IInterRegionCommunications.cs38
-rw-r--r--OpenSim/Framework/Communications/IMessagingService.cs37
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs24
-rw-r--r--OpenSim/Framework/FriendListItem.cs2
-rw-r--r--OpenSim/Framework/FriendRegionInfo.cs37
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Framework/IUserData.cs11
-rw-r--r--OpenSim/Framework/NetworkServersInfo.cs4
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs13
10 files changed, 186 insertions, 3 deletions
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
50 } 50 }
51 protected IUserService m_userService; 51 protected IUserService m_userService;
52 52
53 public IMessagingService MessageService
54 {
55 get { return m_messageService; }
56 }
57 protected IMessagingService m_messageService;
58
53 public IGridServices GridService 59 public IGridServices GridService
54 { 60 {
55 get { return m_gridService; } 61 get { return m_gridService; }
@@ -370,6 +376,21 @@ namespace OpenSim.Framework.Communications
370 return m_userService.GetUserFriendList(friendlistowner); 376 return m_userService.GetUserFriendList(friendlistowner);
371 } 377 }
372 378
379 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids)
380 {
381 return m_messageService.GetFriendRegionInfos(uuids);
382 }
383
384 public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online)
385 {
386 return m_interRegion.InformFriendsInOtherRegion(agentId, destRegionHandle, friends, online);
387 }
388
389 public bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID)
390 {
391 return m_interRegion.TriggerTerminateFriend(regionHandle, agentID, exFriendID);
392 }
393
373 #endregion 394 #endregion
374 395
375 #region Packet Handlers 396 #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 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic;
28using OpenMetaverse; 29using OpenMetaverse;
29 30
30namespace OpenSim.Framework.Communications 31namespace OpenSim.Framework.Communications
@@ -46,5 +47,42 @@ namespace OpenSim.Framework.Communications
46 bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID); 47 bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID);
47 48
48 bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID); 49 bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID);
50
51 /// <summary>
52 /// Try to inform friends in the given region about online status of agent.
53 /// </summary>
54 /// <param name="agentId">
55 /// The <see cref="UUID"/> of the agent.
56 /// </param>
57 /// <param name="destRegionHandle">
58 /// The regionHandle of the region.
59 /// </param>
60 /// <param name="friends">
61 /// A List of <see cref="UUID"/>s of friends to inform in the given region.
62 /// </param>
63 /// <param name="online">
64 /// Is the agent online or offline
65 /// </param>
66 /// <returns>
67 /// A list of friends that couldn't be reached on this region.
68 /// </returns>
69 List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online);
70
71 /// <summary>
72 /// Send TerminateFriend of exFriendID to agent agentID in region regionHandle.
73 /// </summary>
74 /// <param name="regionHandle">
75 /// The handle of the region agentID is in (hopefully).
76 /// </param>
77 /// <param name="agentID">
78 /// The agent to send the packet to.
79 /// </param>
80 /// <param name="exFriendID">
81 /// The ex-friends ID.
82 /// </param>
83 /// <returns>
84 /// Whether the packet could be sent. False if the agent couldn't be found in the region.
85 /// </returns>
86 bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID);
49 } 87 }
50} 88}
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 @@
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 System.Collections.Generic;
29using OpenMetaverse;
30
31namespace OpenSim.Framework.Communications
32{
33 public interface IMessagingService
34 {
35 Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids);
36 }
37}
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;
35using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
36using log4net; 36using log4net;
37using Nwc.XmlRpc; 37using Nwc.XmlRpc;
38using OpenSim.Framework;
38using OpenSim.Framework.Statistics; 39using OpenSim.Framework.Statistics;
39 40
40namespace OpenSim.Framework.Communications 41namespace OpenSim.Framework.Communications
@@ -42,7 +43,7 @@ namespace OpenSim.Framework.Communications
42 /// <summary> 43 /// <summary>
43 /// Base class for user management (create, read, etc) 44 /// Base class for user management (create, read, etc)
44 /// </summary> 45 /// </summary>
45 public abstract class UserManagerBase : IUserService, IUserServiceAdmin, IAvatarService 46 public abstract class UserManagerBase : IUserService, IUserServiceAdmin, IAvatarService, IMessagingService
46 { 47 {
47 private static readonly ILog m_log 48 private static readonly ILog m_log
48 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -285,6 +286,27 @@ namespace OpenSim.Framework.Communications
285 return null; 286 return null;
286 } 287 }
287 288
289 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos (List<UUID> uuids)
290 {
291 foreach (IUserDataPlugin plugin in _plugins)
292 {
293 try
294 {
295 Dictionary<UUID, FriendRegionInfo> result = plugin.GetFriendRegionInfos(uuids);
296
297 if (result != null)
298 {
299 return result;
300 }
301 }
302 catch (Exception e)
303 {
304 m_log.Info("[USERSTORAGE]: Unable to GetFriendRegionInfos via " + plugin.Name + "(" + e.ToString() + ")");
305 }
306 }
307 return null;
308 }
309
288 public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) 310 public void StoreWebLoginKey(UUID agentID, UUID webLoginKey)
289 { 311 {
290 foreach (IUserDataPlugin plugin in _plugins) 312 foreach (IUserDataPlugin plugin in _plugins)
diff --git a/OpenSim/Framework/FriendListItem.cs b/OpenSim/Framework/FriendListItem.cs
index 2861ce2..a60bc22 100644
--- a/OpenSim/Framework/FriendListItem.cs
+++ b/OpenSim/Framework/FriendListItem.cs
@@ -35,9 +35,9 @@ namespace OpenSim.Framework
35 public UUID FriendListOwner; 35 public UUID FriendListOwner;
36 36
37 // These are what the list owner gives the friend permission to do 37 // These are what the list owner gives the friend permission to do
38 public uint FriendListOwnerPerms;
38 39
39 // These are what the friend gives the listowner permission to do 40 // These are what the friend gives the listowner permission to do
40 public uint FriendListOwnerPerms;
41 public uint FriendPerms; 41 public uint FriendPerms;
42 42
43 public bool onlinestatus = false; 43 public bool onlinestatus = false;
diff --git a/OpenSim/Framework/FriendRegionInfo.cs b/OpenSim/Framework/FriendRegionInfo.cs
new file mode 100644
index 0000000..04e00e8
--- /dev/null
+++ b/OpenSim/Framework/FriendRegionInfo.cs
@@ -0,0 +1,37 @@
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 System;
29
30namespace OpenSim.Framework
31{
32 public class FriendRegionInfo
33 {
34 public bool isOnline;
35 public ulong regionHandle;
36 }
37}
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 538a2e7..94bf3aa 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -925,6 +925,8 @@ namespace OpenSim.Framework
925 void SendAcceptCallingCard(UUID transactionID); 925 void SendAcceptCallingCard(UUID transactionID);
926 void SendDeclineCallingCard(UUID transactionID); 926 void SendDeclineCallingCard(UUID transactionID);
927 927
928 void SendTerminateFriend(UUID exFriendID);
929
928 void KillEndDone(); 930 void KillEndDone();
929 } 931 }
930} 932}
diff --git a/OpenSim/Framework/IUserData.cs b/OpenSim/Framework/IUserData.cs
index 4089253..07159cc 100644
--- a/OpenSim/Framework/IUserData.cs
+++ b/OpenSim/Framework/IUserData.cs
@@ -136,6 +136,17 @@ namespace OpenSim.Framework
136 List<FriendListItem> GetUserFriendList(UUID friendlistowner); 136 List<FriendListItem> GetUserFriendList(UUID friendlistowner);
137 137
138 /// <summary> 138 /// <summary>
139 /// Returns a list of <see cref="FriendRegionInfo/>s for the specified UUIDs.
140 /// </summary>
141 /// <param name="uuids">
142 /// A <see cref="List"/> of <see cref="UUID/>s to fetch info for
143 /// </param>
144 /// <returns>
145 /// A <see cref="Dictionary"/>, mapping the <see cref="UUID"/>s to <see cref="FriendRegionInfo"/>s.
146 /// </returns>
147 Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids);
148
149 /// <summary>
139 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) 150 /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES)
140 /// </summary> 151 /// </summary>
141 /// <param name="from">The account to transfer from</param> 152 /// <param name="from">The account to transfer from</param>
diff --git a/OpenSim/Framework/NetworkServersInfo.cs b/OpenSim/Framework/NetworkServersInfo.cs
index 9f3014d..49b8ef9 100644
--- a/OpenSim/Framework/NetworkServersInfo.cs
+++ b/OpenSim/Framework/NetworkServersInfo.cs
@@ -53,6 +53,7 @@ namespace OpenSim.Framework
53 public string HttpSSLCN = ""; 53 public string HttpSSLCN = "";
54 public uint httpSSLPort = 9001; 54 public uint httpSSLPort = 9001;
55 55
56 public string MessagingURL = String.Empty;
56 57
57 public NetworkServersInfo() 58 public NetworkServersInfo()
58 { 59 {
@@ -102,6 +103,9 @@ namespace OpenSim.Framework
102 "http://127.0.0.1:" + 103 "http://127.0.0.1:" +
103 InventoryConfig.DefaultHttpPort.ToString()); 104 InventoryConfig.DefaultHttpPort.ToString());
104 secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true); 105 secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true);
106
107 MessagingURL = config.Configs["Network"].GetString("messaging_server_url",
108 "http://127.0.0.1:" + MessageServerConfig.DefaultHttpPort);
105 } 109 }
106 } 110 }
107} 111}
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 871ea57..98b44db 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -586,7 +586,18 @@ namespace OpenSim.Framework.Servers
586 XmlRpcMethod method; 586 XmlRpcMethod method;
587 if (m_rpcHandlers.TryGetValue(methodName, out method)) 587 if (m_rpcHandlers.TryGetValue(methodName, out method))
588 { 588 {
589 xmlRpcResponse = method(xmlRprcRequest); 589 try
590 {
591 xmlRpcResponse = method(xmlRprcRequest);
592 }
593 catch(Exception e)
594 {
595 // if the registered XmlRpc method threw an exception, we pass a fault-code along
596 xmlRpcResponse = new XmlRpcResponse();
597 // Code probably set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
598 xmlRpcResponse.SetFault(-32603, String.Format("Requested method [{0}] threw exception: {1}",
599 methodName, e.Message));
600 }
590 // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here 601 // if the method wasn't found, we can't determine KeepAlive state anyway, so lets do it only here
591 response.KeepAlive = m_rpcHandlersKeepAlive[methodName]; 602 response.KeepAlive = m_rpcHandlersKeepAlive[methodName];
592 } 603 }