aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/MessagingServer/MessageService.cs
diff options
context:
space:
mode:
authorJeff Ames2008-03-18 05:16:43 +0000
committerJeff Ames2008-03-18 05:16:43 +0000
commit47180080f0f4b93c60232b47ca4e093bd7c73a1d (patch)
tree780f51135995bb4be311e6f2b331cfa5c4b16d9d /OpenSim/Grid/MessagingServer/MessageService.cs
parentAdded copyright messages. Set svn:eol-style. Minor cleanup. (diff)
downloadopensim-SC-47180080f0f4b93c60232b47ca4e093bd7c73a1d.zip
opensim-SC-47180080f0f4b93c60232b47ca4e093bd7c73a1d.tar.gz
opensim-SC-47180080f0f4b93c60232b47ca4e093bd7c73a1d.tar.bz2
opensim-SC-47180080f0f4b93c60232b47ca4e093bd7c73a1d.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Grid/MessagingServer/MessageService.cs')
-rw-r--r--OpenSim/Grid/MessagingServer/MessageService.cs107
1 files changed, 39 insertions, 68 deletions
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs
index fc16a88..c4e8a58 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer/MessageService.cs
@@ -1,30 +1,30 @@
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.Net; 29using System.Net;
30using System.Net.Sockets; 30using System.Net.Sockets;
@@ -60,8 +60,6 @@ namespace OpenSim.Grid.MessagingServer
60 // Hashtable containing work units that need to be processed 60 // Hashtable containing work units that need to be processed
61 private Hashtable m_unProcessedWorkUnits = new Hashtable(); 61 private Hashtable m_unProcessedWorkUnits = new Hashtable();
62 62
63
64
65 public MessageService(MessageServerConfig cfg) 63 public MessageService(MessageServerConfig cfg)
66 { 64 {
67 m_cfg = cfg; 65 m_cfg = cfg;
@@ -69,11 +67,9 @@ namespace OpenSim.Grid.MessagingServer
69 67
70 #region RegionComms Methods 68 #region RegionComms Methods
71 69
72
73 #endregion 70 #endregion
74 71
75 #region FriendList Methods 72 #region FriendList Methods
76
77 73
78 /// <summary> 74 /// <summary>
79 /// Process Friendlist subscriptions for a user 75 /// Process Friendlist subscriptions for a user
@@ -102,8 +98,6 @@ namespace OpenSim.Grid.MessagingServer
102 SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i); 98 SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i);
103 } 99 }
104 } 100 }
105
106
107 } 101 }
108 102
109 /// <summary> 103 /// <summary>
@@ -118,7 +112,6 @@ namespace OpenSim.Grid.MessagingServer
118 public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence, 112 public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence,
119 FriendListItem uFriendListItem, int uFriendListIndex) 113 FriendListItem uFriendListItem, int uFriendListIndex)
120 { 114 {
121
122 if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) 115 if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0)
123 { 116 {
124 // Subscribe and Send Out updates 117 // Subscribe and Send Out updates
@@ -126,12 +119,10 @@ namespace OpenSim.Grid.MessagingServer
126 { 119 {
127 userpresence.subscriptionData.Add(friendpresence.agentData.AgentID); 120 userpresence.subscriptionData.Add(friendpresence.agentData.AgentID);
128 //Send Region Notice.... 121 //Send Region Notice....
129
130 } 122 }
131 else 123 else
132 { 124 {
133 // we need to send out online status update, but the user is already subscribed 125 // we need to send out online status update, but the user is already subscribed
134
135 } 126 }
136 PresenceInformer friendlistupdater = new PresenceInformer(); 127 PresenceInformer friendlistupdater = new PresenceInformer();
137 friendlistupdater.presence1 = friendpresence; 128 friendlistupdater.presence1 = friendpresence;
@@ -141,6 +132,7 @@ namespace OpenSim.Grid.MessagingServer
141 132
142 //SendRegionPresenceUpdate(friendpresence, userpresence); 133 //SendRegionPresenceUpdate(friendpresence, userpresence);
143 } 134 }
135
144 if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) 136 if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0)
145 { 137 {
146 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) 138 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
@@ -151,7 +143,6 @@ namespace OpenSim.Grid.MessagingServer
151 else 143 else
152 { 144 {
153 // we need to send out online status update, but the user is already subscribed 145 // we need to send out online status update, but the user is already subscribed
154
155 } 146 }
156 PresenceInformer friendlistupdater = new PresenceInformer(); 147 PresenceInformer friendlistupdater = new PresenceInformer();
157 friendlistupdater.presence1 = userpresence; 148 friendlistupdater.presence1 = userpresence;
@@ -162,10 +153,8 @@ namespace OpenSim.Grid.MessagingServer
162 153
163 //SendRegionPresenceUpdate(userpresence, friendpresence); 154 //SendRegionPresenceUpdate(userpresence, friendpresence);
164 } 155 }
165
166 } 156 }
167 157
168
169 /// <summary> 158 /// <summary>
170 /// Adds a backreference so presence specific data doesn't have to be 159 /// Adds a backreference so presence specific data doesn't have to be
171 /// enumerated for each logged in user every time someone logs on or off. 160 /// enumerated for each logged in user every time someone logs on or off.
@@ -214,6 +203,7 @@ namespace OpenSim.Grid.MessagingServer
214 } 203 }
215 } 204 }
216 } 205 }
206
217 /// <summary> 207 /// <summary>
218 /// Logoff Processor. Call this to clean up agent presence data and send logoff presence notifications 208 /// Logoff Processor. Call this to clean up agent presence data and send logoff presence notifications
219 /// </summary> 209 /// </summary>
@@ -242,7 +232,6 @@ namespace OpenSim.Grid.MessagingServer
242 //} 232 //}
243 //} 233 //}
244 234
245
246 for (int i = 0; i < AgentsNeedingNotification.Count; i++) 235 for (int i = 0; i < AgentsNeedingNotification.Count; i++)
247 { 236 {
248 // TODO: Do Region Notifications 237 // TODO: Do Region Notifications
@@ -254,7 +243,7 @@ namespace OpenSim.Grid.MessagingServer
254 } 243 }
255 } 244 }
256 245
257 // This might need to be enumerated and checked before we try to remove it. 246 // This might need to be enumerated and checked before we try to remove it.
258 if (friendd != null) 247 if (friendd != null)
259 { 248 {
260 lock (friendd) 249 lock (friendd)
@@ -268,12 +257,12 @@ namespace OpenSim.Grid.MessagingServer
268 { 257 {
269 fl[j].onlinestatus = false; 258 fl[j].onlinestatus = false;
270 } 259 }
271
272 } 260 }
261
273 friendd.friendData = fl; 262 friendd.friendData = fl;
274 m_presences[AgentsNeedingNotification[i]] = friendd; 263 m_presences[AgentsNeedingNotification[i]] = friendd;
275
276 } 264 }
265
277 PresenceInformer friendlistupdater = new PresenceInformer(); 266 PresenceInformer friendlistupdater = new PresenceInformer();
278 friendlistupdater.presence1 = AgentData; 267 friendlistupdater.presence1 = AgentData;
279 friendlistupdater.presence2 = friendd; 268 friendlistupdater.presence2 = friendd;
@@ -283,17 +272,12 @@ namespace OpenSim.Grid.MessagingServer
283 272
284 //SendRegionPresenceUpdate(AgentData, friendd); 273 //SendRegionPresenceUpdate(AgentData, friendd);
285 274
286
287 //removeBackReference(AgentID, AgentsNeedingNotification[i]); 275 //removeBackReference(AgentID, AgentsNeedingNotification[i]);
288 } 276 }
289
290 } 277 }
291
292 } 278 }
293
294 } 279 }
295 280
296
297 #endregion 281 #endregion
298 282
299 #region UserServer Comms 283 #region UserServer Comms
@@ -330,7 +314,6 @@ namespace OpenSim.Grid.MessagingServer
330 // Return Empty list (no friends) 314 // Return Empty list (no friends)
331 } 315 }
332 return buddylist; 316 return buddylist;
333
334 } 317 }
335 318
336 /// <summary> 319 /// <summary>
@@ -343,7 +326,6 @@ namespace OpenSim.Grid.MessagingServer
343 List<FriendListItem> buddylist = new List<FriendListItem>(); 326 List<FriendListItem> buddylist = new List<FriendListItem>();
344 int buddycount = Convert.ToInt32((string)data["avcount"]); 327 int buddycount = Convert.ToInt32((string)data["avcount"]);
345 328
346
347 for (int i = 0; i < buddycount; i++) 329 for (int i = 0; i < buddycount; i++)
348 { 330 {
349 FriendListItem buddylistitem = new FriendListItem(); 331 FriendListItem buddylistitem = new FriendListItem();
@@ -356,9 +338,9 @@ namespace OpenSim.Grid.MessagingServer
356 buddylist.Add(buddylistitem); 338 buddylist.Add(buddylistitem);
357 } 339 }
358 340
359
360 return buddylist; 341 return buddylist;
361 } 342 }
343
362 /// <summary> 344 /// <summary>
363 /// UserServer sends an expect_user method 345 /// UserServer sends an expect_user method
364 /// this handles the method and provisions the 346 /// this handles the method and provisions the
@@ -415,7 +397,6 @@ namespace OpenSim.Grid.MessagingServer
415 397
416 ProcessFriendListSubscriptions(up); 398 ProcessFriendListSubscriptions(up);
417 399
418
419 return new XmlRpcResponse(); 400 return new XmlRpcResponse();
420 } 401 }
421 402
@@ -427,19 +408,17 @@ namespace OpenSim.Grid.MessagingServer
427 /// <returns></returns> 408 /// <returns></returns>
428 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) 409 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request)
429 { 410 {
430
431 Hashtable requestData = (Hashtable)request.Params[0]; 411 Hashtable requestData = (Hashtable)request.Params[0];
432 412
433 LLUUID AgentID = new LLUUID((string)requestData["agentid"]); 413 LLUUID AgentID = new LLUUID((string)requestData["agentid"]);
434 414
435
436 ProcessLogOff(AgentID); 415 ProcessLogOff(AgentID);
437 416
438
439 return new XmlRpcResponse(); 417 return new XmlRpcResponse();
440 } 418 }
441 419
442 #endregion 420 #endregion
421
443 #region regioninfo gathering 422 #region regioninfo gathering
444 423
445 /// <summary> 424 /// <summary>
@@ -461,6 +440,7 @@ namespace OpenSim.Grid.MessagingServer
461 } 440 }
462 return regionInfo; 441 return regionInfo;
463 } 442 }
443
464 /// <summary> 444 /// <summary>
465 /// Get RegionProfileData from the GridServer 445 /// Get RegionProfileData from the GridServer
466 /// We'll Cache this information and use it for presence updates 446 /// We'll Cache this information and use it for presence updates
@@ -471,7 +451,6 @@ namespace OpenSim.Grid.MessagingServer
471 { RegionProfileData regionProfile = null; 451 { RegionProfileData regionProfile = null;
472 try 452 try
473 { 453 {
474
475 Hashtable requestData = new Hashtable(); 454 Hashtable requestData = new Hashtable();
476 requestData["region_handle"] = regionHandle.ToString(); 455 requestData["region_handle"] = regionHandle.ToString();
477 requestData["authkey"] = m_cfg.GridSendKey; 456 requestData["authkey"] = m_cfg.GridSendKey;
@@ -516,17 +495,16 @@ namespace OpenSim.Grid.MessagingServer
516 catch (WebException) 495 catch (WebException)
517 { 496 {
518 m_log.Error("[GRID]: " + 497 m_log.Error("[GRID]: " +
519 "Region lookup failed for: " + regionHandle.ToString() + 498 "Region lookup failed for: " + regionHandle.ToString() +
520 " - Is the GridServer down?"); 499 " - Is the GridServer down?");
521 return null; 500 return null;
522 } 501 }
523 502
524
525 return regionProfile; 503 return regionProfile;
526 } 504 }
505
527 public bool registerWithUserServer () 506 public bool registerWithUserServer ()
528 { 507 {
529
530 Hashtable UserParams = new Hashtable(); 508 Hashtable UserParams = new Hashtable();
531 // Login / Authentication 509 // Login / Authentication
532 510
@@ -542,9 +520,6 @@ namespace OpenSim.Grid.MessagingServer
542 UserParams["recvkey"] = m_cfg.UserRecvKey; 520 UserParams["recvkey"] = m_cfg.UserRecvKey;
543 UserParams["sendkey"] = m_cfg.UserRecvKey; 521 UserParams["sendkey"] = m_cfg.UserRecvKey;
544 522
545
546
547
548 // Package into an XMLRPC Request 523 // Package into an XMLRPC Request
549 ArrayList SendParams = new ArrayList(); 524 ArrayList SendParams = new ArrayList();
550 SendParams.Add(UserParams); 525 SendParams.Add(UserParams);
@@ -573,12 +548,10 @@ namespace OpenSim.Grid.MessagingServer
573 { 548 {
574 return false; 549 return false;
575 } 550 }
576
577
578 } 551 }
552
579 public bool deregisterWithUserServer() 553 public bool deregisterWithUserServer()
580 { 554 {
581
582 Hashtable UserParams = new Hashtable(); 555 Hashtable UserParams = new Hashtable();
583 // Login / Authentication 556 // Login / Authentication
584 557
@@ -623,10 +596,8 @@ namespace OpenSim.Grid.MessagingServer
623 { 596 {
624 return false; 597 return false;
625 } 598 }
626
627
628 } 599 }
600
629 #endregion 601 #endregion
630 } 602 }
631
632} 603}