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