aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/UserServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Grid/UserServer')
-rw-r--r--OpenSim/Grid/UserServer/Main.cs145
-rw-r--r--OpenSim/Grid/UserServer/MessageServersConnector.cs70
-rw-r--r--OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs2
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs118
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs132
5 files changed, 238 insertions, 229 deletions
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 0534e3b..25e1585 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -48,12 +48,61 @@ namespace OpenSim.Grid.UserServer
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 private UserConfig Cfg; 50 private UserConfig Cfg;
51 51 private LLUUID m_lastCreatedUser = LLUUID.Random();
52 public UserManager m_userManager; 52
53 public UserLoginService m_loginService; 53 public UserLoginService m_loginService;
54 public MessageServersConnector m_messagesService; 54 public MessageServersConnector m_messagesService;
55 public UserManager m_userManager;
55 56
56 private LLUUID m_lastCreatedUser = LLUUID.Random(); 57 private OpenUser_Main()
58 {
59 m_console = new ConsoleBase("OpenUser", this);
60 MainConsole.Instance = m_console;
61 }
62
63 #region conscmd_callback Members
64
65 public override void RunCmd(string cmd, string[] cmdparams)
66 {
67 base.RunCmd(cmd, cmdparams);
68
69 switch (cmd)
70 {
71 case "help":
72 m_console.Notice("create user - create a new user");
73 m_console.Notice("stats - statistical information for this server");
74 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
75 break;
76
77 case "create":
78 do_create(cmdparams[0]);
79 break;
80
81 case "shutdown":
82 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
83 m_console.Close();
84 Environment.Exit(0);
85 break;
86
87 case "stats":
88 m_console.Notice(StatsManager.UserStats.Report());
89 break;
90
91 case "test-inventory":
92 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
93 // requester.ReturnResponseVal = TestResponse;
94 // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
95 SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
96 m_userManager.
97 _config.
98 InventoryUrl +
99 "RootFolders/",
100 m_lastCreatedUser);
101 break;
102 }
103 }
104
105 #endregion
57 106
58 [STAThread] 107 [STAThread]
59 public static void Main(string[] args) 108 public static void Main(string[] args)
@@ -68,12 +117,6 @@ namespace OpenSim.Grid.UserServer
68 userserver.Work(); 117 userserver.Work();
69 } 118 }
70 119
71 private OpenUser_Main()
72 {
73 m_console = new ConsoleBase("OpenUser", this);
74 MainConsole.Instance = m_console;
75 }
76
77 private void Work() 120 private void Work()
78 { 121 {
79 m_console.Notice("Enter help for a list of commands\n"); 122 m_console.Notice("Enter help for a list of commands\n");
@@ -87,16 +130,16 @@ namespace OpenSim.Grid.UserServer
87 public void Startup() 130 public void Startup()
88 { 131 {
89 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 132 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
90 133
91 StatsManager.StartCollectingUserStats(); 134 StatsManager.StartCollectingUserStats();
92 135
93 m_log.Info("[REGION]: Establishing data connection"); 136 m_log.Info("[REGION]: Establishing data connection");
94 m_userManager = new UserManager(); 137 m_userManager = new UserManager();
95 m_userManager._config = Cfg; 138 m_userManager._config = Cfg;
96 m_userManager.AddPlugin(Cfg.DatabaseProvider); 139 m_userManager.AddPlugin(Cfg.DatabaseProvider);
97 140
98 m_loginService = new UserLoginService( 141 m_loginService = new UserLoginService(
99 m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); 142 m_userManager, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
100 143
101 m_messagesService = new MessageServersConnector(); 144 m_messagesService = new MessageServersConnector();
102 145
@@ -104,7 +147,7 @@ namespace OpenSim.Grid.UserServer
104 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; 147 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
105 148
106 m_log.Info("[REGION]: Starting HTTP process"); 149 m_log.Info("[REGION]: Starting HTTP process");
107 150
108 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 151 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
109 AddHttpHandlers(); 152 AddHttpHandlers();
110 m_httpServer.Start(); 153 m_httpServer.Start();
@@ -117,7 +160,7 @@ namespace OpenSim.Grid.UserServer
117 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); 160 m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
118 161
119 m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin); 162 m_httpServer.AddHTTPHandler("login", m_loginService.ProcessHTMLLogin);
120 163
121 m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod); 164 m_httpServer.SetLLSDHandler(m_loginService.LLSDLoginMethod);
122 165
123 m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName); 166 m_httpServer.AddXmlRPCHandler("get_user_by_name", m_userManager.XmlRPCGetUserMethodName);
@@ -128,7 +171,7 @@ namespace OpenSim.Grid.UserServer
128 m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms); 171 m_httpServer.AddXmlRPCHandler("update_user_friend_perms", m_userManager.XmlRpcResponseXmlRPCUpdateUserFriendPerms);
129 m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList); 172 m_httpServer.AddXmlRPCHandler("get_user_friend_list", m_userManager.XmlRpcResponseXmlRPCGetUserFriendList);
130 m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID); 173 m_httpServer.AddXmlRPCHandler("logout_of_simulator", m_userManager.XmlRPCLogOffUserMethodUUID);
131 174
132 // Message Server ---> User Server 175 // Message Server ---> User Server
133 m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer); 176 m_httpServer.AddXmlRPCHandler("register_messageserver", m_messagesService.XmlRPCRegisterMessageServer);
134 m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion); 177 m_httpServer.AddXmlRPCHandler("agent_change_region", m_messagesService.XmlRPCUserMovedtoRegion);
@@ -163,17 +206,17 @@ namespace OpenSim.Grid.UserServer
163 { 206 {
164 m_log.ErrorFormat( 207 m_log.ErrorFormat(
165 "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname); 208 "[USERS]: A user with the name {0} {1} already exists!", tempfirstname, templastname);
166 209
167 break; 210 break;
168 } 211 }
169 212
170 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); 213 tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
171 214
172 LLUUID userID = new LLUUID(); 215 LLUUID userID = new LLUUID();
173 try 216 try
174 { 217 {
175 userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); 218 userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
176 } 219 }
177 catch (Exception ex) 220 catch (Exception ex)
178 { 221 {
179 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString()); 222 m_log.ErrorFormat("[USERS]: Error creating user: {0}", ex.ToString());
@@ -181,72 +224,31 @@ namespace OpenSim.Grid.UserServer
181 224
182 try 225 try
183 { 226 {
184 bool created 227 bool created
185 = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( 228 = SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
186 "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); 229 "POST", m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
187 230
188 if (!created) 231 if (!created)
189 { 232 {
190 throw new Exception( 233 throw new Exception(
191 String.Format( 234 String.Format(
192 "The inventory creation request for user {0} did not succeed." 235 "The inventory creation request for user {0} did not succeed."
193 + " Please contact your inventory service provider for more information.", 236 + " Please contact your inventory service provider for more information.",
194 userID)); 237 userID));
195 } 238 }
196
197 } 239 }
198 catch (WebException e) 240 catch (WebException e)
199 { 241 {
200 m_log.ErrorFormat( 242 m_log.ErrorFormat(
201 "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}", 243 "[USERS]: Could not contact the inventory service at {0} to create an inventory for {1}",
202 m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID); 244 m_userManager._config.InventoryUrl + "CreateInventory/", userID.UUID);
203 } 245 }
204 catch (Exception e) 246 catch (Exception e)
205 { 247 {
206 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e); 248 m_log.ErrorFormat("[USERS]: Error creating inventory for user: {0}", e);
207 } 249 }
208
209 m_lastCreatedUser = userID;
210 break;
211 }
212 }
213 250
214 public override void RunCmd(string cmd, string[] cmdparams) 251 m_lastCreatedUser = userID;
215 {
216 base.RunCmd(cmd, cmdparams);
217
218 switch (cmd)
219 {
220 case "help":
221 m_console.Notice("create user - create a new user");
222 m_console.Notice("stats - statistical information for this server");
223 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
224 break;
225
226 case "create":
227 do_create(cmdparams[0]);
228 break;
229
230 case "shutdown":
231 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
232 m_console.Close();
233 Environment.Exit(0);
234 break;
235
236 case "stats":
237 m_console.Notice(StatsManager.UserStats.Report());
238 break;
239
240 case "test-inventory":
241 // RestObjectPosterResponse<List<InventoryFolderBase>> requester = new RestObjectPosterResponse<List<InventoryFolderBase>>();
242 // requester.ReturnResponseVal = TestResponse;
243 // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
244 SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>("POST",
245 m_userManager.
246 _config.
247 InventoryUrl +
248 "RootFolders/",
249 m_lastCreatedUser);
250 break; 252 break;
251 } 253 }
252 } 254 }
@@ -262,12 +264,11 @@ namespace OpenSim.Grid.UserServer
262 } 264 }
263 265
264 public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, 266 public void NotifyMessageServersUserLoggedInToLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
265 ulong regionhandle, float positionX, float positionY, 267 ulong regionhandle, float positionX, float positionY,
266 float positionZ, string firstname, string lastname) 268 float positionZ, string firstname, string lastname)
267 { 269 {
268 270 m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
269 m_messagesService.TellMessageServersAboutUser( agentID, sessionID, RegionID, regionhandle, positionX, 271 positionY, positionZ, firstname, lastname);
270 positionY, positionZ, firstname, lastname);
271 } 272 }
272 } 273 }
273} 274} \ No newline at end of file
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
diff --git a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
index 680b357..eb60f11 100644
--- a/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
+++ b/OpenSim/Grid/UserServer/Properties/AssemblyInfo.cs
@@ -60,4 +60,4 @@ using System.Runtime.InteropServices;
60// 60//
61 61
62[assembly : AssemblyVersion("1.0.0.0")] 62[assembly : AssemblyVersion("1.0.0.0")]
63[assembly : AssemblyFileVersion("1.0.0.0")] 63[assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index b123b8c..b19b74d 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -41,26 +41,26 @@ using OpenSim.Framework.Servers;
41namespace OpenSim.Grid.UserServer 41namespace OpenSim.Grid.UserServer
42{ 42{
43 public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, 43 public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
44 ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname); 44 ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname);
45 45
46 public class UserLoginService : LoginService 46 public class UserLoginService : LoginService
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 public event UserLoggedInAtLocation OnUserLoggedInAtLocation; 50 private UserLoggedInAtLocation handlerUserLoggedInAtLocation;
51 51
52 private UserLoggedInAtLocation handlerUserLoggedInAtLocation = null;
53
54 public UserConfig m_config; 52 public UserConfig m_config;
55 53
56 public UserLoginService( 54 public UserLoginService(
57 UserManagerBase userManager, LibraryRootFolder libraryRootFolder, 55 UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
58 UserConfig config, string welcomeMess) 56 UserConfig config, string welcomeMess)
59 : base(userManager, libraryRootFolder, welcomeMess) 57 : base(userManager, libraryRootFolder, welcomeMess)
60 { 58 {
61 m_config = config; 59 m_config = config;
62 } 60 }
63 61
62 public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
63
64 /// <summary> 64 /// <summary>
65 /// Customises the login response and fills in missing values. 65 /// Customises the login response and fills in missing values.
66 /// </summary> 66 /// </summary>
@@ -95,7 +95,8 @@ namespace OpenSim.Grid.UserServer
95 else 95 else
96 { 96 {
97 string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest); 97 string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
98 m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]); 98 m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" +
99 startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
99 if (startLocationRequestParsed[0] == "last") 100 if (startLocationRequestParsed[0] == "last")
100 { 101 {
101 // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z' 102 // TODO: Parse out startlocationrequest string in the format; 'uri:RegionName&X&Y&Z'
@@ -108,9 +109,9 @@ namespace OpenSim.Grid.UserServer
108 { 109 {
109 m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]); 110 m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
110 SimInfo = 111 SimInfo =
111 RegionProfileData.RequestSimProfileData( 112 RegionProfileData.RequestSimProfileData(
112 startLocationRequestParsed[0], m_config.GridServerURL, 113 startLocationRequestParsed[0], m_config.GridServerURL,
113 m_config.GridSendKey, m_config.GridRecvKey); 114 m_config.GridSendKey, m_config.GridRecvKey);
114 115
115 if (SimInfo == null) 116 if (SimInfo == null)
116 { 117 {
@@ -119,7 +120,9 @@ namespace OpenSim.Grid.UserServer
119 RegionProfileData.RequestSimProfileData( 120 RegionProfileData.RequestSimProfileData(
120 theUser.HomeRegion, m_config.GridServerURL, 121 theUser.HomeRegion, m_config.GridServerURL,
121 m_config.GridSendKey, m_config.GridRecvKey); 122 m_config.GridSendKey, m_config.GridRecvKey);
122 } else { 123 }
124 else
125 {
123 start_x = Convert.ToInt32(startLocationRequestParsed[1]); 126 start_x = Convert.ToInt32(startLocationRequestParsed[1]);
124 start_y = Convert.ToInt32(startLocationRequestParsed[2]); 127 start_y = Convert.ToInt32(startLocationRequestParsed[2]);
125 start_z = Convert.ToInt32(startLocationRequestParsed[3]); 128 start_z = Convert.ToInt32(startLocationRequestParsed[3]);
@@ -130,30 +133,30 @@ namespace OpenSim.Grid.UserServer
130 // Customise the response 133 // Customise the response
131 //CFK: This is redundant and the next message should always appear. 134 //CFK: This is redundant and the next message should always appear.
132 //CFK: m_log.Info("[LOGIN]: Home Location"); 135 //CFK: m_log.Info("[LOGIN]: Home Location");
133 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" + 136 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" +
134 (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " + 137 (SimInfo.regionLocY * Constants.RegionSize) + "], " +
135 "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" + 138 "'position':[r" + theUser.HomeLocation.X + ",r" +
136 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " + 139 theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " +
137 "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" + 140 "'look_at':[r" + theUser.HomeLocation.X + ",r" +
138 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}"; 141 theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}";
139 142
140 // Destination 143 // Destination
141 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into 144 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
142 //CFK: the next one for X & Y and comment this one. 145 //CFK: the next one for X & Y and comment this one.
143 //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + 146 //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
144 //CFK: "; Region Y: " + SimInfo.regionLocY); 147 //CFK: "; Region Y: " + SimInfo.regionLocY);
145 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString(); 148 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString();
146 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); 149 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]);
147 response.RegionX = SimInfo.regionLocX; 150 response.RegionX = SimInfo.regionLocX;
148 response.RegionY = SimInfo.regionLocY; 151 response.RegionY = SimInfo.regionLocY;
149 152
150 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI 153 //Not sure if the + "/CAPS/" should in fact be +"CAPS/" depending if there is already a / as part of httpServerURI
151 string capsPath = Util.GetRandomCapsPath(); 154 string capsPath = Util.GetRandomCapsPath();
152 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/"; 155 response.SeedCapability = SimInfo.httpServerURI + "CAPS/" + capsPath + "0000/";
153 156
154 m_log.DebugFormat( 157 m_log.DebugFormat(
155 "[LOGIN]: Sending new CAPS seed url {0} to client {1}", 158 "[LOGIN]: Sending new CAPS seed url {0} to client {1}",
156 response.SeedCapability, response.AgentID); 159 response.SeedCapability, response.AgentID);
157 160
158 // Notify the target of an incoming user 161 // Notify the target of an incoming user
159 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into 162 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
@@ -163,7 +166,8 @@ namespace OpenSim.Grid.UserServer
163 166
164 theUser.CurrentAgent.Region = SimInfo.UUID; 167 theUser.CurrentAgent.Region = SimInfo.UUID;
165 theUser.CurrentAgent.Handle = SimInfo.regionHandle; 168 theUser.CurrentAgent.Handle = SimInfo.regionHandle;
166 if (start_x >= 0 && start_y >= 0 && start_z >= 0) { 169 if (start_x >= 0 && start_y >= 0 && start_z >= 0)
170 {
167 LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z); 171 LLVector3 tmp_v = new LLVector3(start_x, start_y, start_z);
168 theUser.CurrentAgent.Position = tmp_v; 172 theUser.CurrentAgent.Position = tmp_v;
169 } 173 }
@@ -186,42 +190,43 @@ namespace OpenSim.Grid.UserServer
186 // Update agent with target sim 190 // Update agent with target sim
187 191
188 m_log.InfoFormat( 192 m_log.InfoFormat(
189 "[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection", 193 "[LOGIN]: Telling region {0} @ {1},{2} ({3}) to expect user connection",
190 SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI); 194 SimInfo.regionName, response.RegionX, response.RegionY, SimInfo.httpServerURI);
191 195
192 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams); 196 XmlRpcRequest GridReq = new XmlRpcRequest("expect_user", SendParams);
193 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000); 197 XmlRpcResponse GridResp = GridReq.Send(SimInfo.httpServerURI, 6000);
194 198
195 if (GridResp.IsFault) 199 if (GridResp.IsFault)
196 { 200 {
197 m_log.ErrorFormat( 201 m_log.ErrorFormat(
198 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}", 202 "[LOGIN]: XMLRPC request for {0} failed, fault code: {1}, reason: {2}",
199 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString); 203 SimInfo.httpServerURI, GridResp.FaultCode, GridResp.FaultString);
200 } 204 }
201 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation; 205 handlerUserLoggedInAtLocation = OnUserLoggedInAtLocation;
202 if (handlerUserLoggedInAtLocation != null) 206 if (handlerUserLoggedInAtLocation != null)
203 { 207 {
204 //m_log.Info("[LOGIN]: Letting other objects know about login"); 208 //m_log.Info("[LOGIN]: Letting other objects know about login");
205 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, 209 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
206 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,theUser.CurrentAgent.Position.Y,theUser.CurrentAgent.Position.Z, 210 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y,
207 theUser.FirstName,theUser.SurName); 211 theUser.CurrentAgent.Position.Z,
212 theUser.FirstName, theUser.SurName);
208 } 213 }
209 } 214 }
210 catch (Exception) 215 catch (Exception)
211 //catch (System.AccessViolationException) 216 //catch (System.AccessViolationException)
212 { 217 {
213 tryDefault = true; 218 tryDefault = true;
214 } 219 }
215 220
216 if (tryDefault) 221 if (tryDefault)
217 { 222 {
218 // Send him to default region instead 223 // Send him to default region instead
219 // Load information from the gridserver 224 // Load information from the gridserver
220 225
221 ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize); 226 ulong defaultHandle = (((ulong) m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong) m_config.DefaultY * Constants.RegionSize);
222 227
223 m_log.Warn( 228 m_log.Warn(
224 "[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString()); 229 "[LOGIN]: Home region not available: sending to default " + defaultHandle);
225 230
226 try 231 try
227 { 232 {
@@ -231,19 +236,19 @@ namespace OpenSim.Grid.UserServer
231 236
232 // Customise the response 237 // Customise the response
233 m_log.Info("[LOGIN]: Home Location"); 238 m_log.Info("[LOGIN]: Home Location");
234 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" + 239 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize) + ",r" +
235 (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " + 240 (SimInfo.regionLocY * Constants.RegionSize) + "], " +
236 "'position':[r" + theUser.HomeLocation.X.ToString() + ",r" + 241 "'position':[r" + theUser.HomeLocation.X + ",r" +
237 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "], " + 242 theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "], " +
238 "'look_at':[r" + theUser.HomeLocation.X.ToString() + ",r" + 243 "'look_at':[r" + theUser.HomeLocation.X + ",r" +
239 theUser.HomeLocation.Y.ToString() + ",r" + theUser.HomeLocation.Z.ToString() + "]}"; 244 theUser.HomeLocation.Y + ",r" + theUser.HomeLocation.Z + "]}";
240 245
241 // Destination 246 // Destination
242 m_log.Info("[LOGIN]: " + 247 m_log.Info("[LOGIN]: " +
243 "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + 248 "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
244 SimInfo.regionLocY); 249 SimInfo.regionLocY);
245 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new char[] { '/', ':' })[3]).ToString(); 250 response.SimAddress = Util.GetHostFromDNS(SimInfo.serverURI.Split(new[] {'/', ':'})[3]).ToString();
246 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]); 251 response.SimPort = uint.Parse(SimInfo.serverURI.Split(new[] {'/', ':'})[4]);
247 response.RegionX = SimInfo.regionLocX; 252 response.RegionX = SimInfo.regionLocX;
248 response.RegionY = SimInfo.regionLocY; 253 response.RegionY = SimInfo.regionLocY;
249 254
@@ -283,15 +288,16 @@ namespace OpenSim.Grid.UserServer
283 { 288 {
284 m_log.Info("[LOGIN]: Letting other objects know about login"); 289 m_log.Info("[LOGIN]: Letting other objects know about login");
285 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, 290 handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
286 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, 291 theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y,
287 theUser.FirstName, theUser.SurName); 292 theUser.CurrentAgent.Position.Z,
293 theUser.FirstName, theUser.SurName);
288 } 294 }
289 } 295 }
290 296
291 catch (Exception e) 297 catch (Exception e)
292 { 298 {
293 m_log.Warn("[LOGIN]: Default region also not available"); 299 m_log.Warn("[LOGIN]: Default region also not available");
294 m_log.Warn("[LOGIN]: " + e.ToString()); 300 m_log.Warn("[LOGIN]: " + e);
295 } 301 }
296 } 302 }
297 } 303 }
@@ -300,8 +306,8 @@ namespace OpenSim.Grid.UserServer
300 protected override InventoryData GetInventorySkeleton(LLUUID userID) 306 protected override InventoryData GetInventorySkeleton(LLUUID userID)
301 { 307 {
302 m_log.DebugFormat( 308 m_log.DebugFormat(
303 "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", 309 "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
304 m_config.InventoryUrl, userID); 310 m_config.InventoryUrl, userID);
305 311
306 List<InventoryFolderBase> folders 312 List<InventoryFolderBase> folders
307 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 313 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
@@ -316,23 +322,23 @@ namespace OpenSim.Grid.UserServer
316 // tools are creating the user profile directly in the database without creating the inventory. At 322 // tools are creating the user profile directly in the database without creating the inventory. At
317 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already 323 // this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
318 // exist. 324 // exist.
319 bool created = 325 bool created =
320 SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( 326 SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(
321 "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID); 327 "POST", m_config.InventoryUrl + "CreateInventory/", userID.UUID);
322 328
323 if (!created) 329 if (!created)
324 { 330 {
325 throw new Exception( 331 throw new Exception(
326 String.Format( 332 String.Format(
327 "The inventory creation request for user {0} did not succeed." 333 "The inventory creation request for user {0} did not succeed."
328 + " Please contact your inventory service provider for more information.", 334 + " Please contact your inventory service provider for more information.",
329 userID)); 335 userID));
330 } 336 }
331 else 337 else
332 { 338 {
333 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); 339 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
334 } 340 }
335 341
336 folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>( 342 folders = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
337 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID); 343 "POST", m_config.InventoryUrl + "RootFolders/", userID.UUID);
338 } 344 }
@@ -342,11 +348,11 @@ namespace OpenSim.Grid.UserServer
342 LLUUID rootID = LLUUID.Zero; 348 LLUUID rootID = LLUUID.Zero;
343 ArrayList AgentInventoryArray = new ArrayList(); 349 ArrayList AgentInventoryArray = new ArrayList();
344 Hashtable TempHash; 350 Hashtable TempHash;
345 351
346 foreach (InventoryFolderBase InvFolder in folders) 352 foreach (InventoryFolderBase InvFolder in folders)
347 { 353 {
348// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name); 354// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name);
349 355
350 if (InvFolder.ParentID == LLUUID.Zero) 356 if (InvFolder.ParentID == LLUUID.Zero)
351 { 357 {
352 rootID = InvFolder.ID; 358 rootID = InvFolder.ID;
@@ -359,16 +365,16 @@ namespace OpenSim.Grid.UserServer
359 TempHash["folder_id"] = InvFolder.ID.ToString(); 365 TempHash["folder_id"] = InvFolder.ID.ToString();
360 AgentInventoryArray.Add(TempHash); 366 AgentInventoryArray.Add(TempHash);
361 } 367 }
362 368
363 return new InventoryData(AgentInventoryArray, rootID); 369 return new InventoryData(AgentInventoryArray, rootID);
364 } 370 }
365 else 371 else
366 { 372 {
367 throw new Exception( 373 throw new Exception(
368 String.Format( 374 String.Format(
369 "A root inventory folder for user {0} could not be retrieved from the inventory service", 375 "A root inventory folder for user {0} could not be retrieved from the inventory service",
370 userID)); 376 userID));
371 } 377 }
372 } 378 }
373 } 379 }
374} 380} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 5d0e1d6..0122ad0 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -41,11 +41,11 @@ namespace OpenSim.Grid.UserServer
41 public delegate void logOffUser(LLUUID AgentID); 41 public delegate void logOffUser(LLUUID AgentID);
42 42
43 public class UserManager : UserManagerBase 43 public class UserManager : UserManagerBase
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
47 private logOffUser handlerLogOffUser;
47 public event logOffUser OnLogOffUser; 48 public event logOffUser OnLogOffUser;
48 private logOffUser handlerLogOffUser = null;
49 49
50 /// <summary> 50 /// <summary>
51 /// Deletes an active agent session 51 /// Deletes an active agent session
@@ -81,17 +81,17 @@ namespace OpenSim.Grid.UserServer
81 XmlRpcResponse response = new XmlRpcResponse(); 81 XmlRpcResponse response = new XmlRpcResponse();
82 Hashtable responseData = new Hashtable(); 82 Hashtable responseData = new Hashtable();
83 // Query Result Information 83 // Query Result Information
84 responseData["queryid"] = (string) queryID.ToString(); 84 responseData["queryid"] = queryID.ToString();
85 responseData["avcount"] = (string) returnUsers.Count.ToString(); 85 responseData["avcount"] = returnUsers.Count.ToString();
86 86
87 for (int i = 0; i < returnUsers.Count; i++) 87 for (int i = 0; i < returnUsers.Count; i++)
88 { 88 {
89 responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString(); 89 responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString();
90 responseData["firstname" + i.ToString()] = returnUsers[i].firstName; 90 responseData["firstname" + i] = returnUsers[i].firstName;
91 responseData["lastname" + i.ToString()] = returnUsers[i].lastName; 91 responseData["lastname" + i] = returnUsers[i].lastName;
92 } 92 }
93 response.Value = responseData; 93 response.Value = responseData;
94 94
95 return response; 95 return response;
96 } 96 }
97 97
@@ -101,14 +101,14 @@ namespace OpenSim.Grid.UserServer
101 Hashtable responseData = new Hashtable(); 101 Hashtable responseData = new Hashtable();
102 // Query Result Information 102 // Query Result Information
103 103
104 responseData["avcount"] = (string)returnUsers.Count.ToString(); 104 responseData["avcount"] = returnUsers.Count.ToString();
105 105
106 for (int i = 0; i < returnUsers.Count; i++) 106 for (int i = 0; i < returnUsers.Count; i++)
107 { 107 {
108 responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString(); 108 responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString();
109 responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString(); 109 responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString();
110 responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString(); 110 responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString();
111 responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString(); 111 responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString();
112 } 112 }
113 response.Value = responseData; 113 response.Value = responseData;
114 114
@@ -156,6 +156,21 @@ namespace OpenSim.Grid.UserServer
156 return response; 156 return response;
157 } 157 }
158 158
159 public override UserProfileData SetupMasterUser(string firstName, string lastName)
160 {
161 throw new Exception("The method or operation is not implemented.");
162 }
163
164 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
165 {
166 throw new Exception("The method or operation is not implemented.");
167 }
168
169 public override UserProfileData SetupMasterUser(LLUUID uuid)
170 {
171 throw new Exception("The method or operation is not implemented.");
172 }
173
159 #region XMLRPC User Methods 174 #region XMLRPC User Methods
160 175
161 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request) 176 public XmlRpcResponse XmlRPCGetAvatarPickerAvatar(XmlRpcRequest request)
@@ -178,15 +193,16 @@ namespace OpenSim.Grid.UserServer
178 public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) 193 public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
179 { 194 {
180 XmlRpcResponse response = new XmlRpcResponse(); 195 XmlRpcResponse response = new XmlRpcResponse();
181 Hashtable requestData = (Hashtable)request.Params[0]; 196 Hashtable requestData = (Hashtable) request.Params[0];
182 Hashtable responseData = new Hashtable(); 197 Hashtable responseData = new Hashtable();
183 string returnString = "FALSE"; 198 string returnString = "FALSE";
184 // Query Result Information 199 // Query Result Information
185 200
186 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) 201 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
187 { 202 {
188 // UserManagerBase.AddNewuserFriend 203 // UserManagerBase.AddNewuserFriend
189 AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); 204 AddNewUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]),
205 (uint) Convert.ToInt32((string) requestData["friendPerms"]));
190 returnString = "TRUE"; 206 returnString = "TRUE";
191 } 207 }
192 responseData["returnString"] = returnString; 208 responseData["returnString"] = returnString;
@@ -197,15 +213,15 @@ namespace OpenSim.Grid.UserServer
197 public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) 213 public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
198 { 214 {
199 XmlRpcResponse response = new XmlRpcResponse(); 215 XmlRpcResponse response = new XmlRpcResponse();
200 Hashtable requestData = (Hashtable)request.Params[0]; 216 Hashtable requestData = (Hashtable) request.Params[0];
201 Hashtable responseData = new Hashtable(); 217 Hashtable responseData = new Hashtable();
202 string returnString = "FALSE"; 218 string returnString = "FALSE";
203 // Query Result Information 219 // Query Result Information
204 220
205 if (requestData.Contains("ownerID") && requestData.Contains("friendID")) 221 if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
206 { 222 {
207 // UserManagerBase.AddNewuserFriend 223 // UserManagerBase.AddNewuserFriend
208 RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"])); 224 RemoveUserFriend(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]));
209 returnString = "TRUE"; 225 returnString = "TRUE";
210 } 226 }
211 responseData["returnString"] = returnString; 227 responseData["returnString"] = returnString;
@@ -216,13 +232,14 @@ namespace OpenSim.Grid.UserServer
216 public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) 232 public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
217 { 233 {
218 XmlRpcResponse response = new XmlRpcResponse(); 234 XmlRpcResponse response = new XmlRpcResponse();
219 Hashtable requestData = (Hashtable)request.Params[0]; 235 Hashtable requestData = (Hashtable) request.Params[0];
220 Hashtable responseData = new Hashtable(); 236 Hashtable responseData = new Hashtable();
221 string returnString = "FALSE"; 237 string returnString = "FALSE";
222 238
223 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms")) 239 if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
224 { 240 {
225 UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"])); 241 UpdateUserFriendPerms(new LLUUID((string) requestData["ownerID"]), new LLUUID((string) requestData["friendID"]),
242 (uint) Convert.ToInt32((string) requestData["friendPerms"]));
226 // UserManagerBase. 243 // UserManagerBase.
227 returnString = "TRUE"; 244 returnString = "TRUE";
228 } 245 }
@@ -234,16 +251,16 @@ namespace OpenSim.Grid.UserServer
234 public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) 251 public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
235 { 252 {
236 XmlRpcResponse response = new XmlRpcResponse(); 253 XmlRpcResponse response = new XmlRpcResponse();
237 Hashtable requestData = (Hashtable)request.Params[0]; 254 Hashtable requestData = (Hashtable) request.Params[0];
238 Hashtable responseData = new Hashtable(); 255 Hashtable responseData = new Hashtable();
239 256
240 List<FriendListItem> returndata = new List<FriendListItem>(); 257 List<FriendListItem> returndata = new List<FriendListItem>();
241 258
242 if (requestData.Contains("ownerID")) 259 if (requestData.Contains("ownerID"))
243 { 260 {
244 returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"])); 261 returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"]));
245 } 262 }
246 263
247 return FriendListItemListtoXmlRPCResponse(returndata); 264 return FriendListItemListtoXmlRPCResponse(returndata);
248 } 265 }
249 266
@@ -321,7 +338,7 @@ namespace OpenSim.Grid.UserServer
321 { 338 {
322 m_log.Debug("[UserManager]: Got request to update user profile"); 339 m_log.Debug("[UserManager]: Got request to update user profile");
323 XmlRpcResponse response = new XmlRpcResponse(); 340 XmlRpcResponse response = new XmlRpcResponse();
324 Hashtable requestData = (Hashtable)request.Params[0]; 341 Hashtable requestData = (Hashtable) request.Params[0];
325 Hashtable responseData = new Hashtable(); 342 Hashtable responseData = new Hashtable();
326 343
327 UserProfileData userProfile; 344 UserProfileData userProfile;
@@ -330,7 +347,7 @@ namespace OpenSim.Grid.UserServer
330 return CreateUnknownUserErrorResponse(); 347 return CreateUnknownUserErrorResponse();
331 } 348 }
332 349
333 LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]); 350 LLUUID UserUUID = new LLUUID((string) requestData["avatar_uuid"]);
334 userProfile = GetUserProfile(UserUUID); 351 userProfile = GetUserProfile(UserUUID);
335 if (null == userProfile) 352 if (null == userProfile)
336 { 353 {
@@ -342,33 +359,33 @@ namespace OpenSim.Grid.UserServer
342 } 359 }
343 if (requestData.Contains("FLImageID")) 360 if (requestData.Contains("FLImageID"))
344 { 361 {
345 userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]); 362 userProfile.FirstLifeImage = new LLUUID((string) requestData["FLImageID"]);
346 } 363 }
347 if (requestData.Contains("ImageID")) 364 if (requestData.Contains("ImageID"))
348 { 365 {
349 userProfile.Image = new LLUUID((string)requestData["ImageID"]); 366 userProfile.Image = new LLUUID((string) requestData["ImageID"]);
350 } 367 }
351 // dont' know how yet 368 // dont' know how yet
352 if (requestData.Contains("MaturePublish")) 369 if (requestData.Contains("MaturePublish"))
353 { 370 {
354 } 371 }
355 if (requestData.Contains("AboutText")) 372 if (requestData.Contains("AboutText"))
356 { 373 {
357 userProfile.AboutText = (string)requestData["AboutText"]; 374 userProfile.AboutText = (string) requestData["AboutText"];
358 } 375 }
359 if (requestData.Contains("FLAboutText")) 376 if (requestData.Contains("FLAboutText"))
360 { 377 {
361 userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"]; 378 userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"];
362 } 379 }
363 // not in DB yet. 380 // not in DB yet.
364 if (requestData.Contains("ProfileURL")) 381 if (requestData.Contains("ProfileURL"))
365 { 382 {
366 } 383 }
367 if (requestData.Contains("home_region")) 384 if (requestData.Contains("home_region"))
368 { 385 {
369 try 386 try
370 { 387 {
371 userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]); 388 userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]);
372 } 389 }
373 catch (ArgumentException) 390 catch (ArgumentException)
374 { 391 {
@@ -382,25 +399,23 @@ namespace OpenSim.Grid.UserServer
382 { 399 {
383 m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); 400 m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
384 } 401 }
385
386 } 402 }
387 if (requestData.Contains("home_pos_x")) 403 if (requestData.Contains("home_pos_x"))
388 { 404 {
389 try 405 try
390 { 406 {
391 userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); 407 userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]);
392 } 408 }
393 catch (InvalidCastException) 409 catch (InvalidCastException)
394 { 410 {
395 m_log.Error("[PROFILE]:Failed to set home postion x"); 411 m_log.Error("[PROFILE]:Failed to set home postion x");
396 } 412 }
397
398 } 413 }
399 if (requestData.Contains("home_pos_y")) 414 if (requestData.Contains("home_pos_y"))
400 { 415 {
401 try 416 try
402 { 417 {
403 userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); 418 userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]);
404 } 419 }
405 catch (InvalidCastException) 420 catch (InvalidCastException)
406 { 421 {
@@ -411,7 +426,7 @@ namespace OpenSim.Grid.UserServer
411 { 426 {
412 try 427 try
413 { 428 {
414 userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); 429 userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]);
415 } 430 }
416 catch (InvalidCastException) 431 catch (InvalidCastException)
417 { 432 {
@@ -422,7 +437,7 @@ namespace OpenSim.Grid.UserServer
422 { 437 {
423 try 438 try
424 { 439 {
425 userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); 440 userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]);
426 } 441 }
427 catch (InvalidCastException) 442 catch (InvalidCastException)
428 { 443 {
@@ -433,7 +448,7 @@ namespace OpenSim.Grid.UserServer
433 { 448 {
434 try 449 try
435 { 450 {
436 userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); 451 userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]);
437 } 452 }
438 catch (InvalidCastException) 453 catch (InvalidCastException)
439 { 454 {
@@ -442,9 +457,9 @@ namespace OpenSim.Grid.UserServer
442 } 457 }
443 if (requestData.Contains("home_look_z")) 458 if (requestData.Contains("home_look_z"))
444 { 459 {
445 try 460 try
446 { 461 {
447 userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); 462 userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]);
448 } 463 }
449 catch (InvalidCastException) 464 catch (InvalidCastException)
450 { 465 {
@@ -461,18 +476,18 @@ namespace OpenSim.Grid.UserServer
461 public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) 476 public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
462 { 477 {
463 XmlRpcResponse response = new XmlRpcResponse(); 478 XmlRpcResponse response = new XmlRpcResponse();
464 Hashtable requestData = (Hashtable)request.Params[0]; 479 Hashtable requestData = (Hashtable) request.Params[0];
465 480
466 if (requestData.Contains("avatar_uuid")) 481 if (requestData.Contains("avatar_uuid"))
467 { 482 {
468 try 483 try
469 { 484 {
470 LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]); 485 LLUUID userUUID = new LLUUID((string) requestData["avatar_uuid"]);
471 LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]); 486 LLUUID RegionID = new LLUUID((string) requestData["region_uuid"]);
472 ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); 487 ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]);
473 float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]); 488 float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]);
474 float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]); 489 float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]);
475 float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]); 490 float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]);
476 491
477 handlerLogOffUser = OnLogOffUser; 492 handlerLogOffUser = OnLogOffUser;
478 if (handlerLogOffUser != null) 493 if (handlerLogOffUser != null)
@@ -495,20 +510,5 @@ namespace OpenSim.Grid.UserServer
495 } 510 }
496 511
497 #endregion 512 #endregion
498
499 public override UserProfileData SetupMasterUser(string firstName, string lastName)
500 {
501 throw new Exception("The method or operation is not implemented.");
502 }
503
504 public override UserProfileData SetupMasterUser(string firstName, string lastName, string password)
505 {
506 throw new Exception("The method or operation is not implemented.");
507 }
508
509 public override UserProfileData SetupMasterUser(LLUUID uuid)
510 {
511 throw new Exception("The method or operation is not implemented.");
512 }
513 } 513 }
514} 514} \ No newline at end of file