aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2009-02-24 16:13:16 +0000
committerMW2009-02-24 16:13:16 +0000
commit98178b4e9f5637eed9ab5ebb7c44f2eb71c30093 (patch)
tree7602f67161fcf14990a840b57c672e2f24d9d0ae
parentAdded OpenSim.Grid.GridServer.Modules, for the GridServer modules/components. (diff)
downloadopensim-SC_OLD-98178b4e9f5637eed9ab5ebb7c44f2eb71c30093.zip
opensim-SC_OLD-98178b4e9f5637eed9ab5ebb7c44f2eb71c30093.tar.gz
opensim-SC_OLD-98178b4e9f5637eed9ab5ebb7c44f2eb71c30093.tar.bz2
opensim-SC_OLD-98178b4e9f5637eed9ab5ebb7c44f2eb71c30093.tar.xz
Same treatment for the MessagingServer... added OpenSim.Grid.MessagingServer.Modules for the modules/components of it.
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs (renamed from OpenSim/Grid/MessagingServer/MessageRegionModule.cs)426
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageService.cs (renamed from OpenSim/Grid/MessagingServer/MessageService.cs)974
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageUserServerModule.cs (renamed from OpenSim/Grid/MessagingServer/MessageUserServerModule.cs)372
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs (renamed from OpenSim/Grid/MessagingServer/PresenceBackreferenceEntry.cs)192
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs (renamed from OpenSim/Grid/MessagingServer/PresenceInformer.cs)270
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/PresenceService.cs (renamed from OpenSim/Grid/MessagingServer/PresenceService.cs)66
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs (renamed from OpenSim/Grid/MessagingServer/UserDataBaseService.cs)150
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs (renamed from OpenSim/Grid/MessagingServer/UserPresenceData.cs)100
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs (renamed from OpenSim/Grid/MessagingServer/WorkUnitBase.cs)66
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs (renamed from OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs)66
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs1
-rw-r--r--prebuild.xml34
12 files changed, 1376 insertions, 1341 deletions
diff --git a/OpenSim/Grid/MessagingServer/MessageRegionModule.cs b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs
index 063774c..f77ef4b 100644
--- a/OpenSim/Grid/MessagingServer/MessageRegionModule.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs
@@ -1,213 +1,213 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using System.Timers; 34using System.Timers;
35using log4net; 35using log4net;
36using Nwc.XmlRpc; 36using Nwc.XmlRpc;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Data; 38using OpenSim.Data;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Grid.Framework; 40using OpenSim.Grid.Framework;
41using Timer = System.Timers.Timer; 41using Timer = System.Timers.Timer;
42 42
43namespace OpenSim.Grid.MessagingServer 43namespace OpenSim.Grid.MessagingServer.Modules
44{ 44{
45 public class MessageRegionModule : IMessageRegionService 45 public class MessageRegionModule : IMessageRegionService
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private MessageServerConfig m_cfg; 49 private MessageServerConfig m_cfg;
50 50
51 private IMessageUserServerService m_userServerModule; 51 private IMessageUserServerService m_userServerModule;
52 52
53 private IUGAIMCore m_messageCore; 53 private IUGAIMCore m_messageCore;
54 54
55 // a dictionary of all current regions this server knows about 55 // a dictionary of all current regions this server knows about
56 private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>(); 56 private Dictionary<ulong, RegionProfileData> m_regionInfoCache = new Dictionary<ulong, RegionProfileData>();
57 57
58 public MessageRegionModule(MessageServerConfig config, IUGAIMCore messageCore) 58 public MessageRegionModule(MessageServerConfig config, IUGAIMCore messageCore)
59 { 59 {
60 m_cfg = config; 60 m_cfg = config;
61 m_messageCore = messageCore; 61 m_messageCore = messageCore;
62 } 62 }
63 63
64 public void Initialise() 64 public void Initialise()
65 { 65 {
66 m_messageCore.RegisterInterface<IMessageRegionService>(this); 66 m_messageCore.RegisterInterface<IMessageRegionService>(this);
67 } 67 }
68 68
69 public void PostInitialise() 69 public void PostInitialise()
70 { 70 {
71 IMessageUserServerService messageUserServer; 71 IMessageUserServerService messageUserServer;
72 if (m_messageCore.TryGet<IMessageUserServerService>(out messageUserServer)) 72 if (m_messageCore.TryGet<IMessageUserServerService>(out messageUserServer))
73 { 73 {
74 m_userServerModule = messageUserServer; 74 m_userServerModule = messageUserServer;
75 } 75 }
76 } 76 }
77 77
78 public void RegisterHandlers() 78 public void RegisterHandlers()
79 { 79 {
80 //have these in separate method as some servers restart the http server and reregister all the handlers. 80 //have these in separate method as some servers restart the http server and reregister all the handlers.
81 81
82 } 82 }
83 83
84 /// <summary> 84 /// <summary>
85 /// Gets and caches a RegionInfo object from the gridserver based on regionhandle 85 /// Gets and caches a RegionInfo object from the gridserver based on regionhandle
86 /// if the regionhandle is already cached, use the cached values 86 /// if the regionhandle is already cached, use the cached values
87 /// Gets called by lots of threads!!!!! 87 /// Gets called by lots of threads!!!!!
88 /// </summary> 88 /// </summary>
89 /// <param name="regionhandle">handle to the XY of the region we're looking for</param> 89 /// <param name="regionhandle">handle to the XY of the region we're looking for</param>
90 /// <returns>A RegionInfo object to stick in the presence info</returns> 90 /// <returns>A RegionInfo object to stick in the presence info</returns>
91 public RegionProfileData GetRegionInfo(ulong regionhandle) 91 public RegionProfileData GetRegionInfo(ulong regionhandle)
92 { 92 {
93 RegionProfileData regionInfo = null; 93 RegionProfileData regionInfo = null;
94 94
95 lock (m_regionInfoCache) 95 lock (m_regionInfoCache)
96 { 96 {
97 m_regionInfoCache.TryGetValue(regionhandle, out regionInfo); 97 m_regionInfoCache.TryGetValue(regionhandle, out regionInfo);
98 } 98 }
99 99
100 if (regionInfo == null) // not found in cache 100 if (regionInfo == null) // not found in cache
101 { 101 {
102 regionInfo = RequestRegionInfo(regionhandle); 102 regionInfo = RequestRegionInfo(regionhandle);
103 103
104 if (regionInfo != null) // lookup was successful 104 if (regionInfo != null) // lookup was successful
105 { 105 {
106 lock (m_regionInfoCache) 106 lock (m_regionInfoCache)
107 { 107 {
108 m_regionInfoCache[regionhandle] = regionInfo; 108 m_regionInfoCache[regionhandle] = regionInfo;
109 } 109 }
110 } 110 }
111 } 111 }
112 112
113 return regionInfo; 113 return regionInfo;
114 } 114 }
115 115
116 public int ClearRegionCache() 116 public int ClearRegionCache()
117 { 117 {
118 int cachecount = 0; 118 int cachecount = 0;
119 119
120 lock (m_regionInfoCache) 120 lock (m_regionInfoCache)
121 { 121 {
122 cachecount = m_regionInfoCache.Count; 122 cachecount = m_regionInfoCache.Count;
123 m_regionInfoCache.Clear(); 123 m_regionInfoCache.Clear();
124 } 124 }
125 125
126 return cachecount; 126 return cachecount;
127 } 127 }
128 128
129 /// <summary> 129 /// <summary>
130 /// Get RegionProfileData from the GridServer. 130 /// Get RegionProfileData from the GridServer.
131 /// We'll cache this information in GetRegionInfo and use it for presence updates 131 /// We'll cache this information in GetRegionInfo and use it for presence updates
132 /// </summary> 132 /// </summary>
133 /// <param name="regionHandle"></param> 133 /// <param name="regionHandle"></param>
134 /// <returns></returns> 134 /// <returns></returns>
135 public RegionProfileData RequestRegionInfo(ulong regionHandle) 135 public RegionProfileData RequestRegionInfo(ulong regionHandle)
136 { 136 {
137 RegionProfileData regionProfile = null; 137 RegionProfileData regionProfile = null;
138 try 138 try
139 { 139 {
140 Hashtable requestData = new Hashtable(); 140 Hashtable requestData = new Hashtable();
141 requestData["region_handle"] = regionHandle.ToString(); 141 requestData["region_handle"] = regionHandle.ToString();
142 requestData["authkey"] = m_cfg.GridSendKey; 142 requestData["authkey"] = m_cfg.GridSendKey;
143 143
144 ArrayList SendParams = new ArrayList(); 144 ArrayList SendParams = new ArrayList();
145 SendParams.Add(requestData); 145 SendParams.Add(requestData);
146 146
147 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 147 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
148 148
149 XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); 149 XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000);
150 150
151 Hashtable responseData = (Hashtable)GridResp.Value; 151 Hashtable responseData = (Hashtable)GridResp.Value;
152 152
153 if (responseData.ContainsKey("error")) 153 if (responseData.ContainsKey("error"))
154 { 154 {
155 m_log.Error("[GRID]: error received from grid server" + responseData["error"]); 155 m_log.Error("[GRID]: error received from grid server" + responseData["error"]);
156 return null; 156 return null;
157 } 157 }
158 158
159 uint regX = Convert.ToUInt32((string)responseData["region_locx"]); 159 uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
160 uint regY = Convert.ToUInt32((string)responseData["region_locy"]); 160 uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
161 string internalIpStr = (string)responseData["sim_ip"]; 161 string internalIpStr = (string)responseData["sim_ip"];
162 162
163 regionProfile = new RegionProfileData(); 163 regionProfile = new RegionProfileData();
164 regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); 164 regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]);
165 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; 165 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
166 regionProfile.regionHandle = Utils.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); 166 regionProfile.regionHandle = Utils.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
167 regionProfile.regionLocX = regX; 167 regionProfile.regionLocX = regX;
168 regionProfile.regionLocY = regY; 168 regionProfile.regionLocY = regY;
169 169
170 regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 170 regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
171 regionProfile.UUID = new UUID((string)responseData["region_UUID"]); 171 regionProfile.UUID = new UUID((string)responseData["region_UUID"]);
172 regionProfile.regionName = (string)responseData["region_name"]; 172 regionProfile.regionName = (string)responseData["region_name"];
173 } 173 }
174 catch (WebException) 174 catch (WebException)
175 { 175 {
176 m_log.Error("[GRID]: " + 176 m_log.Error("[GRID]: " +
177 "Region lookup failed for: " + regionHandle.ToString() + 177 "Region lookup failed for: " + regionHandle.ToString() +
178 " - Is the GridServer down?"); 178 " - Is the GridServer down?");
179 } 179 }
180 180
181 return regionProfile; 181 return regionProfile;
182 } 182 }
183 183
184 public XmlRpcResponse RegionStartup(XmlRpcRequest request) 184 public XmlRpcResponse RegionStartup(XmlRpcRequest request)
185 { 185 {
186 Hashtable requestData = (Hashtable)request.Params[0]; 186 Hashtable requestData = (Hashtable)request.Params[0];
187 Hashtable result = new Hashtable(); 187 Hashtable result = new Hashtable();
188 result["success"] = "FALSE"; 188 result["success"] = "FALSE";
189 189
190 if (m_userServerModule.SendToUserServer(requestData, "region_startup")) 190 if (m_userServerModule.SendToUserServer(requestData, "region_startup"))
191 result["success"] = "TRUE"; 191 result["success"] = "TRUE";
192 192
193 XmlRpcResponse response = new XmlRpcResponse(); 193 XmlRpcResponse response = new XmlRpcResponse();
194 response.Value = result; 194 response.Value = result;
195 return response; 195 return response;
196 } 196 }
197 197
198 public XmlRpcResponse RegionShutdown(XmlRpcRequest request) 198 public XmlRpcResponse RegionShutdown(XmlRpcRequest request)
199 { 199 {
200 Hashtable requestData = (Hashtable)request.Params[0]; 200 Hashtable requestData = (Hashtable)request.Params[0];
201 Hashtable result = new Hashtable(); 201 Hashtable result = new Hashtable();
202 result["success"] = "FALSE"; 202 result["success"] = "FALSE";
203 203
204 if (m_userServerModule.SendToUserServer(requestData, "region_shutdown")) 204 if (m_userServerModule.SendToUserServer(requestData, "region_shutdown"))
205 result["success"] = "TRUE"; 205 result["success"] = "TRUE";
206 206
207 XmlRpcResponse response = new XmlRpcResponse(); 207 XmlRpcResponse response = new XmlRpcResponse();
208 response.Value = result; 208 response.Value = result;
209 return response; 209 return response;
210 } 210 }
211 211
212 } 212 }
213} 213}
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs
index a301732..15cfa3b 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs
@@ -1,488 +1,488 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using System.Timers; 34using System.Timers;
35using log4net; 35using log4net;
36using Nwc.XmlRpc; 36using Nwc.XmlRpc;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Data; 38using OpenSim.Data;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Grid.Framework; 40using OpenSim.Grid.Framework;
41using Timer=System.Timers.Timer; 41using Timer=System.Timers.Timer;
42 42
43namespace OpenSim.Grid.MessagingServer 43namespace OpenSim.Grid.MessagingServer.Modules
44{ 44{
45 public class MessageService 45 public class MessageService
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private MessageServerConfig m_cfg; 49 private MessageServerConfig m_cfg;
50 private UserDataBaseService m_userDataBaseService; 50 private UserDataBaseService m_userDataBaseService;
51 51
52 private IUGAIMCore m_messageCore; 52 private IUGAIMCore m_messageCore;
53 53
54 private IMessageUserServerService m_userServerModule; 54 private IMessageUserServerService m_userServerModule;
55 private IMessageRegionService m_regionModule; 55 private IMessageRegionService m_regionModule;
56 56
57 // a dictionary of all current presences this server knows about 57 // a dictionary of all current presences this server knows about
58 private Dictionary<UUID, UserPresenceData> m_presences = new Dictionary<UUID,UserPresenceData>(); 58 private Dictionary<UUID, UserPresenceData> m_presences = new Dictionary<UUID,UserPresenceData>();
59 59
60 public MessageService(MessageServerConfig cfg, IUGAIMCore messageCore, UserDataBaseService userDataBaseService) 60 public MessageService(MessageServerConfig cfg, IUGAIMCore messageCore, UserDataBaseService userDataBaseService)
61 { 61 {
62 m_cfg = cfg; 62 m_cfg = cfg;
63 m_messageCore = messageCore; 63 m_messageCore = messageCore;
64 64
65 m_userDataBaseService = userDataBaseService; 65 m_userDataBaseService = userDataBaseService;
66 66
67 //??? 67 //???
68 UserConfig uc = new UserConfig(); 68 UserConfig uc = new UserConfig();
69 uc.DatabaseConnect = cfg.DatabaseConnect; 69 uc.DatabaseConnect = cfg.DatabaseConnect;
70 uc.DatabaseProvider = cfg.DatabaseProvider; 70 uc.DatabaseProvider = cfg.DatabaseProvider;
71 } 71 }
72 72
73 public void Initialise() 73 public void Initialise()
74 { 74 {
75 } 75 }
76 76
77 public void PostInitialise() 77 public void PostInitialise()
78 { 78 {
79 IMessageUserServerService messageUserServer; 79 IMessageUserServerService messageUserServer;
80 if (m_messageCore.TryGet<IMessageUserServerService>(out messageUserServer)) 80 if (m_messageCore.TryGet<IMessageUserServerService>(out messageUserServer))
81 { 81 {
82 m_userServerModule = messageUserServer; 82 m_userServerModule = messageUserServer;
83 } 83 }
84 84
85 IMessageRegionService messageRegion; 85 IMessageRegionService messageRegion;
86 if (m_messageCore.TryGet<IMessageRegionService>(out messageRegion)) 86 if (m_messageCore.TryGet<IMessageRegionService>(out messageRegion))
87 { 87 {
88 m_regionModule = messageRegion; 88 m_regionModule = messageRegion;
89 } 89 }
90 } 90 }
91 91
92 public void RegisterHandlers() 92 public void RegisterHandlers()
93 { 93 {
94 //have these in separate method as some servers restart the http server and reregister all the handlers. 94 //have these in separate method as some servers restart the http server and reregister all the handlers.
95 95
96 } 96 }
97 97
98 #region FriendList Methods 98 #region FriendList Methods
99 99
100 /// <summary> 100 /// <summary>
101 /// Process Friendlist subscriptions for a user 101 /// Process Friendlist subscriptions for a user
102 /// The login method calls this for a User 102 /// The login method calls this for a User
103 /// </summary> 103 /// </summary>
104 /// <param name="userpresence">The Agent we're processing the friendlist subscriptions for</param> 104 /// <param name="userpresence">The Agent we're processing the friendlist subscriptions for</param>
105 private void ProcessFriendListSubscriptions(UserPresenceData userpresence) 105 private void ProcessFriendListSubscriptions(UserPresenceData userpresence)
106 { 106 {
107 lock (m_presences) 107 lock (m_presences)
108 { 108 {
109 m_presences[userpresence.agentData.AgentID] = userpresence; 109 m_presences[userpresence.agentData.AgentID] = userpresence;
110 } 110 }
111 111
112 Dictionary<UUID, FriendListItem> uFriendList = userpresence.friendData; 112 Dictionary<UUID, FriendListItem> uFriendList = userpresence.friendData;
113 foreach (KeyValuePair<UUID, FriendListItem> pair in uFriendList) 113 foreach (KeyValuePair<UUID, FriendListItem> pair in uFriendList)
114 { 114 {
115 UserPresenceData friendup = null; 115 UserPresenceData friendup = null;
116 lock (m_presences) 116 lock (m_presences)
117 { 117 {
118 m_presences.TryGetValue(pair.Key, out friendup); 118 m_presences.TryGetValue(pair.Key, out friendup);
119 } 119 }
120 if (friendup != null) 120 if (friendup != null)
121 { 121 {
122 SubscribeToPresenceUpdates(userpresence, friendup, pair.Value); 122 SubscribeToPresenceUpdates(userpresence, friendup, pair.Value);
123 } 123 }
124 } 124 }
125 } 125 }
126 126
127 /// <summary> 127 /// <summary>
128 /// Enqueues a presence update, sending info about user 'talkingAbout' to user 'receiver'. 128 /// Enqueues a presence update, sending info about user 'talkingAbout' to user 'receiver'.
129 /// </summary> 129 /// </summary>
130 /// <param name="talkingAbout">We are sending presence information about this user.</param> 130 /// <param name="talkingAbout">We are sending presence information about this user.</param>
131 /// <param name="receiver">We are sending the presence update to this user</param> 131 /// <param name="receiver">We are sending the presence update to this user</param>
132 private void enqueuePresenceUpdate(UserPresenceData talkingAbout, UserPresenceData receiver) 132 private void enqueuePresenceUpdate(UserPresenceData talkingAbout, UserPresenceData receiver)
133 { 133 {
134 UserAgentData p2Handle = m_userDataBaseService.GetUserAgentData(receiver.agentData.AgentID); 134 UserAgentData p2Handle = m_userDataBaseService.GetUserAgentData(receiver.agentData.AgentID);
135 if (p2Handle != null) 135 if (p2Handle != null)
136 { 136 {
137 if (receiver.lookupUserRegionYN) 137 if (receiver.lookupUserRegionYN)
138 { 138 {
139 receiver.regionData.regionHandle = p2Handle.Handle; 139 receiver.regionData.regionHandle = p2Handle.Handle;
140 } 140 }
141 else 141 else
142 { 142 {
143 receiver.lookupUserRegionYN = true; // TODO Huh? 143 receiver.lookupUserRegionYN = true; // TODO Huh?
144 } 144 }
145 145
146 PresenceInformer friendlistupdater = new PresenceInformer(); 146 PresenceInformer friendlistupdater = new PresenceInformer();
147 friendlistupdater.presence1 = talkingAbout; 147 friendlistupdater.presence1 = talkingAbout;
148 friendlistupdater.presence2 = receiver; 148 friendlistupdater.presence2 = receiver;
149 friendlistupdater.OnGetRegionData += m_regionModule.GetRegionInfo; 149 friendlistupdater.OnGetRegionData += m_regionModule.GetRegionInfo;
150 friendlistupdater.OnDone += PresenceUpdateDone; 150 friendlistupdater.OnDone += PresenceUpdateDone;
151 WaitCallback cb = new WaitCallback(friendlistupdater.go); 151 WaitCallback cb = new WaitCallback(friendlistupdater.go);
152 ThreadPool.QueueUserWorkItem(cb); 152 ThreadPool.QueueUserWorkItem(cb);
153 } 153 }
154 else 154 else
155 { 155 {
156 m_log.WarnFormat("no data found for user {0}", receiver.agentData.AgentID); 156 m_log.WarnFormat("no data found for user {0}", receiver.agentData.AgentID);
157 // Skip because we can't find any data on the user 157 // Skip because we can't find any data on the user
158 } 158 }
159 } 159 }
160 160
161 /// <summary> 161 /// <summary>
162 /// Does the necessary work to subscribe one agent to another's presence notifications 162 /// Does the necessary work to subscribe one agent to another's presence notifications
163 /// Gets called by ProcessFriendListSubscriptions. You shouldn't call this directly 163 /// Gets called by ProcessFriendListSubscriptions. You shouldn't call this directly
164 /// unless you know what you're doing 164 /// unless you know what you're doing
165 /// </summary> 165 /// </summary>
166 /// <param name="userpresence">P1</param> 166 /// <param name="userpresence">P1</param>
167 /// <param name="friendpresence">P2</param> 167 /// <param name="friendpresence">P2</param>
168 /// <param name="uFriendListItem"></param> 168 /// <param name="uFriendListItem"></param>
169 private void SubscribeToPresenceUpdates(UserPresenceData userpresence, 169 private void SubscribeToPresenceUpdates(UserPresenceData userpresence,
170 UserPresenceData friendpresence, 170 UserPresenceData friendpresence,
171 FriendListItem uFriendListItem) 171 FriendListItem uFriendListItem)
172 { 172 {
173 // Can the friend see me online? 173 // Can the friend see me online?
174 if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) 174 if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0)
175 { 175 {
176 // tell user to update friend about user's presence changes 176 // tell user to update friend about user's presence changes
177 if (!userpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) 177 if (!userpresence.subscriptionData.Contains(friendpresence.agentData.AgentID))
178 { 178 {
179 userpresence.subscriptionData.Add(friendpresence.agentData.AgentID); 179 userpresence.subscriptionData.Add(friendpresence.agentData.AgentID);
180 } 180 }
181 181
182 // send an update about user's presence to the friend 182 // send an update about user's presence to the friend
183 enqueuePresenceUpdate(userpresence, friendpresence); 183 enqueuePresenceUpdate(userpresence, friendpresence);
184 } 184 }
185 185
186 // Can I see the friend online? 186 // Can I see the friend online?
187 if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) 187 if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0)
188 { 188 {
189 // tell friend to update user about friend's presence changes 189 // tell friend to update user about friend's presence changes
190 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) 190 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
191 { 191 {
192 friendpresence.subscriptionData.Add(userpresence.agentData.AgentID); 192 friendpresence.subscriptionData.Add(userpresence.agentData.AgentID);
193 } 193 }
194 194
195 // send an update about friend's presence to user. 195 // send an update about friend's presence to user.
196 enqueuePresenceUpdate(friendpresence, userpresence); 196 enqueuePresenceUpdate(friendpresence, userpresence);
197 } 197 }
198 } 198 }
199 199
200 /// <summary> 200 /// <summary>
201 /// Logoff Processor. Call this to clean up agent presence data and send logoff presence notifications 201 /// Logoff Processor. Call this to clean up agent presence data and send logoff presence notifications
202 /// </summary> 202 /// </summary>
203 /// <param name="AgentID"></param> 203 /// <param name="AgentID"></param>
204 private void ProcessLogOff(UUID AgentID) 204 private void ProcessLogOff(UUID AgentID)
205 { 205 {
206 m_log.Info("[LOGOFF]: Processing Logoff"); 206 m_log.Info("[LOGOFF]: Processing Logoff");
207 207
208 UserPresenceData userPresence = null; 208 UserPresenceData userPresence = null;
209 lock (m_presences) 209 lock (m_presences)
210 { 210 {
211 m_presences.TryGetValue(AgentID, out userPresence); 211 m_presences.TryGetValue(AgentID, out userPresence);
212 } 212 }
213 213
214 if (userPresence != null) // found the user 214 if (userPresence != null) // found the user
215 { 215 {
216 List<UUID> AgentsNeedingNotification = userPresence.subscriptionData; 216 List<UUID> AgentsNeedingNotification = userPresence.subscriptionData;
217 userPresence.OnlineYN = false; 217 userPresence.OnlineYN = false;
218 218
219 for (int i = 0; i < AgentsNeedingNotification.Count; i++) 219 for (int i = 0; i < AgentsNeedingNotification.Count; i++)
220 { 220 {
221 UserPresenceData friendPresence = null; 221 UserPresenceData friendPresence = null;
222 lock (m_presences) 222 lock (m_presences)
223 { 223 {
224 m_presences.TryGetValue(AgentsNeedingNotification[i], out friendPresence); 224 m_presences.TryGetValue(AgentsNeedingNotification[i], out friendPresence);
225 } 225 }
226 226
227 // This might need to be enumerated and checked before we try to remove it. 227 // This might need to be enumerated and checked before we try to remove it.
228 if (friendPresence != null) 228 if (friendPresence != null)
229 { 229 {
230 lock (friendPresence) 230 lock (friendPresence)
231 { 231 {
232 // no updates for this user anymore 232 // no updates for this user anymore
233 friendPresence.subscriptionData.Remove(AgentID); 233 friendPresence.subscriptionData.Remove(AgentID);
234 234
235 // set user's entry in the friend's list to offline (if it exists) 235 // set user's entry in the friend's list to offline (if it exists)
236 if (friendPresence.friendData.ContainsKey(AgentID)) 236 if (friendPresence.friendData.ContainsKey(AgentID))
237 { 237 {
238 friendPresence.friendData[AgentID].onlinestatus = false; 238 friendPresence.friendData[AgentID].onlinestatus = false;
239 } 239 }
240 } 240 }
241 241
242 enqueuePresenceUpdate(userPresence, friendPresence); 242 enqueuePresenceUpdate(userPresence, friendPresence);
243 } 243 }
244 } 244 }
245 } 245 }
246 } 246 }
247 247
248 #endregion 248 #endregion
249 249
250 private void PresenceUpdateDone(PresenceInformer obj) 250 private void PresenceUpdateDone(PresenceInformer obj)
251 { 251 {
252 obj.OnGetRegionData -= m_regionModule.GetRegionInfo; 252 obj.OnGetRegionData -= m_regionModule.GetRegionInfo;
253 obj.OnDone -= PresenceUpdateDone; 253 obj.OnDone -= PresenceUpdateDone;
254 } 254 }
255 255
256 #region UserServer Comms 256 #region UserServer Comms
257 257
258 /// <summary> 258 /// <summary>
259 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend 259 /// Returns a list of FriendsListItems that describe the friends and permissions in the friend
260 /// relationship for UUID friendslistowner. For faster lookup, we index by friend's UUID. 260 /// relationship for UUID friendslistowner. For faster lookup, we index by friend's UUID.
261 /// </summary> 261 /// </summary>
262 /// <param name="friendlistowner">The agent that we're retreiving the friends Data for.</param> 262 /// <param name="friendlistowner">The agent that we're retreiving the friends Data for.</param>
263 private Dictionary<UUID, FriendListItem> GetUserFriendList(UUID friendlistowner) 263 private Dictionary<UUID, FriendListItem> GetUserFriendList(UUID friendlistowner)
264 { 264 {
265 Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>(); 265 Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>();
266 266
267 try 267 try
268 { 268 {
269 Hashtable param = new Hashtable(); 269 Hashtable param = new Hashtable();
270 param["ownerID"] = friendlistowner.ToString(); 270 param["ownerID"] = friendlistowner.ToString();
271 271
272 IList parameters = new ArrayList(); 272 IList parameters = new ArrayList();
273 parameters.Add(param); 273 parameters.Add(param);
274 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); 274 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
275 XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); 275 XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000);
276 Hashtable respData = (Hashtable)resp.Value; 276 Hashtable respData = (Hashtable)resp.Value;
277 277
278 if (respData.Contains("avcount")) 278 if (respData.Contains("avcount"))
279 { 279 {
280 buddies = ConvertXMLRPCDataToFriendListItemList(respData); 280 buddies = ConvertXMLRPCDataToFriendListItemList(respData);
281 } 281 }
282 282
283 } 283 }
284 catch (WebException e) 284 catch (WebException e)
285 { 285 {
286 m_log.Warn("Error when trying to fetch Avatar's friends list: " + 286 m_log.Warn("Error when trying to fetch Avatar's friends list: " +
287 e.Message); 287 e.Message);
288 // Return Empty list (no friends) 288 // Return Empty list (no friends)
289 } 289 }
290 return buddies; 290 return buddies;
291 } 291 }
292 292
293 /// <summary> 293 /// <summary>
294 /// Converts XMLRPC Friend List to FriendListItem Object 294 /// Converts XMLRPC Friend List to FriendListItem Object
295 /// </summary> 295 /// </summary>
296 /// <param name="data">XMLRPC response data Hashtable</param> 296 /// <param name="data">XMLRPC response data Hashtable</param>
297 /// <returns></returns> 297 /// <returns></returns>
298 public Dictionary<UUID, FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) 298 public Dictionary<UUID, FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
299 { 299 {
300 Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>(); 300 Dictionary<UUID, FriendListItem> buddies = new Dictionary<UUID,FriendListItem>();
301 int buddycount = Convert.ToInt32((string)data["avcount"]); 301 int buddycount = Convert.ToInt32((string)data["avcount"]);
302 302
303 for (int i = 0; i < buddycount; i++) 303 for (int i = 0; i < buddycount; i++)
304 { 304 {
305 FriendListItem buddylistitem = new FriendListItem(); 305 FriendListItem buddylistitem = new FriendListItem();
306 306
307 buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]); 307 buddylistitem.FriendListOwner = new UUID((string)data["ownerID" + i.ToString()]);
308 buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]); 308 buddylistitem.Friend = new UUID((string)data["friendID" + i.ToString()]);
309 buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); 309 buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]);
310 buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); 310 buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]);
311 311
312 buddies.Add(buddylistitem.Friend, buddylistitem); 312 buddies.Add(buddylistitem.Friend, buddylistitem);
313 } 313 }
314 314
315 return buddies; 315 return buddies;
316 } 316 }
317 317
318 /// <summary> 318 /// <summary>
319 /// UserServer sends an expect_user method 319 /// UserServer sends an expect_user method
320 /// this handles the method and provisions the 320 /// this handles the method and provisions the
321 /// necessary info for presence to work 321 /// necessary info for presence to work
322 /// </summary> 322 /// </summary>
323 /// <param name="request">UserServer Data</param> 323 /// <param name="request">UserServer Data</param>
324 /// <returns></returns> 324 /// <returns></returns>
325 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) 325 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request)
326 { 326 {
327 Hashtable requestData = (Hashtable)request.Params[0]; 327 Hashtable requestData = (Hashtable)request.Params[0];
328 328
329 AgentCircuitData agentData = new AgentCircuitData(); 329 AgentCircuitData agentData = new AgentCircuitData();
330 agentData.SessionID = new UUID((string)requestData["sessionid"]); 330 agentData.SessionID = new UUID((string)requestData["sessionid"]);
331 agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]); 331 agentData.SecureSessionID = new UUID((string)requestData["secure_session_id"]);
332 agentData.firstname = (string)requestData["firstname"]; 332 agentData.firstname = (string)requestData["firstname"];
333 agentData.lastname = (string)requestData["lastname"]; 333 agentData.lastname = (string)requestData["lastname"];
334 agentData.AgentID = new UUID((string)requestData["agentid"]); 334 agentData.AgentID = new UUID((string)requestData["agentid"]);
335 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 335 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
336 agentData.CapsPath = (string)requestData["caps_path"]; 336 agentData.CapsPath = (string)requestData["caps_path"];
337 337
338 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) 338 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
339 { 339 {
340 agentData.child = true; 340 agentData.child = true;
341 } 341 }
342 else 342 else
343 { 343 {
344 agentData.startpos = 344 agentData.startpos =
345 new Vector3(Convert.ToSingle(requestData["positionx"]), 345 new Vector3(Convert.ToSingle(requestData["positionx"]),
346 Convert.ToSingle(requestData["positiony"]), 346 Convert.ToSingle(requestData["positiony"]),
347 Convert.ToSingle(requestData["positionz"])); 347 Convert.ToSingle(requestData["positionz"]));
348 agentData.child = false; 348 agentData.child = false;
349 } 349 }
350 350
351 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); 351 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]);
352 352
353 m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user", 353 m_log.InfoFormat("[LOGON]: User {0} {1} logged into region {2} as {3} agent, building indexes for user",
354 agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root"); 354 agentData.firstname, agentData.lastname, regionHandle, agentData.child ? "child" : "root");
355 355
356 UserPresenceData up = new UserPresenceData(); 356 UserPresenceData up = new UserPresenceData();
357 up.agentData = agentData; 357 up.agentData = agentData;
358 up.friendData = GetUserFriendList(agentData.AgentID); 358 up.friendData = GetUserFriendList(agentData.AgentID);
359 up.regionData = m_regionModule.GetRegionInfo(regionHandle); 359 up.regionData = m_regionModule.GetRegionInfo(regionHandle);
360 up.OnlineYN = true; 360 up.OnlineYN = true;
361 up.lookupUserRegionYN = false; 361 up.lookupUserRegionYN = false;
362 ProcessFriendListSubscriptions(up); 362 ProcessFriendListSubscriptions(up);
363 363
364 return new XmlRpcResponse(); 364 return new XmlRpcResponse();
365 } 365 }
366 366
367 /// <summary> 367 /// <summary>
368 /// The UserServer got a Logoff message 368 /// The UserServer got a Logoff message
369 /// Cleanup time for that user. Send out presence notifications 369 /// Cleanup time for that user. Send out presence notifications
370 /// </summary> 370 /// </summary>
371 /// <param name="request"></param> 371 /// <param name="request"></param>
372 /// <returns></returns> 372 /// <returns></returns>
373 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) 373 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request)
374 { 374 {
375 m_log.Info("[USERLOGOFF]: User logged off called"); 375 m_log.Info("[USERLOGOFF]: User logged off called");
376 Hashtable requestData = (Hashtable)request.Params[0]; 376 Hashtable requestData = (Hashtable)request.Params[0];
377 377
378 UUID AgentID = new UUID((string)requestData["agentid"]); 378 UUID AgentID = new UUID((string)requestData["agentid"]);
379 ProcessLogOff(AgentID); 379 ProcessLogOff(AgentID);
380 380
381 return new XmlRpcResponse(); 381 return new XmlRpcResponse();
382 } 382 }
383 383
384 #endregion 384 #endregion
385 385
386 public XmlRpcResponse GetPresenceInfoBulk(XmlRpcRequest request) 386 public XmlRpcResponse GetPresenceInfoBulk(XmlRpcRequest request)
387 { 387 {
388 Hashtable paramHash = (Hashtable)request.Params[0]; 388 Hashtable paramHash = (Hashtable)request.Params[0];
389 Hashtable result = new Hashtable(); 389 Hashtable result = new Hashtable();
390 390
391 // TODO check access (recv_key/send_key) 391 // TODO check access (recv_key/send_key)
392 392
393 IList list = (IList)paramHash["uuids"]; 393 IList list = (IList)paramHash["uuids"];
394 394
395 // convert into List<UUID> 395 // convert into List<UUID>
396 List<UUID> uuids = new List<UUID>(); 396 List<UUID> uuids = new List<UUID>();
397 for (int i = 0; i < list.Count; ++i) 397 for (int i = 0; i < list.Count; ++i)
398 { 398 {
399 UUID uuid; 399 UUID uuid;
400 if (UUID.TryParse((string)list[i], out uuid)) 400 if (UUID.TryParse((string)list[i], out uuid))
401 { 401 {
402 uuids.Add(uuid); 402 uuids.Add(uuid);
403 } 403 }
404 } 404 }
405 405
406 try { 406 try {
407 Dictionary<UUID, FriendRegionInfo> infos = m_userDataBaseService.GetFriendRegionInfos(uuids); 407 Dictionary<UUID, FriendRegionInfo> infos = m_userDataBaseService.GetFriendRegionInfos(uuids);
408 m_log.DebugFormat("[FRIEND]: Got {0} region entries back.", infos.Count); 408 m_log.DebugFormat("[FRIEND]: Got {0} region entries back.", infos.Count);
409 int count = 0; 409 int count = 0;
410 foreach (KeyValuePair<UUID, FriendRegionInfo> pair in infos) 410 foreach (KeyValuePair<UUID, FriendRegionInfo> pair in infos)
411 { 411 {
412 result["uuid_" + count] = pair.Key.ToString(); 412 result["uuid_" + count] = pair.Key.ToString();
413 result["isOnline_" + count] = pair.Value.isOnline; 413 result["isOnline_" + count] = pair.Value.isOnline;
414 result["regionHandle_" + count] = pair.Value.regionHandle.ToString(); // XML-RPC doesn't know ulongs 414 result["regionHandle_" + count] = pair.Value.regionHandle.ToString(); // XML-RPC doesn't know ulongs
415 ++count; 415 ++count;
416 } 416 }
417 result["count"] = count; 417 result["count"] = count;
418 418
419 XmlRpcResponse response = new XmlRpcResponse(); 419 XmlRpcResponse response = new XmlRpcResponse();
420 response.Value = result; 420 response.Value = result;
421 return response; 421 return response;
422 } 422 }
423 catch(Exception e) { 423 catch(Exception e) {
424 m_log.Error("Got exception:", e); 424 m_log.Error("Got exception:", e);
425 throw e; 425 throw e;
426 } 426 }
427 } 427 }
428 428
429 public XmlRpcResponse AgentLocation(XmlRpcRequest request) 429 public XmlRpcResponse AgentLocation(XmlRpcRequest request)
430 { 430 {
431 Hashtable requestData = (Hashtable)request.Params[0]; 431 Hashtable requestData = (Hashtable)request.Params[0];
432 Hashtable result = new Hashtable(); 432 Hashtable result = new Hashtable();
433 result["success"] = "FALSE"; 433 result["success"] = "FALSE";
434 434
435 if (m_userServerModule.SendToUserServer(requestData, "agent_location")) 435 if (m_userServerModule.SendToUserServer(requestData, "agent_location"))
436 result["success"] = "TRUE"; 436 result["success"] = "TRUE";
437 437
438 438
439 XmlRpcResponse response = new XmlRpcResponse(); 439 XmlRpcResponse response = new XmlRpcResponse();
440 response.Value = result; 440 response.Value = result;
441 return response; 441 return response;
442 } 442 }
443 443
444 public XmlRpcResponse AgentLeaving(XmlRpcRequest request) 444 public XmlRpcResponse AgentLeaving(XmlRpcRequest request)
445 { 445 {
446 Hashtable requestData = (Hashtable)request.Params[0]; 446 Hashtable requestData = (Hashtable)request.Params[0];
447 Hashtable result = new Hashtable(); 447 Hashtable result = new Hashtable();
448 result["success"] = "FALSE"; 448 result["success"] = "FALSE";
449 449
450 if (m_userServerModule.SendToUserServer(requestData, "agent_leaving")) 450 if (m_userServerModule.SendToUserServer(requestData, "agent_leaving"))
451 result["success"] = "TRUE"; 451 result["success"] = "TRUE";
452 452
453 XmlRpcResponse response = new XmlRpcResponse(); 453 XmlRpcResponse response = new XmlRpcResponse();
454 response.Value = result; 454 response.Value = result;
455 return response; 455 return response;
456 } 456 }
457 457
458 public XmlRpcResponse ProcessRegionShutdown(XmlRpcRequest request) 458 public XmlRpcResponse ProcessRegionShutdown(XmlRpcRequest request)
459 { 459 {
460 Hashtable requestData = (Hashtable)request.Params[0]; 460 Hashtable requestData = (Hashtable)request.Params[0];
461 Hashtable result = new Hashtable(); 461 Hashtable result = new Hashtable();
462 result["success"] = "FALSE"; 462 result["success"] = "FALSE";
463 463
464 UUID regionID; 464 UUID regionID;
465 if (UUID.TryParse((string)requestData["regionid"], out regionID)) 465 if (UUID.TryParse((string)requestData["regionid"], out regionID))
466 { 466 {
467 m_log.DebugFormat("[PRESENCE] Processing region restart for {0}", regionID); 467 m_log.DebugFormat("[PRESENCE] Processing region restart for {0}", regionID);
468 result["success"] = "TRUE"; 468 result["success"] = "TRUE";
469 469
470 foreach (UserPresenceData up in m_presences.Values) 470 foreach (UserPresenceData up in m_presences.Values)
471 { 471 {
472 if (up.regionData.UUID == regionID) 472 if (up.regionData.UUID == regionID)
473 { 473 {
474 if (up.OnlineYN) 474 if (up.OnlineYN)
475 { 475 {
476 m_log.DebugFormat("[PRESENCE] Logging off {0} because the region they were in has gone", up.agentData.AgentID); 476 m_log.DebugFormat("[PRESENCE] Logging off {0} because the region they were in has gone", up.agentData.AgentID);
477 ProcessLogOff(up.agentData.AgentID); 477 ProcessLogOff(up.agentData.AgentID);
478 } 478 }
479 } 479 }
480 } 480 }
481 } 481 }
482 482
483 XmlRpcResponse response = new XmlRpcResponse(); 483 XmlRpcResponse response = new XmlRpcResponse();
484 response.Value = result; 484 response.Value = result;
485 return response; 485 return response;
486 } 486 }
487 } 487 }
488} \ No newline at end of file 488} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/MessageUserServerModule.cs b/OpenSim/Grid/MessagingServer.Modules/MessageUserServerModule.cs
index a97107c..9293b3e 100644
--- a/OpenSim/Grid/MessagingServer/MessageUserServerModule.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/MessageUserServerModule.cs
@@ -1,186 +1,186 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Threading;
34using System.Timers; 34using System.Timers;
35using log4net; 35using log4net;
36using Nwc.XmlRpc; 36using Nwc.XmlRpc;
37using OpenMetaverse; 37using OpenMetaverse;
38using OpenSim.Data; 38using OpenSim.Data;
39using OpenSim.Framework; 39using OpenSim.Framework;
40using OpenSim.Grid.Framework; 40using OpenSim.Grid.Framework;
41using Timer = System.Timers.Timer; 41using Timer = System.Timers.Timer;
42 42
43namespace OpenSim.Grid.MessagingServer 43namespace OpenSim.Grid.MessagingServer.Modules
44{ 44{
45 public class MessageUserServerModule : IMessageUserServerService 45 public class MessageUserServerModule : IMessageUserServerService
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private MessageServerConfig m_cfg; 49 private MessageServerConfig m_cfg;
50 50
51 private IUGAIMCore m_messageCore; 51 private IUGAIMCore m_messageCore;
52 52
53 private Timer reconnectTimer = new Timer(300000); // 5 mins 53 private Timer reconnectTimer = new Timer(300000); // 5 mins
54 54
55 public MessageUserServerModule(MessageServerConfig config, IUGAIMCore messageCore) 55 public MessageUserServerModule(MessageServerConfig config, IUGAIMCore messageCore)
56 { 56 {
57 m_cfg = config; 57 m_cfg = config;
58 m_messageCore = messageCore; 58 m_messageCore = messageCore;
59 59
60 reconnectTimer.Elapsed += registerWithUserServer; 60 reconnectTimer.Elapsed += registerWithUserServer;
61 reconnectTimer.Start(); 61 reconnectTimer.Start();
62 } 62 }
63 63
64 public void Initialise() 64 public void Initialise()
65 { 65 {
66 m_messageCore.RegisterInterface<IMessageUserServerService>(this); 66 m_messageCore.RegisterInterface<IMessageUserServerService>(this);
67 } 67 }
68 68
69 public void PostInitialise() 69 public void PostInitialise()
70 { 70 {
71 71
72 } 72 }
73 73
74 public void RegisterHandlers() 74 public void RegisterHandlers()
75 { 75 {
76 //have these in separate method as some servers restart the http server and reregister all the handlers. 76 //have these in separate method as some servers restart the http server and reregister all the handlers.
77 77
78 } 78 }
79 79
80 public void registerWithUserServer(object sender, ElapsedEventArgs e) 80 public void registerWithUserServer(object sender, ElapsedEventArgs e)
81 { 81 {
82 registerWithUserServer(); 82 registerWithUserServer();
83 } 83 }
84 84
85 public bool registerWithUserServer() 85 public bool registerWithUserServer()
86 { 86 {
87 Hashtable UserParams = new Hashtable(); 87 Hashtable UserParams = new Hashtable();
88 // Login / Authentication 88 // Login / Authentication
89 89
90 if (m_cfg.HttpSSL) 90 if (m_cfg.HttpSSL)
91 { 91 {
92 UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 92 UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
93 } 93 }
94 else 94 else
95 { 95 {
96 UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 96 UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
97 } 97 }
98 98
99 UserParams["recvkey"] = m_cfg.UserRecvKey; 99 UserParams["recvkey"] = m_cfg.UserRecvKey;
100 UserParams["sendkey"] = m_cfg.UserRecvKey; 100 UserParams["sendkey"] = m_cfg.UserRecvKey;
101 101
102 // Package into an XMLRPC Request 102 // Package into an XMLRPC Request
103 ArrayList SendParams = new ArrayList(); 103 ArrayList SendParams = new ArrayList();
104 SendParams.Add(UserParams); 104 SendParams.Add(UserParams);
105 105
106 bool success = true; 106 bool success = true;
107 string[] servers = m_cfg.UserServerURL.Split(' '); 107 string[] servers = m_cfg.UserServerURL.Split(' ');
108 108
109 foreach (string srv in servers) 109 foreach (string srv in servers)
110 { 110 {
111 // Send Request 111 // Send Request
112 try 112 try
113 { 113 {
114 XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams); 114 XmlRpcRequest UserReq = new XmlRpcRequest("register_messageserver", SendParams);
115 XmlRpcResponse UserResp = UserReq.Send(srv, 16000); 115 XmlRpcResponse UserResp = UserReq.Send(srv, 16000);
116 116
117 // Process Response 117 // Process Response
118 Hashtable GridRespData = (Hashtable)UserResp.Value; 118 Hashtable GridRespData = (Hashtable)UserResp.Value;
119 // if we got a response, we were successful 119 // if we got a response, we were successful
120 if (!GridRespData.ContainsKey("responsestring")) 120 if (!GridRespData.ContainsKey("responsestring"))
121 success = false; 121 success = false;
122 else 122 else
123 m_log.InfoFormat("[SERVER] Registered with {0}", srv); 123 m_log.InfoFormat("[SERVER] Registered with {0}", srv);
124 } 124 }
125 catch 125 catch
126 { 126 {
127 m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); 127 m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv);
128 success = false; 128 success = false;
129 } 129 }
130 } 130 }
131 return success; 131 return success;
132 } 132 }
133 133
134 public bool deregisterWithUserServer() 134 public bool deregisterWithUserServer()
135 { 135 {
136 Hashtable request = new Hashtable(); 136 Hashtable request = new Hashtable();
137 137
138 return SendToUserServer(request, "deregister_messageserver"); 138 return SendToUserServer(request, "deregister_messageserver");
139 } 139 }
140 140
141 public bool SendToUserServer(Hashtable request, string method) 141 public bool SendToUserServer(Hashtable request, string method)
142 { 142 {
143 // Login / Authentication 143 // Login / Authentication
144 144
145 if (m_cfg.HttpSSL) 145 if (m_cfg.HttpSSL)
146 { 146 {
147 request["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 147 request["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
148 } 148 }
149 else 149 else
150 { 150 {
151 request["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 151 request["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
152 } 152 }
153 153
154 request["recvkey"] = m_cfg.UserRecvKey; 154 request["recvkey"] = m_cfg.UserRecvKey;
155 request["sendkey"] = m_cfg.UserRecvKey; 155 request["sendkey"] = m_cfg.UserRecvKey;
156 156
157 // Package into an XMLRPC Request 157 // Package into an XMLRPC Request
158 ArrayList SendParams = new ArrayList(); 158 ArrayList SendParams = new ArrayList();
159 SendParams.Add(request); 159 SendParams.Add(request);
160 160
161 bool success = true; 161 bool success = true;
162 string[] servers = m_cfg.UserServerURL.Split(' '); 162 string[] servers = m_cfg.UserServerURL.Split(' ');
163 163
164 // Send Request 164 // Send Request
165 foreach (string srv in servers) 165 foreach (string srv in servers)
166 { 166 {
167 try 167 try
168 { 168 {
169 XmlRpcRequest UserReq = new XmlRpcRequest(method, SendParams); 169 XmlRpcRequest UserReq = new XmlRpcRequest(method, SendParams);
170 XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); 170 XmlRpcResponse UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
171 // Process Response 171 // Process Response
172 Hashtable UserRespData = (Hashtable)UserResp.Value; 172 Hashtable UserRespData = (Hashtable)UserResp.Value;
173 // if we got a response, we were successful 173 // if we got a response, we were successful
174 if (!UserRespData.ContainsKey("responsestring")) 174 if (!UserRespData.ContainsKey("responsestring"))
175 success = false; 175 success = false;
176 } 176 }
177 catch 177 catch
178 { 178 {
179 m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv); 179 m_log.ErrorFormat("Unable to connect to server {0}. Server not running?", srv);
180 success = false; 180 success = false;
181 } 181 }
182 } 182 }
183 return success; 183 return success;
184 } 184 }
185 } 185 }
186} 186}
diff --git a/OpenSim/Grid/MessagingServer/PresenceBackreferenceEntry.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs
index 08566bb..b6023e3 100644
--- a/OpenSim/Grid/MessagingServer/PresenceBackreferenceEntry.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/PresenceBackreferenceEntry.cs
@@ -1,96 +1,96 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using OpenMetaverse; 29using OpenMetaverse;
30 30
31namespace OpenSim.Grid.MessagingServer 31namespace OpenSim.Grid.MessagingServer.Modules
32{ 32{
33 // This is a wrapper for a List<UUID> so it can be happily stored in a hashtable. 33 // This is a wrapper for a List<UUID> so it can be happily stored in a hashtable.
34 public class PresenceBackreferenceEntry 34 public class PresenceBackreferenceEntry
35 { 35 {
36 List<UUID> AgentList = new List<UUID>(); 36 List<UUID> AgentList = new List<UUID>();
37 37
38 public PresenceBackreferenceEntry() 38 public PresenceBackreferenceEntry()
39 { 39 {
40 40
41 } 41 }
42 42
43 public void Add(UUID item) 43 public void Add(UUID item)
44 { 44 {
45 lock (AgentList) 45 lock (AgentList)
46 { 46 {
47 AgentList.Add(item); 47 AgentList.Add(item);
48 } 48 }
49 } 49 }
50 50
51 public UUID getitem(int index) 51 public UUID getitem(int index)
52 { 52 {
53 UUID result = UUID.Zero; 53 UUID result = UUID.Zero;
54 lock (AgentList) 54 lock (AgentList)
55 { 55 {
56 if (index > 0 && index < AgentList.Count) 56 if (index > 0 && index < AgentList.Count)
57 { 57 {
58 result = AgentList[index]; 58 result = AgentList[index];
59 } 59 }
60 } 60 }
61 return result; 61 return result;
62 } 62 }
63 63
64 public int Count 64 public int Count
65 { 65 {
66 get 66 get
67 { 67 {
68 int count = 0; 68 int count = 0;
69 lock (AgentList) 69 lock (AgentList)
70 { 70 {
71 count = AgentList.Count; 71 count = AgentList.Count;
72 } 72 }
73 return count; 73 return count;
74 } 74 }
75 } 75 }
76 76
77 public void Remove(UUID item) 77 public void Remove(UUID item)
78 { 78 {
79 lock (AgentList) 79 lock (AgentList)
80 { 80 {
81 if (AgentList.Contains(item)) 81 if (AgentList.Contains(item))
82 AgentList.Remove(item); 82 AgentList.Remove(item);
83 } 83 }
84 } 84 }
85 85
86 public bool contains(UUID item) 86 public bool contains(UUID item)
87 { 87 {
88 bool result = false; 88 bool result = false;
89 lock (AgentList) 89 lock (AgentList)
90 { 90 {
91 result = AgentList.Contains(item); 91 result = AgentList.Contains(item);
92 } 92 }
93 return result; 93 return result;
94 } 94 }
95 } 95 }
96} 96}
diff --git a/OpenSim/Grid/MessagingServer/PresenceInformer.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs
index a8c98f6..5d13c1b 100644
--- a/OpenSim/Grid/MessagingServer/PresenceInformer.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/PresenceInformer.cs
@@ -1,135 +1,135 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.Collections; 28using System.Collections;
29using System.Net; 29using System.Net;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Nwc.XmlRpc; 32using Nwc.XmlRpc;
33using OpenSim.Data; 33using OpenSim.Data;
34 34
35namespace OpenSim.Grid.MessagingServer 35namespace OpenSim.Grid.MessagingServer.Modules
36{ 36{
37 public delegate RegionProfileData GetRegionData(ulong region_handle); 37 public delegate RegionProfileData GetRegionData(ulong region_handle);
38 public delegate void Done(PresenceInformer obj); 38 public delegate void Done(PresenceInformer obj);
39 39
40 40
41 public class PresenceInformer 41 public class PresenceInformer
42 { 42 {
43 public event GetRegionData OnGetRegionData; 43 public event GetRegionData OnGetRegionData;
44 public event Done OnDone; 44 public event Done OnDone;
45 45
46 private GetRegionData handlerGetRegionData = null; 46 private GetRegionData handlerGetRegionData = null;
47 private Done handlerDone = null; 47 private Done handlerDone = null;
48 48
49 public UserPresenceData presence1 = null; 49 public UserPresenceData presence1 = null;
50 public UserPresenceData presence2 = null; 50 public UserPresenceData presence2 = null;
51 public string gridserverurl, gridserversendkey, gridserverrecvkey; 51 public string gridserverurl, gridserversendkey, gridserverrecvkey;
52 public bool lookupRegion = true; 52 public bool lookupRegion = true;
53 //public methodGroup 53 //public methodGroup
54 54
55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 55 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
56 56
57 public PresenceInformer() 57 public PresenceInformer()
58 { 58 {
59 59
60 } 60 }
61 public void go(object o) 61 public void go(object o)
62 { 62 {
63 if (presence1 != null && presence2 != null) 63 if (presence1 != null && presence2 != null)
64 { 64 {
65 SendRegionPresenceUpdate(presence1, presence2); 65 SendRegionPresenceUpdate(presence1, presence2);
66 } 66 }
67 67
68 } 68 }
69 69
70 /// <summary> 70 /// <summary>
71 /// Informs a region about an Agent 71 /// Informs a region about an Agent
72 /// </summary> 72 /// </summary>
73 /// <param name="TalkingAbout">User to talk about</param> 73 /// <param name="TalkingAbout">User to talk about</param>
74 /// <param name="UserToUpdate">User we're sending this too (contains the region)</param> 74 /// <param name="UserToUpdate">User we're sending this too (contains the region)</param>
75 public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate) 75 public void SendRegionPresenceUpdate(UserPresenceData TalkingAbout, UserPresenceData UserToUpdate)
76 { 76 {
77 // TODO: Fill in pertenant Presence Data from 'TalkingAbout' 77 // TODO: Fill in pertenant Presence Data from 'TalkingAbout'
78 RegionProfileData whichRegion = new RegionProfileData(); 78 RegionProfileData whichRegion = new RegionProfileData();
79 if (lookupRegion) 79 if (lookupRegion)
80 { 80 {
81 handlerGetRegionData = OnGetRegionData; 81 handlerGetRegionData = OnGetRegionData;
82 if (handlerGetRegionData != null) 82 if (handlerGetRegionData != null)
83 { 83 {
84 whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle); 84 whichRegion = handlerGetRegionData(UserToUpdate.regionData.regionHandle);
85 } 85 }
86 //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey); 86 //RegionProfileData rp = RegionProfileData.RequestSimProfileData(UserToUpdate.regionData.regionHandle, gridserverurl, gridserversendkey, gridserverrecvkey);
87 87
88 //whichRegion = rp; 88 //whichRegion = rp;
89 } 89 }
90 else 90 else
91 { 91 {
92 whichRegion = UserToUpdate.regionData; 92 whichRegion = UserToUpdate.regionData;
93 } 93 }
94 //whichRegion.httpServerURI 94 //whichRegion.httpServerURI
95 95
96 if (whichRegion != null) 96 if (whichRegion != null)
97 { 97 {
98 Hashtable PresenceParams = new Hashtable(); 98 Hashtable PresenceParams = new Hashtable();
99 PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString()); 99 PresenceParams.Add("agent_id",TalkingAbout.agentData.AgentID.ToString());
100 PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString()); 100 PresenceParams.Add("notify_id",UserToUpdate.agentData.AgentID.ToString());
101 if (TalkingAbout.OnlineYN) 101 if (TalkingAbout.OnlineYN)
102 PresenceParams.Add("status","TRUE"); 102 PresenceParams.Add("status","TRUE");
103 else 103 else
104 PresenceParams.Add("status","FALSE"); 104 PresenceParams.Add("status","FALSE");
105 105
106 ArrayList SendParams = new ArrayList(); 106 ArrayList SendParams = new ArrayList();
107 SendParams.Add(PresenceParams); 107 SendParams.Add(PresenceParams);
108 108
109 m_log.InfoFormat("[PRESENCE]: Informing {0}@{1} at {2} about {3}", TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname, whichRegion.regionName, whichRegion.httpServerURI, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname); 109 m_log.InfoFormat("[PRESENCE]: Informing {0}@{1} at {2} about {3}", TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname, whichRegion.regionName, whichRegion.httpServerURI, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname);
110 // Send 110 // Send
111 XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams); 111 XmlRpcRequest RegionReq = new XmlRpcRequest("presence_update", SendParams);
112 try 112 try
113 { 113 {
114 // XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); 114 // XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
115 RegionReq.Send(whichRegion.httpServerURI, 6000); 115 RegionReq.Send(whichRegion.httpServerURI, 6000);
116 } 116 }
117 catch (WebException) 117 catch (WebException)
118 { 118 {
119 m_log.WarnFormat("[INFORM]: failed notifying region {0} containing user {1} about {2}", whichRegion.regionName, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname, TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname); 119 m_log.WarnFormat("[INFORM]: failed notifying region {0} containing user {1} about {2}", whichRegion.regionName, UserToUpdate.agentData.firstname + " " + UserToUpdate.agentData.lastname, TalkingAbout.agentData.firstname + " " + TalkingAbout.agentData.lastname);
120 } 120 }
121 } 121 }
122 else 122 else
123 { 123 {
124 m_log.Info("[PRESENCEUPDATER]: Region data was null skipping"); 124 m_log.Info("[PRESENCEUPDATER]: Region data was null skipping");
125 125
126 } 126 }
127 127
128 handlerDone = OnDone; 128 handlerDone = OnDone;
129 if (handlerDone != null) 129 if (handlerDone != null)
130 { 130 {
131 handlerDone(this); 131 handlerDone(this);
132 } 132 }
133 } 133 }
134 } 134 }
135} 135}
diff --git a/OpenSim/Grid/MessagingServer/PresenceService.cs b/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs
index d8cb755..cacc34e 100644
--- a/OpenSim/Grid/MessagingServer/PresenceService.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/PresenceService.cs
@@ -1,33 +1,33 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28namespace OpenSim.Grid.MessagingServer 28namespace OpenSim.Grid.MessagingServer.Modules
29{ 29{
30 class PresenceService 30 class PresenceService
31 { 31 {
32 } 32 }
33} 33}
diff --git a/OpenSim/Grid/MessagingServer/UserDataBaseService.cs b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs
index 32d5e61..ee1da86 100644
--- a/OpenSim/Grid/MessagingServer/UserDataBaseService.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/UserDataBaseService.cs
@@ -1,75 +1,75 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenSim.Framework.Communications; 30using OpenSim.Framework.Communications;
31 31
32namespace OpenSim.Grid.MessagingServer 32namespace OpenSim.Grid.MessagingServer.Modules
33{ 33{
34 public class UserDataBaseService : UserManagerBase 34 public class UserDataBaseService : UserManagerBase
35 { 35 {
36 /// <summary> 36 /// <summary>
37 /// Constructor. 37 /// Constructor.
38 /// </summary> 38 /// </summary>
39 /// Passing null to parent because we never use any function that requires an interservice inventory call. 39 /// Passing null to parent because we never use any function that requires an interservice inventory call.
40 public UserDataBaseService() 40 public UserDataBaseService()
41 : base(null) 41 : base(null)
42 { 42 {
43 } 43 }
44 44
45 public UserAgentData GetUserAgentData(UUID AgentID) 45 public UserAgentData GetUserAgentData(UUID AgentID)
46 { 46 {
47 UserProfileData userProfile = GetUserProfile(AgentID); 47 UserProfileData userProfile = GetUserProfile(AgentID);
48 48
49 if (userProfile != null) 49 if (userProfile != null)
50 { 50 {
51 return userProfile.CurrentAgent; 51 return userProfile.CurrentAgent;
52 } 52 }
53 53
54 return null; 54 return null;
55 } 55 }
56 56
57 public override UserProfileData SetupMasterUser(string firstName, string lastName) 57 public override UserProfileData SetupMasterUser(string firstName, string lastName)
58 { 58 {
59 //throw new Exception("The method or operation is not implemented."); 59 //throw new Exception("The method or operation is not implemented.");
60 return null; 60 return null;
61 } 61 }
62 62
63 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) 63 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
64 { 64 {
65 //throw new Exception("The method or operation is not implemented."); 65 //throw new Exception("The method or operation is not implemented.");
66 return null; 66 return null;
67 } 67 }
68 68
69 public override UserProfileData SetupMasterUser(UUID uuid) 69 public override UserProfileData SetupMasterUser(UUID uuid)
70 { 70 {
71 //throw new Exception("The method or operation is not implemented."); 71 //throw new Exception("The method or operation is not implemented.");
72 return null; 72 return null;
73 } 73 }
74 } 74 }
75} 75}
diff --git a/OpenSim/Grid/MessagingServer/UserPresenceData.cs b/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs
index d548fc6..2b56fe8 100644
--- a/OpenSim/Grid/MessagingServer/UserPresenceData.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/UserPresenceData.cs
@@ -1,50 +1,50 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Data; 31using OpenSim.Data;
32using OpenSim.Framework; 32using OpenSim.Framework;
33 33
34namespace OpenSim.Grid.MessagingServer 34namespace OpenSim.Grid.MessagingServer
35{ 35{
36 public class UserPresenceData 36 public class UserPresenceData
37 { 37 {
38 public AgentCircuitData agentData = new AgentCircuitData(); 38 public AgentCircuitData agentData = new AgentCircuitData();
39 public RegionProfileData regionData = new RegionProfileData(); 39 public RegionProfileData regionData = new RegionProfileData();
40 public string httpURI = String.Empty; 40 public string httpURI = String.Empty;
41 public Dictionary<UUID, FriendListItem> friendData = new Dictionary<UUID,FriendListItem>(); 41 public Dictionary<UUID, FriendListItem> friendData = new Dictionary<UUID,FriendListItem>();
42 public List<UUID> subscriptionData = new List<UUID>(); 42 public List<UUID> subscriptionData = new List<UUID>();
43 public bool OnlineYN = true; 43 public bool OnlineYN = true;
44 public bool lookupUserRegionYN = true; 44 public bool lookupUserRegionYN = true;
45 45
46 public UserPresenceData() 46 public UserPresenceData()
47 { 47 {
48 } 48 }
49 } 49 }
50} 50}
diff --git a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs b/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs
index d25f044..cbd9443 100644
--- a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/WorkUnitBase.cs
@@ -1,33 +1,33 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28namespace OpenSim.Grid.MessagingServer 28namespace OpenSim.Grid.MessagingServer.Modules
29{ 29{
30 public class WorkUnitBase 30 public class WorkUnitBase
31 { 31 {
32 } 32 }
33} 33}
diff --git a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs b/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs
index c31f0c7..7150cea 100644
--- a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/WorkUnitPresenceUpdate.cs
@@ -1,33 +1,33 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28namespace OpenSim.Grid.MessagingServer 28namespace OpenSim.Grid.MessagingServer.Modules
29{ 29{
30 public class WorkUnitPresenceUpdate : WorkUnitBase 30 public class WorkUnitPresenceUpdate : WorkUnitBase
31 { 31 {
32 } 32 }
33} 33}
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index 43d1af9..420e8d5 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37using OpenSim.Grid.Framework; 37using OpenSim.Grid.Framework;
38using OpenSim.Grid.MessagingServer.Modules;
38 39
39namespace OpenSim.Grid.MessagingServer 40namespace OpenSim.Grid.MessagingServer
40{ 41{
diff --git a/prebuild.xml b/prebuild.xml
index 21b3729..6fad329 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1033,6 +1033,39 @@
1033 </Files> 1033 </Files>
1034 </Project> 1034 </Project>
1035 1035
1036 <Project name="OpenSim.Grid.MessagingServer.Modules" path="OpenSim/Grid/MessagingServer.Modules" type="Library">
1037 <Configuration name="Debug">
1038 <Options>
1039 <OutputPath>../../../bin/</OutputPath>
1040 </Options>
1041 </Configuration>
1042 <Configuration name="Release">
1043 <Options>
1044 <OutputPath>../../../bin/</OutputPath>
1045 </Options>
1046 </Configuration>
1047
1048 <ReferencePath>../../../bin/</ReferencePath>
1049 <Reference name="System"/>
1050 <Reference name="System.Data"/>
1051 <Reference name="System.Xml"/>
1052 <Reference name="OpenSim.Framework"/>
1053 <Reference name="OpenSim.Framework.Console"/>
1054 <Reference name="OpenSim.Framework.Communications"/>
1055 <Reference name="OpenSim.Data"/>
1056 <Reference name="OpenSim.Framework.Servers"/>
1057 <Reference name="OpenSim.Grid.Framework"/>
1058 <Reference name="OpenMetaverseTypes.dll"/>
1059 <Reference name="OpenMetaverse.dll"/>
1060 <Reference name="XMLRPC.dll"/>
1061 <Reference name="log4net.dll"/>
1062
1063 <Files>
1064 <Match pattern="*.cs" recurse="true"/>
1065 </Files>
1066 </Project>
1067
1068
1036 <Project name="OpenSim.Grid.MessagingServer" path="OpenSim/Grid/MessagingServer" type="Exe"> 1069 <Project name="OpenSim.Grid.MessagingServer" path="OpenSim/Grid/MessagingServer" type="Exe">
1037 <Configuration name="Debug"> 1070 <Configuration name="Debug">
1038 <Options> 1071 <Options>
@@ -1055,6 +1088,7 @@
1055 <Reference name="OpenSim.Data"/> 1088 <Reference name="OpenSim.Data"/>
1056 <Reference name="OpenSim.Framework.Servers"/> 1089 <Reference name="OpenSim.Framework.Servers"/>
1057 <Reference name="OpenSim.Grid.Framework"/> 1090 <Reference name="OpenSim.Grid.Framework"/>
1091 <Reference name="OpenSim.Grid.MessagingServer.Modules"/>
1058 <Reference name="OpenMetaverseTypes.dll"/> 1092 <Reference name="OpenMetaverseTypes.dll"/>
1059 <Reference name="OpenMetaverse.dll"/> 1093 <Reference name="OpenMetaverse.dll"/>
1060 <Reference name="XMLRPC.dll"/> 1094 <Reference name="XMLRPC.dll"/>