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