aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/MessagingServer
diff options
context:
space:
mode:
authorAdam Frisby2008-05-01 16:41:01 +0000
committerAdam Frisby2008-05-01 16:41:01 +0000
commitfc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8 (patch)
tree90a4799fa43e3761ffbe669d1d87837933d8db53 /OpenSim/Grid/MessagingServer
parent* Deletes my EventReader ScriptRewriter. It isn't required to rewrite the sc... (diff)
downloadopensim-SC_OLD-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.zip
opensim-SC_OLD-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.gz
opensim-SC_OLD-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.bz2
opensim-SC_OLD-fc6c4dc399587f6f920d3f0759b1bd7a8b9b4ac8.tar.xz
* Cleaning code still.
Diffstat (limited to 'OpenSim/Grid/MessagingServer')
-rw-r--r--OpenSim/Grid/MessagingServer/Main.cs78
-rw-r--r--OpenSim/Grid/MessagingServer/MessageService.cs151
-rw-r--r--OpenSim/Grid/MessagingServer/PresenceInformer.cs11
-rw-r--r--OpenSim/Grid/MessagingServer/UserPresenceData.cs10
-rw-r--r--OpenSim/Grid/MessagingServer/WorkUnitBase.cs2
-rw-r--r--OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs2
-rw-r--r--OpenSim/Grid/MessagingServer/XMPPHTTPService.cs24
7 files changed, 135 insertions, 143 deletions
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs
index bf793bf..e6e18d4 100644
--- a/OpenSim/Grid/MessagingServer/Main.cs
+++ b/OpenSim/Grid/MessagingServer/Main.cs
@@ -44,9 +44,42 @@ namespace OpenSim.Grid.MessagingServer
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private MessageServerConfig Cfg; 46 private MessageServerConfig Cfg;
47 private MessageService msgsvc; 47
48
49 private LLUUID m_lastCreatedUser = LLUUID.Random(); 48 private LLUUID m_lastCreatedUser = LLUUID.Random();
49 private MessageService msgsvc;
50
51 private OpenMessage_Main()
52 {
53 m_console = new ConsoleBase("OpenMessage", this);
54 MainConsole.Instance = m_console;
55 }
56
57 #region conscmd_callback Members
58
59 public override void RunCmd(string cmd, string[] cmdparams)
60 {
61 base.RunCmd(cmd, cmdparams);
62
63 switch (cmd)
64 {
65 case "help":
66 m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
67 break;
68
69 case "shutdown":
70 msgsvc.deregisterWithUserServer();
71 m_console.Close();
72 Environment.Exit(0);
73 break;
74 }
75 }
76
77 public override void Show(string ShowWhat)
78 {
79 base.Show(ShowWhat);
80 }
81
82 #endregion
50 83
51 [STAThread] 84 [STAThread]
52 public static void Main(string[] args) 85 public static void Main(string[] args)
@@ -55,7 +88,6 @@ namespace OpenSim.Grid.MessagingServer
55 88
56 m_log.Info("Launching MessagingServer..."); 89 m_log.Info("Launching MessagingServer...");
57 90
58
59 91
60 OpenMessage_Main messageserver = new OpenMessage_Main(); 92 OpenMessage_Main messageserver = new OpenMessage_Main();
61 93
@@ -63,12 +95,6 @@ namespace OpenSim.Grid.MessagingServer
63 messageserver.Work(); 95 messageserver.Work();
64 } 96 }
65 97
66 private OpenMessage_Main()
67 {
68 m_console = new ConsoleBase("OpenMessage", this);
69 MainConsole.Instance = m_console;
70 }
71
72 private void Work() 98 private void Work()
73 { 99 {
74 m_console.Notice("Enter help for a list of commands\n"); 100 m_console.Notice("Enter help for a list of commands\n");
@@ -118,12 +144,13 @@ namespace OpenSim.Grid.MessagingServer
118 switch (what) 144 switch (what)
119 { 145 {
120 case "user": 146 case "user":
121 147
122 try 148 try
123 { 149 {
124 //userID = 150 //userID =
125 //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 151 //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
126 } catch (Exception ex) 152 }
153 catch (Exception ex)
127 { 154 {
128 m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); 155 m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString());
129 } 156 }
@@ -131,7 +158,7 @@ namespace OpenSim.Grid.MessagingServer
131 try 158 try
132 { 159 {
133 //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", 160 //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/",
134 //userID.UUID); 161 //userID.UUID);
135 } 162 }
136 catch (Exception ex) 163 catch (Exception ex)
137 { 164 {
@@ -141,28 +168,5 @@ namespace OpenSim.Grid.MessagingServer
141 break; 168 break;
142 } 169 }
143 } 170 }
144
145 public override void RunCmd(string cmd, string[] cmdparams)
146 {
147 base.RunCmd(cmd, cmdparams);
148
149 switch (cmd)
150 {
151 case "help":
152 m_console.Notice("shutdown - shutdown the message server (USE CAUTION!)");
153 break;
154
155 case "shutdown":
156 msgsvc.deregisterWithUserServer();
157 m_console.Close();
158 Environment.Exit(0);
159 break;
160 }
161 }
162
163 public override void Show(string ShowWhat)
164 {
165 base.Show(ShowWhat);
166 }
167 } 171 }
168} 172} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs
index 50e06af..33c133d 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer/MessageService.cs
@@ -45,16 +45,16 @@ namespace OpenSim.Grid.MessagingServer
45 { 45 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private MessageServerConfig m_cfg; 48 private readonly MessageServerConfig m_cfg;
49 private readonly Hashtable m_presence_BackReferences = new Hashtable();
49 50
50 //A hashtable of all current presences this server knows about 51 //A hashtable of all current presences this server knows about
51 private Hashtable m_presences = new Hashtable(); 52 private readonly Hashtable m_presences = new Hashtable();
52 53
53 //a hashtable of all current regions this server knows about 54 //a hashtable of all current regions this server knows about
54 private Hashtable m_regionInfoCache = new Hashtable(); 55 private readonly Hashtable m_regionInfoCache = new Hashtable();
55 56
56 //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing 57 //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing
57 private Hashtable m_presence_BackReferences = new Hashtable();
58 58
59 // Hashtable containing work units that need to be processed 59 // Hashtable containing work units that need to be processed
60 private Hashtable m_unProcessedWorkUnits = new Hashtable(); 60 private Hashtable m_unProcessedWorkUnits = new Hashtable();
@@ -63,13 +63,13 @@ namespace OpenSim.Grid.MessagingServer
63 { 63 {
64 m_cfg = cfg; 64 m_cfg = cfg;
65 } 65 }
66 66
67 #region RegionComms Methods 67 #region RegionComms Methods
68 68
69 #endregion 69 #endregion
70 70
71 #region FriendList Methods 71 #region FriendList Methods
72 72
73 /// <summary> 73 /// <summary>
74 /// Process Friendlist subscriptions for a user 74 /// Process Friendlist subscriptions for a user
75 /// The login method calls this for a User 75 /// The login method calls this for a User
@@ -87,14 +87,14 @@ namespace OpenSim.Grid.MessagingServer
87 for (int i = 0; i < uFriendList.Count; i++) 87 for (int i = 0; i < uFriendList.Count; i++)
88 { 88 {
89 //m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend); 89 //m_presence_BackReferences.Add(userpresence.agentData.AgentID, uFriendList[i].Friend);
90 // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID); 90 // m_presence_BackReferences.Add(uFriendList[i].Friend, userpresence.agentData.AgentID);
91 91
92 if (m_presences.Contains(uFriendList[i].Friend)) 92 if (m_presences.Contains(uFriendList[i].Friend))
93 { 93 {
94 UserPresenceData friendup = (UserPresenceData)m_presences[uFriendList[i].Friend]; 94 UserPresenceData friendup = (UserPresenceData) m_presences[uFriendList[i].Friend];
95 // Add backreference 95 // Add backreference
96 96
97 SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i],i); 97 SubscribeToPresenceUpdates(userpresence, friendup, uFriendList[i], i);
98 } 98 }
99 } 99 }
100 } 100 }
@@ -108,10 +108,10 @@ namespace OpenSim.Grid.MessagingServer
108 /// <param name="friendpresence">P2</param> 108 /// <param name="friendpresence">P2</param>
109 /// <param name="uFriendListItem"></param> 109 /// <param name="uFriendListItem"></param>
110 /// <param name="uFriendListIndex"></param> 110 /// <param name="uFriendListIndex"></param>
111 public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence, 111 public void SubscribeToPresenceUpdates(UserPresenceData userpresence, UserPresenceData friendpresence,
112 FriendListItem uFriendListItem, int uFriendListIndex) 112 FriendListItem uFriendListItem, int uFriendListIndex)
113 { 113 {
114 if ((uFriendListItem.FriendListOwnerPerms & (uint)FriendRights.CanSeeOnline) != 0) 114 if ((uFriendListItem.FriendListOwnerPerms & (uint) FriendRights.CanSeeOnline) != 0)
115 { 115 {
116 // Subscribe and Send Out updates 116 // Subscribe and Send Out updates
117 if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID)) 117 if (!friendpresence.subscriptionData.Contains(friendpresence.agentData.AgentID))
@@ -126,13 +126,13 @@ namespace OpenSim.Grid.MessagingServer
126 PresenceInformer friendlistupdater = new PresenceInformer(); 126 PresenceInformer friendlistupdater = new PresenceInformer();
127 friendlistupdater.presence1 = friendpresence; 127 friendlistupdater.presence1 = friendpresence;
128 friendlistupdater.presence2 = userpresence; 128 friendlistupdater.presence2 = userpresence;
129 WaitCallback cb = new WaitCallback(friendlistupdater.go); 129 WaitCallback cb = friendlistupdater.go;
130 ThreadPool.QueueUserWorkItem(cb); 130 ThreadPool.QueueUserWorkItem(cb);
131 131
132 //SendRegionPresenceUpdate(friendpresence, userpresence); 132 //SendRegionPresenceUpdate(friendpresence, userpresence);
133 } 133 }
134 134
135 if ((uFriendListItem.FriendPerms & (uint)FriendRights.CanSeeOnline) != 0) 135 if ((uFriendListItem.FriendPerms & (uint) FriendRights.CanSeeOnline) != 0)
136 { 136 {
137 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID)) 137 if (!friendpresence.subscriptionData.Contains(userpresence.agentData.AgentID))
138 { 138 {
@@ -147,9 +147,9 @@ namespace OpenSim.Grid.MessagingServer
147 friendlistupdater.presence1 = userpresence; 147 friendlistupdater.presence1 = userpresence;
148 friendlistupdater.presence2 = friendpresence; 148 friendlistupdater.presence2 = friendpresence;
149 149
150 WaitCallback cb2 = new WaitCallback(friendlistupdater.go); 150 WaitCallback cb2 = friendlistupdater.go;
151 ThreadPool.QueueUserWorkItem(cb2); 151 ThreadPool.QueueUserWorkItem(cb2);
152 152
153 //SendRegionPresenceUpdate(userpresence, friendpresence); 153 //SendRegionPresenceUpdate(userpresence, friendpresence);
154 } 154 }
155 } 155 }
@@ -164,7 +164,7 @@ namespace OpenSim.Grid.MessagingServer
164 { 164 {
165 if (m_presence_BackReferences.Contains(friendID)) 165 if (m_presence_BackReferences.Contains(friendID))
166 { 166 {
167 List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID]; 167 List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID];
168 if (!presenseBackReferences.Contains(agentID)) 168 if (!presenseBackReferences.Contains(agentID))
169 { 169 {
170 presenseBackReferences.Add(agentID); 170 presenseBackReferences.Add(agentID);
@@ -188,7 +188,7 @@ namespace OpenSim.Grid.MessagingServer
188 { 188 {
189 if (m_presence_BackReferences.Contains(friendID)) 189 if (m_presence_BackReferences.Contains(friendID))
190 { 190 {
191 List<LLUUID> presenseBackReferences = (List<LLUUID>)m_presence_BackReferences[friendID]; 191 List<LLUUID> presenseBackReferences = (List<LLUUID>) m_presence_BackReferences[friendID];
192 if (presenseBackReferences.Contains(agentID)) 192 if (presenseBackReferences.Contains(agentID))
193 { 193 {
194 presenseBackReferences.Remove(agentID); 194 presenseBackReferences.Remove(agentID);
@@ -216,29 +216,29 @@ namespace OpenSim.Grid.MessagingServer
216 { 216 {
217 if (m_presences.Contains(AgentID)) 217 if (m_presences.Contains(AgentID))
218 { 218 {
219 AgentData = (UserPresenceData)m_presences[AgentID]; 219 AgentData = (UserPresenceData) m_presences[AgentID];
220 } 220 }
221 } 221 }
222 222
223 if (AgentData != null) 223 if (AgentData != null)
224 { 224 {
225 AgentsNeedingNotification = AgentData.subscriptionData; 225 AgentsNeedingNotification = AgentData.subscriptionData;
226 //lock (m_presence_BackReferences) 226 //lock (m_presence_BackReferences)
227 //{ 227 //{
228 //if (m_presence_BackReferences.Contains(AgentID)) 228 //if (m_presence_BackReferences.Contains(AgentID))
229 //{ 229 //{
230 //AgentsNeedingNotification = (List<LLUUID>)m_presence_BackReferences[AgentID]; 230 //AgentsNeedingNotification = (List<LLUUID>)m_presence_BackReferences[AgentID];
231 //} 231 //}
232 //} 232 //}
233 233
234 for (int i = 0; i < AgentsNeedingNotification.Count; i++) 234 for (int i = 0; i < AgentsNeedingNotification.Count; i++)
235 { 235 {
236 // TODO: Do Region Notifications 236 // TODO: Do Region Notifications
237 lock(m_presences) 237 lock (m_presences)
238 { 238 {
239 if (m_presences.Contains(AgentsNeedingNotification[i])) 239 if (m_presences.Contains(AgentsNeedingNotification[i]))
240 { 240 {
241 friendd = (UserPresenceData)m_presences[AgentsNeedingNotification[i]]; 241 friendd = (UserPresenceData) m_presences[AgentsNeedingNotification[i]];
242 } 242 }
243 } 243 }
244 244
@@ -266,7 +266,7 @@ namespace OpenSim.Grid.MessagingServer
266 friendlistupdater.presence1 = AgentData; 266 friendlistupdater.presence1 = AgentData;
267 friendlistupdater.presence2 = friendd; 267 friendlistupdater.presence2 = friendd;
268 268
269 WaitCallback cb3 = new WaitCallback(friendlistupdater.go); 269 WaitCallback cb3 = friendlistupdater.go;
270 ThreadPool.QueueUserWorkItem(cb3); 270 ThreadPool.QueueUserWorkItem(cb3);
271 271
272 //SendRegionPresenceUpdate(AgentData, friendd); 272 //SendRegionPresenceUpdate(AgentData, friendd);
@@ -276,7 +276,7 @@ namespace OpenSim.Grid.MessagingServer
276 } 276 }
277 } 277 }
278 } 278 }
279 279
280 #endregion 280 #endregion
281 281
282 #region UserServer Comms 282 #region UserServer Comms
@@ -298,18 +298,17 @@ namespace OpenSim.Grid.MessagingServer
298 parameters.Add(param); 298 parameters.Add(param);
299 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters); 299 XmlRpcRequest req = new XmlRpcRequest("get_user_friend_list", parameters);
300 XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000); 300 XmlRpcResponse resp = req.Send(m_cfg.UserServerURL, 3000);
301 Hashtable respData = (Hashtable)resp.Value; 301 Hashtable respData = (Hashtable) resp.Value;
302 302
303 if (respData.Contains("avcount")) 303 if (respData.Contains("avcount"))
304 { 304 {
305 buddylist = ConvertXMLRPCDataToFriendListItemList(respData); 305 buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
306 } 306 }
307
308 } 307 }
309 catch (WebException e) 308 catch (WebException e)
310 { 309 {
311 m_log.Warn("Error when trying to fetch Avatar's friends list: " + 310 m_log.Warn("Error when trying to fetch Avatar's friends list: " +
312 e.Message); 311 e.Message);
313 // Return Empty list (no friends) 312 // Return Empty list (no friends)
314 } 313 }
315 return buddylist; 314 return buddylist;
@@ -323,16 +322,16 @@ namespace OpenSim.Grid.MessagingServer
323 public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) 322 public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data)
324 { 323 {
325 List<FriendListItem> buddylist = new List<FriendListItem>(); 324 List<FriendListItem> buddylist = new List<FriendListItem>();
326 int buddycount = Convert.ToInt32((string)data["avcount"]); 325 int buddycount = Convert.ToInt32((string) data["avcount"]);
327 326
328 for (int i = 0; i < buddycount; i++) 327 for (int i = 0; i < buddycount; i++)
329 { 328 {
330 FriendListItem buddylistitem = new FriendListItem(); 329 FriendListItem buddylistitem = new FriendListItem();
331 330
332 buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]); 331 buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]);
333 buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]); 332 buddylistitem.Friend = new LLUUID((string) data["friendID" + i]);
334 buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); 333 buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]);
335 buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); 334 buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]);
336 335
337 buddylist.Add(buddylistitem); 336 buddylist.Add(buddylistitem);
338 } 337 }
@@ -350,7 +349,7 @@ namespace OpenSim.Grid.MessagingServer
350 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) 349 public XmlRpcResponse UserLoggedOn(XmlRpcRequest request)
351 { 350 {
352 m_log.Info("[LOGON]: User logged on, building indexes for user"); 351 m_log.Info("[LOGON]: User logged on, building indexes for user");
353 Hashtable requestData = (Hashtable)request.Params[0]; 352 Hashtable requestData = (Hashtable) request.Params[0];
354 353
355 //requestData["sendkey"] = serv.sendkey; 354 //requestData["sendkey"] = serv.sendkey;
356 //requestData["agentid"] = agentID.ToString(); 355 //requestData["agentid"] = agentID.ToString();
@@ -364,13 +363,13 @@ namespace OpenSim.Grid.MessagingServer
364 //requestData["lastname"] = lastname; 363 //requestData["lastname"] = lastname;
365 364
366 AgentCircuitData agentData = new AgentCircuitData(); 365 AgentCircuitData agentData = new AgentCircuitData();
367 agentData.SessionID = new LLUUID((string)requestData["sessionid"]); 366 agentData.SessionID = new LLUUID((string) requestData["sessionid"]);
368 agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); 367 agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]);
369 agentData.firstname = (string)requestData["firstname"]; 368 agentData.firstname = (string) requestData["firstname"];
370 agentData.lastname = (string)requestData["lastname"]; 369 agentData.lastname = (string) requestData["lastname"];
371 agentData.AgentID = new LLUUID((string)requestData["agentid"]); 370 agentData.AgentID = new LLUUID((string) requestData["agentid"]);
372 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 371 agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
373 agentData.CapsPath = (string)requestData["caps_path"]; 372 agentData.CapsPath = (string) requestData["caps_path"];
374 373
375 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) 374 if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
376 { 375 {
@@ -379,13 +378,13 @@ namespace OpenSim.Grid.MessagingServer
379 else 378 else
380 { 379 {
381 agentData.startpos = 380 agentData.startpos =
382 new LLVector3(Convert.ToUInt32(requestData["positionx"]), 381 new LLVector3(Convert.ToUInt32(requestData["positionx"]),
383 Convert.ToUInt32(requestData["positiony"]), 382 Convert.ToUInt32(requestData["positiony"]),
384 Convert.ToUInt32(requestData["positionz"])); 383 Convert.ToUInt32(requestData["positionz"]));
385 agentData.child = false; 384 agentData.child = false;
386 } 385 }
387 386
388 ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); 387 ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
389 388
390 UserPresenceData up = new UserPresenceData(); 389 UserPresenceData up = new UserPresenceData();
391 up.agentData = agentData; 390 up.agentData = agentData;
@@ -398,7 +397,7 @@ namespace OpenSim.Grid.MessagingServer
398 397
399 return new XmlRpcResponse(); 398 return new XmlRpcResponse();
400 } 399 }
401 400
402 /// <summary> 401 /// <summary>
403 /// The UserServer got a Logoff message 402 /// The UserServer got a Logoff message
404 /// Cleanup time for that user. Send out presence notifications 403 /// Cleanup time for that user. Send out presence notifications
@@ -407,9 +406,9 @@ namespace OpenSim.Grid.MessagingServer
407 /// <returns></returns> 406 /// <returns></returns>
408 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) 407 public XmlRpcResponse UserLoggedOff(XmlRpcRequest request)
409 { 408 {
410 Hashtable requestData = (Hashtable)request.Params[0]; 409 Hashtable requestData = (Hashtable) request.Params[0];
411 410
412 LLUUID AgentID = new LLUUID((string)requestData["agentid"]); 411 LLUUID AgentID = new LLUUID((string) requestData["agentid"]);
413 412
414 ProcessLogOff(AgentID); 413 ProcessLogOff(AgentID);
415 414
@@ -431,9 +430,9 @@ namespace OpenSim.Grid.MessagingServer
431 RegionProfileData regionInfo = null; 430 RegionProfileData regionInfo = null;
432 if (m_regionInfoCache.Contains(regionhandle)) 431 if (m_regionInfoCache.Contains(regionhandle))
433 { 432 {
434 regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle]; 433 regionInfo = (RegionProfileData) m_regionInfoCache[regionhandle];
435 } 434 }
436 else 435 else
437 { 436 {
438 regionInfo = RequestRegionInfo(regionhandle); 437 regionInfo = RequestRegionInfo(regionhandle);
439 } 438 }
@@ -447,7 +446,8 @@ namespace OpenSim.Grid.MessagingServer
447 /// <param name="regionHandle"></param> 446 /// <param name="regionHandle"></param>
448 /// <returns></returns> 447 /// <returns></returns>
449 public RegionProfileData RequestRegionInfo(ulong regionHandle) 448 public RegionProfileData RequestRegionInfo(ulong regionHandle)
450 { RegionProfileData regionProfile = null; 449 {
450 RegionProfileData regionProfile = null;
451 try 451 try
452 { 452 {
453 Hashtable requestData = new Hashtable(); 453 Hashtable requestData = new Hashtable();
@@ -457,8 +457,8 @@ namespace OpenSim.Grid.MessagingServer
457 SendParams.Add(requestData); 457 SendParams.Add(requestData);
458 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); 458 XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
459 XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000); 459 XmlRpcResponse GridResp = GridReq.Send(m_cfg.GridServerURL, 3000);
460 460
461 Hashtable responseData = (Hashtable)GridResp.Value; 461 Hashtable responseData = (Hashtable) GridResp.Value;
462 462
463 if (responseData.ContainsKey("error")) 463 if (responseData.ContainsKey("error"))
464 { 464 {
@@ -466,23 +466,23 @@ namespace OpenSim.Grid.MessagingServer
466 return null; 466 return null;
467 } 467 }
468 468
469 uint regX = Convert.ToUInt32((string)responseData["region_locx"]); 469 uint regX = Convert.ToUInt32((string) responseData["region_locx"]);
470 uint regY = Convert.ToUInt32((string)responseData["region_locy"]); 470 uint regY = Convert.ToUInt32((string) responseData["region_locy"]);
471 string internalIpStr = (string)responseData["sim_ip"]; 471 string internalIpStr = (string) responseData["sim_ip"];
472 uint port = Convert.ToUInt32(responseData["sim_port"]); 472 uint port = Convert.ToUInt32(responseData["sim_port"]);
473 string externalUri = (string)responseData["sim_uri"]; 473 string externalUri = (string) responseData["sim_uri"];
474 string neighbourExternalUri = externalUri; 474 string neighbourExternalUri = externalUri;
475 475
476 regionProfile = new RegionProfileData(); 476 regionProfile = new RegionProfileData();
477 regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); 477 regionProfile.httpPort = (uint) Convert.ToInt32((string) responseData["http_port"]);
478 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; 478 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
479 regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize)); 479 regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
480 regionProfile.regionLocX = regX; 480 regionProfile.regionLocX = regX;
481 regionProfile.regionLocY = regY; 481 regionProfile.regionLocY = regY;
482 482
483 regionProfile.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); 483 regionProfile.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
484 regionProfile.UUID = new LLUUID((string)responseData["region_UUID"]); 484 regionProfile.UUID = new LLUUID((string) responseData["region_UUID"]);
485 regionProfile.regionName = (string)responseData["region_name"]; 485 regionProfile.regionName = (string) responseData["region_name"];
486 lock (m_regionInfoCache) 486 lock (m_regionInfoCache)
487 { 487 {
488 if (!m_regionInfoCache.Contains(regionHandle)) 488 if (!m_regionInfoCache.Contains(regionHandle))
@@ -494,31 +494,31 @@ namespace OpenSim.Grid.MessagingServer
494 catch (WebException) 494 catch (WebException)
495 { 495 {
496 m_log.Error("[GRID]: " + 496 m_log.Error("[GRID]: " +
497 "Region lookup failed for: " + regionHandle.ToString() + 497 "Region lookup failed for: " + regionHandle +
498 " - Is the GridServer down?"); 498 " - Is the GridServer down?");
499 return null; 499 return null;
500 } 500 }
501 501
502 return regionProfile; 502 return regionProfile;
503 } 503 }
504 504
505 public bool registerWithUserServer () 505 public bool registerWithUserServer()
506 { 506 {
507 Hashtable UserParams = new Hashtable(); 507 Hashtable UserParams = new Hashtable();
508 // Login / Authentication 508 // Login / Authentication
509 509
510 if (m_cfg.HttpSSL) 510 if (m_cfg.HttpSSL)
511 { 511 {
512 UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 512 UserParams["uri"] = "https://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
513 } 513 }
514 else 514 else
515 { 515 {
516 UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort; 516 UserParams["uri"] = "http://" + m_cfg.MessageServerIP + ":" + m_cfg.HttpPort;
517 } 517 }
518 518
519 UserParams["recvkey"] = m_cfg.UserRecvKey; 519 UserParams["recvkey"] = m_cfg.UserRecvKey;
520 UserParams["sendkey"] = m_cfg.UserRecvKey; 520 UserParams["sendkey"] = m_cfg.UserRecvKey;
521 521
522 // Package into an XMLRPC Request 522 // Package into an XMLRPC Request
523 ArrayList SendParams = new ArrayList(); 523 ArrayList SendParams = new ArrayList();
524 SendParams.Add(UserParams); 524 SendParams.Add(UserParams);
@@ -530,12 +530,13 @@ namespace OpenSim.Grid.MessagingServer
530 { 530 {
531 UserReq = new XmlRpcRequest("register_messageserver", SendParams); 531 UserReq = new XmlRpcRequest("register_messageserver", SendParams);
532 UserResp = UserReq.Send(m_cfg.UserServerURL, 16000); 532 UserResp = UserReq.Send(m_cfg.UserServerURL, 16000);
533 } catch (Exception ex) 533 }
534 catch (Exception ex)
534 { 535 {
535 m_log.Error("Unable to connect to grid. Grid server not running?"); 536 m_log.Error("Unable to connect to grid. Grid server not running?");
536 throw(ex); 537 throw (ex);
537 } 538 }
538 Hashtable GridRespData = (Hashtable)UserResp.Value; 539 Hashtable GridRespData = (Hashtable) UserResp.Value;
539 Hashtable griddatahash = GridRespData; 540 Hashtable griddatahash = GridRespData;
540 541
541 // Process Response 542 // Process Response
@@ -583,7 +584,7 @@ namespace OpenSim.Grid.MessagingServer
583 m_log.Error("Unable to connect to grid. Grid server not running?"); 584 m_log.Error("Unable to connect to grid. Grid server not running?");
584 throw (ex); 585 throw (ex);
585 } 586 }
586 Hashtable UserRespData = (Hashtable)UserResp.Value; 587 Hashtable UserRespData = (Hashtable) UserResp.Value;
587 Hashtable userdatahash = UserRespData; 588 Hashtable userdatahash = UserRespData;
588 589
589 // Process Response 590 // Process Response
@@ -599,4 +600,4 @@ namespace OpenSim.Grid.MessagingServer
599 600
600 #endregion 601 #endregion
601 } 602 }
602} 603} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/PresenceInformer.cs b/OpenSim/Grid/MessagingServer/PresenceInformer.cs
index 59d0e13..dd2fa5b 100644
--- a/OpenSim/Grid/MessagingServer/PresenceInformer.cs
+++ b/OpenSim/Grid/MessagingServer/PresenceInformer.cs
@@ -35,21 +35,16 @@ namespace OpenSim.Grid.MessagingServer
35{ 35{
36 public class PresenceInformer 36 public class PresenceInformer
37 { 37 {
38 public UserPresenceData presence1 = null;
39 public UserPresenceData presence2 = null;
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39 public UserPresenceData presence1;
40 public UserPresenceData presence2;
41 41
42 public PresenceInformer()
43 {
44
45 }
46 public void go(object o) 42 public void go(object o)
47 { 43 {
48 if (presence1 != null && presence2 != null) 44 if (presence1 != null && presence2 != null)
49 { 45 {
50 SendRegionPresenceUpdate(presence1, presence2); 46 SendRegionPresenceUpdate(presence1, presence2);
51 } 47 }
52
53 } 48 }
54 49
55 /// <summary> 50 /// <summary>
@@ -74,4 +69,4 @@ namespace OpenSim.Grid.MessagingServer
74 XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); 69 XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000);
75 } 70 }
76 } 71 }
77} 72} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/UserPresenceData.cs b/OpenSim/Grid/MessagingServer/UserPresenceData.cs
index 7188201..790e999 100644
--- a/OpenSim/Grid/MessagingServer/UserPresenceData.cs
+++ b/OpenSim/Grid/MessagingServer/UserPresenceData.cs
@@ -36,13 +36,9 @@ namespace OpenSim.Grid.MessagingServer
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 List<FriendListItem> friendData = new List<FriendListItem>();
40 public string httpURI = String.Empty; 40 public string httpURI = String.Empty;
41 public List<FriendListItem> friendData = new List<FriendListItem> (); 41 public RegionProfileData regionData = new RegionProfileData();
42 public List<LLUUID> subscriptionData = new List<LLUUID>(); 42 public List<LLUUID> subscriptionData = new List<LLUUID>();
43
44 public UserPresenceData()
45 {
46 }
47 } 43 }
48} 44} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs b/OpenSim/Grid/MessagingServer/WorkUnitBase.cs
index d25f044..1c1503b 100644
--- a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs
+++ b/OpenSim/Grid/MessagingServer/WorkUnitBase.cs
@@ -30,4 +30,4 @@ namespace OpenSim.Grid.MessagingServer
30 public class WorkUnitBase 30 public class WorkUnitBase
31 { 31 {
32 } 32 }
33} 33} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs b/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs
index c31f0c7..625a9f6 100644
--- a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs
+++ b/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs
@@ -30,4 +30,4 @@ namespace OpenSim.Grid.MessagingServer
30 public class WorkUnitPresenceUpdate : WorkUnitBase 30 public class WorkUnitPresenceUpdate : WorkUnitBase
31 { 31 {
32 } 32 }
33} 33} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs b/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs
index df3bc22..257e802 100644
--- a/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs
+++ b/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs
@@ -48,28 +48,26 @@ namespace OpenSim.Grid.MessagingServer
48 : base("GET", "/presence") 48 : base("GET", "/presence")
49 { 49 {
50 m_log.Info("[REST]: In Get Request"); 50 m_log.Info("[REST]: In Get Request");
51
52 } 51 }
53 52
54 public override byte[] Handle(string path, Stream request) 53 public override byte[] Handle(string path, Stream request)
55 { 54 {
56 string param = GetParam(path); 55 string param = GetParam(path);
57 byte[] result = new byte[] {}; 56 byte[] result = new byte[] {};
58 try 57 try
59 { 58 {
60 string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); 59 string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries);
61 60
62 if (p.Length > 0) 61 if (p.Length > 0)
63 { 62 {
64 LLUUID assetID = null; 63 LLUUID assetID = null;
65 64
66 if (!LLUUID.TryParse(p[0], out assetID)) 65 if (!LLUUID.TryParse(p[0], out assetID))
67 { 66 {
68 m_log.InfoFormat( 67 m_log.InfoFormat(
69 "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); 68 "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]);
70 return result; 69 return result;
71 } 70 }
72
73 } 71 }
74 } 72 }
75 catch (Exception e) 73 catch (Exception e)
@@ -84,6 +82,11 @@ namespace OpenSim.Grid.MessagingServer
84 { 82 {
85 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 83 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
86 84
85 public PostXMPPStreamHandler()
86 : base("POST", "/presence")
87 {
88 }
89
87 public override byte[] Handle(string path, Stream request) 90 public override byte[] Handle(string path, Stream request)
88 { 91 {
89 string param = GetParam(path); 92 string param = GetParam(path);
@@ -97,12 +100,5 @@ namespace OpenSim.Grid.MessagingServer
97 100
98 return new byte[] {}; 101 return new byte[] {};
99 } 102 }
100
101 public PostXMPPStreamHandler()
102 : base("POST", "/presence")
103 {
104
105 }
106
107 } 103 }
108} 104} \ No newline at end of file