diff options
Diffstat (limited to 'OpenSim/Grid/UserServer/MessageServersConnector.cs')
-rw-r--r-- | OpenSim/Grid/UserServer/MessageServersConnector.cs | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/OpenSim/Grid/UserServer/MessageServersConnector.cs b/OpenSim/Grid/UserServer/MessageServersConnector.cs index 28f5c4c..70068e0 100644 --- a/OpenSim/Grid/UserServer/MessageServersConnector.cs +++ b/OpenSim/Grid/UserServer/MessageServersConnector.cs | |||
@@ -41,12 +41,12 @@ namespace OpenSim.Grid.UserServer | |||
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | ||
43 | public Dictionary<string, MessageServerInfo> MessageServers; | 43 | public Dictionary<string, MessageServerInfo> MessageServers; |
44 | 44 | ||
45 | public MessageServersConnector() | 45 | public MessageServersConnector() |
46 | { | 46 | { |
47 | MessageServers = new Dictionary<string, MessageServerInfo>(); | 47 | MessageServers = new Dictionary<string, MessageServerInfo>(); |
48 | } | 48 | } |
49 | 49 | ||
50 | public void RegisterMessageServer(string URI, MessageServerInfo serverData) | 50 | public void RegisterMessageServer(string URI, MessageServerInfo serverData) |
51 | { | 51 | { |
52 | lock (MessageServers) | 52 | lock (MessageServers) |
@@ -55,7 +55,7 @@ namespace OpenSim.Grid.UserServer | |||
55 | MessageServers.Add(URI, serverData); | 55 | MessageServers.Add(URI, serverData); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | public void DeRegisterMessageServer(string URI) | 59 | public void DeRegisterMessageServer(string URI) |
60 | { | 60 | { |
61 | lock (MessageServers) | 61 | lock (MessageServers) |
@@ -64,7 +64,7 @@ namespace OpenSim.Grid.UserServer | |||
64 | MessageServers.Remove(URI); | 64 | MessageServers.Remove(URI); |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | public void AddResponsibleRegion(string URI, ulong regionhandle) | 68 | public void AddResponsibleRegion(string URI, ulong regionhandle) |
69 | { | 69 | { |
70 | if (!MessageServers.ContainsKey(URI)) | 70 | if (!MessageServers.ContainsKey(URI)) |
@@ -76,8 +76,9 @@ namespace OpenSim.Grid.UserServer | |||
76 | MessageServerInfo msginfo = MessageServers["URI"]; | 76 | MessageServerInfo msginfo = MessageServers["URI"]; |
77 | msginfo.responsibleForRegions.Add(regionhandle); | 77 | msginfo.responsibleForRegions.Add(regionhandle); |
78 | MessageServers["URI"] = msginfo; | 78 | MessageServers["URI"] = msginfo; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | |||
81 | public void RemoveResponsibleRegion(string URI, ulong regionhandle) | 82 | public void RemoveResponsibleRegion(string URI, ulong regionhandle) |
82 | { | 83 | { |
83 | if (!MessageServers.ContainsKey(URI)) | 84 | if (!MessageServers.ContainsKey(URI)) |
@@ -92,20 +93,20 @@ namespace OpenSim.Grid.UserServer | |||
92 | msginfo.responsibleForRegions.Remove(regionhandle); | 93 | msginfo.responsibleForRegions.Remove(regionhandle); |
93 | MessageServers["URI"] = msginfo; | 94 | MessageServers["URI"] = msginfo; |
94 | } | 95 | } |
95 | } | 96 | } |
96 | |||
97 | } | 97 | } |
98 | |||
98 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) | 99 | public XmlRpcResponse XmlRPCRegisterMessageServer(XmlRpcRequest request) |
99 | { | 100 | { |
100 | XmlRpcResponse response = new XmlRpcResponse(); | 101 | XmlRpcResponse response = new XmlRpcResponse(); |
101 | Hashtable requestData = (Hashtable)request.Params[0]; | 102 | Hashtable requestData = (Hashtable) request.Params[0]; |
102 | Hashtable responseData = new Hashtable(); | 103 | Hashtable responseData = new Hashtable(); |
103 | 104 | ||
104 | if (requestData.Contains("uri")) | 105 | if (requestData.Contains("uri")) |
105 | { | 106 | { |
106 | string URI = (string)requestData["uri"]; | 107 | string URI = (string) requestData["uri"]; |
107 | string sendkey=(string)requestData["sendkey"]; | 108 | string sendkey = (string) requestData["sendkey"]; |
108 | string recvkey=(string)requestData["recvkey"]; | 109 | string recvkey = (string) requestData["recvkey"]; |
109 | MessageServerInfo m = new MessageServerInfo(); | 110 | MessageServerInfo m = new MessageServerInfo(); |
110 | m.URI = URI; | 111 | m.URI = URI; |
111 | m.sendkey = sendkey; | 112 | m.sendkey = sendkey; |
@@ -116,15 +117,16 @@ namespace OpenSim.Grid.UserServer | |||
116 | } | 117 | } |
117 | return response; | 118 | return response; |
118 | } | 119 | } |
120 | |||
119 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) | 121 | public XmlRpcResponse XmlRPCDeRegisterMessageServer(XmlRpcRequest request) |
120 | { | 122 | { |
121 | XmlRpcResponse response = new XmlRpcResponse(); | 123 | XmlRpcResponse response = new XmlRpcResponse(); |
122 | Hashtable requestData = (Hashtable)request.Params[0]; | 124 | Hashtable requestData = (Hashtable) request.Params[0]; |
123 | Hashtable responseData = new Hashtable(); | 125 | Hashtable responseData = new Hashtable(); |
124 | 126 | ||
125 | if (requestData.Contains("uri")) | 127 | if (requestData.Contains("uri")) |
126 | { | 128 | { |
127 | string URI = (string)requestData["uri"]; | 129 | string URI = (string) requestData["uri"]; |
128 | 130 | ||
129 | DeRegisterMessageServer(URI); | 131 | DeRegisterMessageServer(URI); |
130 | responseData["responsestring"] = "TRUE"; | 132 | responseData["responsestring"] = "TRUE"; |
@@ -132,23 +134,24 @@ namespace OpenSim.Grid.UserServer | |||
132 | } | 134 | } |
133 | return response; | 135 | return response; |
134 | } | 136 | } |
137 | |||
135 | public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request) | 138 | public XmlRpcResponse XmlRPCUserMovedtoRegion(XmlRpcRequest request) |
136 | { | 139 | { |
137 | XmlRpcResponse response = new XmlRpcResponse(); | 140 | XmlRpcResponse response = new XmlRpcResponse(); |
138 | Hashtable requestData = (Hashtable)request.Params[0]; | 141 | Hashtable requestData = (Hashtable) request.Params[0]; |
139 | Hashtable responseData = new Hashtable(); | 142 | Hashtable responseData = new Hashtable(); |
140 | 143 | ||
141 | if (requestData.Contains("fromuri")) | 144 | if (requestData.Contains("fromuri")) |
142 | { | 145 | { |
143 | string sURI = (string)requestData["fromuri"]; | 146 | string sURI = (string) requestData["fromuri"]; |
144 | string sagentID = (string)requestData["agentid"]; | 147 | string sagentID = (string) requestData["agentid"]; |
145 | string ssessionID = (string)requestData["sessionid"]; | 148 | string ssessionID = (string) requestData["sessionid"]; |
146 | string scurrentRegionID = (string)requestData["regionid"]; | 149 | string scurrentRegionID = (string) requestData["regionid"]; |
147 | string sregionhandle = (string)requestData["regionhandle"]; | 150 | string sregionhandle = (string) requestData["regionhandle"]; |
148 | string scurrentpos = (string)requestData["currentpos"]; | 151 | string scurrentpos = (string) requestData["currentpos"]; |
149 | //LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); | 152 | //LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); |
150 | // TODO: Okay now raise event so the user server can pass this data to the Usermanager | 153 | // TODO: Okay now raise event so the user server can pass this data to the Usermanager |
151 | 154 | ||
152 | responseData["responsestring"] = "TRUE"; | 155 | responseData["responsestring"] = "TRUE"; |
153 | response.Value = responseData; | 156 | response.Value = responseData; |
154 | } | 157 | } |
@@ -156,7 +159,7 @@ namespace OpenSim.Grid.UserServer | |||
156 | } | 159 | } |
157 | 160 | ||
158 | public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, | 161 | public void TellMessageServersAboutUser(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, |
159 | ulong regionhandle, float positionX, float positionY, | 162 | ulong regionhandle, float positionX, float positionY, |
160 | float positionZ, string firstname, string lastname) | 163 | float positionZ, string firstname, string lastname) |
161 | { | 164 | { |
162 | // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D ) | 165 | // Loop over registered Message Servers ( AND THERE WILL BE MORE THEN ONE :D ) |
@@ -173,8 +176,8 @@ namespace OpenSim.Grid.UserServer | |||
173 | foreach (MessageServerInfo serv in MessageServers.Values) | 176 | foreach (MessageServerInfo serv in MessageServers.Values) |
174 | { | 177 | { |
175 | NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, | 178 | NotifyMessageServerAboutUser(serv, agentID, sessionID, RegionID, |
176 | regionhandle, positionX, positionY, positionZ, | 179 | regionhandle, positionX, positionY, positionZ, |
177 | firstname, lastname); | 180 | firstname, lastname); |
178 | } | 181 | } |
179 | } | 182 | } |
180 | } | 183 | } |
@@ -191,10 +194,10 @@ namespace OpenSim.Grid.UserServer | |||
191 | // { | 194 | // { |
192 | // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); | 195 | // m_log.Debug("[MSGCONNECTOR]: No Message Servers registered, ignoring"); |
193 | // } | 196 | // } |
194 | foreach (MessageServerInfo serv in MessageServers.Values) | 197 | foreach (MessageServerInfo serv in MessageServers.Values) |
195 | { | 198 | { |
196 | NotifyMessageServerAboutUserLogoff(serv,agentID); | 199 | NotifyMessageServerAboutUserLogoff(serv, agentID); |
197 | } | 200 | } |
198 | } | 201 | } |
199 | } | 202 | } |
200 | 203 | ||
@@ -218,10 +221,10 @@ namespace OpenSim.Grid.UserServer | |||
218 | m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); | 221 | m_log.Info("[LOGOUT]: Notified : " + serv.URI + " about user logout"); |
219 | } | 222 | } |
220 | 223 | ||
221 | private void NotifyMessageServerAboutUser(MessageServerInfo serv, | 224 | private void NotifyMessageServerAboutUser(MessageServerInfo serv, |
222 | LLUUID agentID, LLUUID sessionID, LLUUID RegionID, | 225 | LLUUID agentID, LLUUID sessionID, LLUUID RegionID, |
223 | ulong regionhandle, float positionX, float positionY, float positionZ, | 226 | ulong regionhandle, float positionX, float positionY, float positionZ, |
224 | string firstname, string lastname) | 227 | string firstname, string lastname) |
225 | { | 228 | { |
226 | Hashtable reqparams = new Hashtable(); | 229 | Hashtable reqparams = new Hashtable(); |
227 | reqparams["sendkey"] = serv.sendkey; | 230 | reqparams["sendkey"] = serv.sendkey; |
@@ -250,7 +253,6 @@ namespace OpenSim.Grid.UserServer | |||
250 | { | 253 | { |
251 | m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user"); | 254 | m_log.Warn("[MSGCONNECTOR]: Unable to notify Message Server about login. Presence might be borked for this user"); |
252 | } | 255 | } |
253 | |||
254 | } | 256 | } |
255 | } | 257 | } |
256 | } | 258 | } \ No newline at end of file |