diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/MessagingServer/Main.cs | 78 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/MessageService.cs | 151 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/PresenceInformer.cs | 11 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/UserPresenceData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/WorkUnitBase.cs | 2 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs | 2 | ||||
-rw-r--r-- | OpenSim/Grid/MessagingServer/XMPPHTTPService.cs | 24 |
7 files changed, 143 insertions, 135 deletions
diff --git a/OpenSim/Grid/MessagingServer/Main.cs b/OpenSim/Grid/MessagingServer/Main.cs index e6e18d4..bf793bf 100644 --- a/OpenSim/Grid/MessagingServer/Main.cs +++ b/OpenSim/Grid/MessagingServer/Main.cs | |||
@@ -44,42 +44,9 @@ 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 | |||
48 | private LLUUID m_lastCreatedUser = LLUUID.Random(); | ||
49 | private MessageService msgsvc; | 47 | private MessageService msgsvc; |
50 | 48 | ||
51 | private OpenMessage_Main() | 49 | private LLUUID m_lastCreatedUser = LLUUID.Random(); |
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 | ||
83 | 50 | ||
84 | [STAThread] | 51 | [STAThread] |
85 | public static void Main(string[] args) | 52 | public static void Main(string[] args) |
@@ -88,6 +55,7 @@ namespace OpenSim.Grid.MessagingServer | |||
88 | 55 | ||
89 | m_log.Info("Launching MessagingServer..."); | 56 | m_log.Info("Launching MessagingServer..."); |
90 | 57 | ||
58 | |||
91 | 59 | ||
92 | OpenMessage_Main messageserver = new OpenMessage_Main(); | 60 | OpenMessage_Main messageserver = new OpenMessage_Main(); |
93 | 61 | ||
@@ -95,6 +63,12 @@ namespace OpenSim.Grid.MessagingServer | |||
95 | messageserver.Work(); | 63 | messageserver.Work(); |
96 | } | 64 | } |
97 | 65 | ||
66 | private OpenMessage_Main() | ||
67 | { | ||
68 | m_console = new ConsoleBase("OpenMessage", this); | ||
69 | MainConsole.Instance = m_console; | ||
70 | } | ||
71 | |||
98 | private void Work() | 72 | private void Work() |
99 | { | 73 | { |
100 | m_console.Notice("Enter help for a list of commands\n"); | 74 | m_console.Notice("Enter help for a list of commands\n"); |
@@ -144,13 +118,12 @@ namespace OpenSim.Grid.MessagingServer | |||
144 | switch (what) | 118 | switch (what) |
145 | { | 119 | { |
146 | case "user": | 120 | case "user": |
147 | 121 | ||
148 | try | 122 | try |
149 | { | 123 | { |
150 | //userID = | 124 | //userID = |
151 | //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); | 125 | //m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); |
152 | } | 126 | } catch (Exception ex) |
153 | catch (Exception ex) | ||
154 | { | 127 | { |
155 | m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); | 128 | m_console.Error("[SERVER]: Error creating user: {0}", ex.ToString()); |
156 | } | 129 | } |
@@ -158,7 +131,7 @@ namespace OpenSim.Grid.MessagingServer | |||
158 | try | 131 | try |
159 | { | 132 | { |
160 | //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", | 133 | //RestObjectPoster.BeginPostObject<Guid>(m_userManager._config.InventoryUrl + "CreateInventory/", |
161 | //userID.UUID); | 134 | //userID.UUID); |
162 | } | 135 | } |
163 | catch (Exception ex) | 136 | catch (Exception ex) |
164 | { | 137 | { |
@@ -168,5 +141,28 @@ namespace OpenSim.Grid.MessagingServer | |||
168 | break; | 141 | break; |
169 | } | 142 | } |
170 | } | 143 | } |
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 | } | ||
171 | } | 167 | } |
172 | } \ No newline at end of file | 168 | } |
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs index 33c133d..50e06af 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 readonly MessageServerConfig m_cfg; | 48 | private MessageServerConfig m_cfg; |
49 | private readonly Hashtable m_presence_BackReferences = new Hashtable(); | ||
50 | 49 | ||
51 | //A hashtable of all current presences this server knows about | 50 | //A hashtable of all current presences this server knows about |
52 | private readonly Hashtable m_presences = new Hashtable(); | 51 | private Hashtable m_presences = new Hashtable(); |
53 | 52 | ||
54 | //a hashtable of all current regions this server knows about | 53 | //a hashtable of all current regions this server knows about |
55 | private readonly Hashtable m_regionInfoCache = new Hashtable(); | 54 | private Hashtable m_regionInfoCache = new Hashtable(); |
56 | 55 | ||
57 | //A hashtable containing lists of UUIDs keyed by UUID for fast backreferencing | 56 | //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 = friendlistupdater.go; | 129 | WaitCallback cb = new WaitCallback(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 = friendlistupdater.go; | 150 | WaitCallback cb2 = new WaitCallback(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 = friendlistupdater.go; | 269 | WaitCallback cb3 = new WaitCallback(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,17 +298,18 @@ 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 | |||
307 | } | 308 | } |
308 | catch (WebException e) | 309 | catch (WebException e) |
309 | { | 310 | { |
310 | m_log.Warn("Error when trying to fetch Avatar's friends list: " + | 311 | m_log.Warn("Error when trying to fetch Avatar's friends list: " + |
311 | e.Message); | 312 | e.Message); |
312 | // Return Empty list (no friends) | 313 | // Return Empty list (no friends) |
313 | } | 314 | } |
314 | return buddylist; | 315 | return buddylist; |
@@ -322,16 +323,16 @@ namespace OpenSim.Grid.MessagingServer | |||
322 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) | 323 | public List<FriendListItem> ConvertXMLRPCDataToFriendListItemList(Hashtable data) |
323 | { | 324 | { |
324 | List<FriendListItem> buddylist = new List<FriendListItem>(); | 325 | List<FriendListItem> buddylist = new List<FriendListItem>(); |
325 | int buddycount = Convert.ToInt32((string) data["avcount"]); | 326 | int buddycount = Convert.ToInt32((string)data["avcount"]); |
326 | 327 | ||
327 | for (int i = 0; i < buddycount; i++) | 328 | for (int i = 0; i < buddycount; i++) |
328 | { | 329 | { |
329 | FriendListItem buddylistitem = new FriendListItem(); | 330 | FriendListItem buddylistitem = new FriendListItem(); |
330 | 331 | ||
331 | buddylistitem.FriendListOwner = new LLUUID((string) data["ownerID" + i]); | 332 | buddylistitem.FriendListOwner = new LLUUID((string)data["ownerID" + i.ToString()]); |
332 | buddylistitem.Friend = new LLUUID((string) data["friendID" + i]); | 333 | buddylistitem.Friend = new LLUUID((string)data["friendID" + i.ToString()]); |
333 | buddylistitem.FriendListOwnerPerms = (uint) Convert.ToInt32((string) data["ownerPerms" + i]); | 334 | buddylistitem.FriendListOwnerPerms = (uint)Convert.ToInt32((string)data["ownerPerms" + i.ToString()]); |
334 | buddylistitem.FriendPerms = (uint) Convert.ToInt32((string) data["friendPerms" + i]); | 335 | buddylistitem.FriendPerms = (uint)Convert.ToInt32((string)data["friendPerms" + i.ToString()]); |
335 | 336 | ||
336 | buddylist.Add(buddylistitem); | 337 | buddylist.Add(buddylistitem); |
337 | } | 338 | } |
@@ -349,7 +350,7 @@ namespace OpenSim.Grid.MessagingServer | |||
349 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) | 350 | public XmlRpcResponse UserLoggedOn(XmlRpcRequest request) |
350 | { | 351 | { |
351 | m_log.Info("[LOGON]: User logged on, building indexes for user"); | 352 | m_log.Info("[LOGON]: User logged on, building indexes for user"); |
352 | Hashtable requestData = (Hashtable) request.Params[0]; | 353 | Hashtable requestData = (Hashtable)request.Params[0]; |
353 | 354 | ||
354 | //requestData["sendkey"] = serv.sendkey; | 355 | //requestData["sendkey"] = serv.sendkey; |
355 | //requestData["agentid"] = agentID.ToString(); | 356 | //requestData["agentid"] = agentID.ToString(); |
@@ -363,13 +364,13 @@ namespace OpenSim.Grid.MessagingServer | |||
363 | //requestData["lastname"] = lastname; | 364 | //requestData["lastname"] = lastname; |
364 | 365 | ||
365 | AgentCircuitData agentData = new AgentCircuitData(); | 366 | AgentCircuitData agentData = new AgentCircuitData(); |
366 | agentData.SessionID = new LLUUID((string) requestData["sessionid"]); | 367 | agentData.SessionID = new LLUUID((string)requestData["sessionid"]); |
367 | agentData.SecureSessionID = new LLUUID((string) requestData["secure_session_id"]); | 368 | agentData.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); |
368 | agentData.firstname = (string) requestData["firstname"]; | 369 | agentData.firstname = (string)requestData["firstname"]; |
369 | agentData.lastname = (string) requestData["lastname"]; | 370 | agentData.lastname = (string)requestData["lastname"]; |
370 | agentData.AgentID = new LLUUID((string) requestData["agentid"]); | 371 | agentData.AgentID = new LLUUID((string)requestData["agentid"]); |
371 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 372 | agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
372 | agentData.CapsPath = (string) requestData["caps_path"]; | 373 | agentData.CapsPath = (string)requestData["caps_path"]; |
373 | 374 | ||
374 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) | 375 | if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1")) |
375 | { | 376 | { |
@@ -378,13 +379,13 @@ namespace OpenSim.Grid.MessagingServer | |||
378 | else | 379 | else |
379 | { | 380 | { |
380 | agentData.startpos = | 381 | agentData.startpos = |
381 | new LLVector3(Convert.ToUInt32(requestData["positionx"]), | 382 | new LLVector3(Convert.ToUInt32(requestData["positionx"]), |
382 | Convert.ToUInt32(requestData["positiony"]), | 383 | Convert.ToUInt32(requestData["positiony"]), |
383 | Convert.ToUInt32(requestData["positionz"])); | 384 | Convert.ToUInt32(requestData["positionz"])); |
384 | agentData.child = false; | 385 | agentData.child = false; |
385 | } | 386 | } |
386 | 387 | ||
387 | ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]); | 388 | ulong regionHandle = Convert.ToUInt64((string)requestData["regionhandle"]); |
388 | 389 | ||
389 | UserPresenceData up = new UserPresenceData(); | 390 | UserPresenceData up = new UserPresenceData(); |
390 | up.agentData = agentData; | 391 | up.agentData = agentData; |
@@ -397,7 +398,7 @@ namespace OpenSim.Grid.MessagingServer | |||
397 | 398 | ||
398 | return new XmlRpcResponse(); | 399 | return new XmlRpcResponse(); |
399 | } | 400 | } |
400 | 401 | ||
401 | /// <summary> | 402 | /// <summary> |
402 | /// The UserServer got a Logoff message | 403 | /// The UserServer got a Logoff message |
403 | /// Cleanup time for that user. Send out presence notifications | 404 | /// Cleanup time for that user. Send out presence notifications |
@@ -406,9 +407,9 @@ namespace OpenSim.Grid.MessagingServer | |||
406 | /// <returns></returns> | 407 | /// <returns></returns> |
407 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) | 408 | public XmlRpcResponse UserLoggedOff(XmlRpcRequest request) |
408 | { | 409 | { |
409 | Hashtable requestData = (Hashtable) request.Params[0]; | 410 | Hashtable requestData = (Hashtable)request.Params[0]; |
410 | 411 | ||
411 | LLUUID AgentID = new LLUUID((string) requestData["agentid"]); | 412 | LLUUID AgentID = new LLUUID((string)requestData["agentid"]); |
412 | 413 | ||
413 | ProcessLogOff(AgentID); | 414 | ProcessLogOff(AgentID); |
414 | 415 | ||
@@ -430,9 +431,9 @@ namespace OpenSim.Grid.MessagingServer | |||
430 | RegionProfileData regionInfo = null; | 431 | RegionProfileData regionInfo = null; |
431 | if (m_regionInfoCache.Contains(regionhandle)) | 432 | if (m_regionInfoCache.Contains(regionhandle)) |
432 | { | 433 | { |
433 | regionInfo = (RegionProfileData) m_regionInfoCache[regionhandle]; | 434 | regionInfo = (RegionProfileData)m_regionInfoCache[regionhandle]; |
434 | } | 435 | } |
435 | else | 436 | else |
436 | { | 437 | { |
437 | regionInfo = RequestRegionInfo(regionhandle); | 438 | regionInfo = RequestRegionInfo(regionhandle); |
438 | } | 439 | } |
@@ -446,8 +447,7 @@ namespace OpenSim.Grid.MessagingServer | |||
446 | /// <param name="regionHandle"></param> | 447 | /// <param name="regionHandle"></param> |
447 | /// <returns></returns> | 448 | /// <returns></returns> |
448 | public RegionProfileData RequestRegionInfo(ulong regionHandle) | 449 | public RegionProfileData RequestRegionInfo(ulong regionHandle) |
449 | { | 450 | { RegionProfileData regionProfile = null; |
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 + | 497 | "Region lookup failed for: " + regionHandle.ToString() + |
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,13 +530,12 @@ 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 | } | 533 | } catch (Exception ex) |
534 | catch (Exception ex) | ||
535 | { | 534 | { |
536 | m_log.Error("Unable to connect to grid. Grid server not running?"); | 535 | m_log.Error("Unable to connect to grid. Grid server not running?"); |
537 | throw (ex); | 536 | throw(ex); |
538 | } | 537 | } |
539 | Hashtable GridRespData = (Hashtable) UserResp.Value; | 538 | Hashtable GridRespData = (Hashtable)UserResp.Value; |
540 | Hashtable griddatahash = GridRespData; | 539 | Hashtable griddatahash = GridRespData; |
541 | 540 | ||
542 | // Process Response | 541 | // Process Response |
@@ -584,7 +583,7 @@ namespace OpenSim.Grid.MessagingServer | |||
584 | m_log.Error("Unable to connect to grid. Grid server not running?"); | 583 | m_log.Error("Unable to connect to grid. Grid server not running?"); |
585 | throw (ex); | 584 | throw (ex); |
586 | } | 585 | } |
587 | Hashtable UserRespData = (Hashtable) UserResp.Value; | 586 | Hashtable UserRespData = (Hashtable)UserResp.Value; |
588 | Hashtable userdatahash = UserRespData; | 587 | Hashtable userdatahash = UserRespData; |
589 | 588 | ||
590 | // Process Response | 589 | // Process Response |
@@ -600,4 +599,4 @@ namespace OpenSim.Grid.MessagingServer | |||
600 | 599 | ||
601 | #endregion | 600 | #endregion |
602 | } | 601 | } |
603 | } \ No newline at end of file | 602 | } |
diff --git a/OpenSim/Grid/MessagingServer/PresenceInformer.cs b/OpenSim/Grid/MessagingServer/PresenceInformer.cs index dd2fa5b..59d0e13 100644 --- a/OpenSim/Grid/MessagingServer/PresenceInformer.cs +++ b/OpenSim/Grid/MessagingServer/PresenceInformer.cs | |||
@@ -35,16 +35,21 @@ 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; | ||
38 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 40 | 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 | } | ||
42 | public void go(object o) | 46 | public void go(object o) |
43 | { | 47 | { |
44 | if (presence1 != null && presence2 != null) | 48 | if (presence1 != null && presence2 != null) |
45 | { | 49 | { |
46 | SendRegionPresenceUpdate(presence1, presence2); | 50 | SendRegionPresenceUpdate(presence1, presence2); |
47 | } | 51 | } |
52 | |||
48 | } | 53 | } |
49 | 54 | ||
50 | /// <summary> | 55 | /// <summary> |
@@ -69,4 +74,4 @@ namespace OpenSim.Grid.MessagingServer | |||
69 | XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); | 74 | XmlRpcResponse RegionResp = RegionReq.Send(whichRegion.httpServerURI, 6000); |
70 | } | 75 | } |
71 | } | 76 | } |
72 | } \ No newline at end of file | 77 | } |
diff --git a/OpenSim/Grid/MessagingServer/UserPresenceData.cs b/OpenSim/Grid/MessagingServer/UserPresenceData.cs index 790e999..7188201 100644 --- a/OpenSim/Grid/MessagingServer/UserPresenceData.cs +++ b/OpenSim/Grid/MessagingServer/UserPresenceData.cs | |||
@@ -36,9 +36,13 @@ 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 List<FriendListItem> friendData = new List<FriendListItem>(); | ||
40 | public string httpURI = String.Empty; | ||
41 | public RegionProfileData regionData = new RegionProfileData(); | 39 | public RegionProfileData regionData = new RegionProfileData(); |
40 | public string httpURI = String.Empty; | ||
41 | public List<FriendListItem> friendData = new List<FriendListItem> (); | ||
42 | public List<LLUUID> subscriptionData = new List<LLUUID>(); | 42 | public List<LLUUID> subscriptionData = new List<LLUUID>(); |
43 | |||
44 | public UserPresenceData() | ||
45 | { | ||
46 | } | ||
43 | } | 47 | } |
44 | } \ No newline at end of file | 48 | } |
diff --git a/OpenSim/Grid/MessagingServer/WorkUnitBase.cs b/OpenSim/Grid/MessagingServer/WorkUnitBase.cs index 1c1503b..d25f044 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 | } \ No newline at end of file | 33 | } |
diff --git a/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs b/OpenSim/Grid/MessagingServer/WorkUnitPresenceUpdate.cs index 625a9f6..c31f0c7 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 | } \ No newline at end of file | 33 | } |
diff --git a/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs b/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs index 257e802..df3bc22 100644 --- a/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs +++ b/OpenSim/Grid/MessagingServer/XMPPHTTPService.cs | |||
@@ -48,26 +48,28 @@ 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 | |||
51 | } | 52 | } |
52 | 53 | ||
53 | public override byte[] Handle(string path, Stream request) | 54 | public override byte[] Handle(string path, Stream request) |
54 | { | 55 | { |
55 | string param = GetParam(path); | 56 | string param = GetParam(path); |
56 | byte[] result = new byte[] {}; | 57 | byte[] result = new byte[] {}; |
57 | try | 58 | try |
58 | { | 59 | { |
59 | string[] p = param.Split(new[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); | 60 | string[] p = param.Split(new char[] {'/', '?', '&'}, StringSplitOptions.RemoveEmptyEntries); |
60 | 61 | ||
61 | if (p.Length > 0) | 62 | if (p.Length > 0) |
62 | { | 63 | { |
63 | LLUUID assetID = null; | 64 | LLUUID assetID = null; |
64 | 65 | ||
65 | if (!LLUUID.TryParse(p[0], out assetID)) | 66 | if (!LLUUID.TryParse(p[0], out assetID)) |
66 | { | 67 | { |
67 | m_log.InfoFormat( | 68 | m_log.InfoFormat( |
68 | "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); | 69 | "[REST]: GET:/presence ignoring request with malformed UUID {0}", p[0]); |
69 | return result; | 70 | return result; |
70 | } | 71 | } |
72 | |||
71 | } | 73 | } |
72 | } | 74 | } |
73 | catch (Exception e) | 75 | catch (Exception e) |
@@ -82,11 +84,6 @@ namespace OpenSim.Grid.MessagingServer | |||
82 | { | 84 | { |
83 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 85 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
84 | 86 | ||
85 | public PostXMPPStreamHandler() | ||
86 | : base("POST", "/presence") | ||
87 | { | ||
88 | } | ||
89 | |||
90 | public override byte[] Handle(string path, Stream request) | 87 | public override byte[] Handle(string path, Stream request) |
91 | { | 88 | { |
92 | string param = GetParam(path); | 89 | string param = GetParam(path); |
@@ -100,5 +97,12 @@ namespace OpenSim.Grid.MessagingServer | |||
100 | 97 | ||
101 | return new byte[] {}; | 98 | return new byte[] {}; |
102 | } | 99 | } |
100 | |||
101 | public PostXMPPStreamHandler() | ||
102 | : base("POST", "/presence") | ||
103 | { | ||
104 | |||
105 | } | ||
106 | |||
103 | } | 107 | } |
104 | } \ No newline at end of file | 108 | } |