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