From d0397af998f0ae35ebb8c0a1d0fd837df9990eb9 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Sat, 30 Aug 2008 13:03:38 +0000
Subject: * More cleanup, including UserManager.

---
 OpenSim/Grid/UserServer/UserLoginService.cs |  81 ++++++++-----
 OpenSim/Grid/UserServer/UserManager.cs      | 176 ++++++++++++++--------------
 2 files changed, 138 insertions(+), 119 deletions(-)

diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 972f363..198f95c 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -40,7 +40,8 @@ using OpenSim.Framework.Communications.Cache;
 namespace OpenSim.Grid.UserServer
 {
     public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID,
-    ulong regionhandle, float positionX, float positionY, float positionZ, string firstname, string lastname);
+                                                ulong regionhandle, float positionX, float positionY, float positionZ,
+                                                string firstname, string lastname);
 
     public class UserLoginService : LoginService
     {
@@ -55,7 +56,8 @@ namespace OpenSim.Grid.UserServer
         public UserConfig m_config;
 
         public UserLoginService(
-            UserManagerBase userManager, IInterServiceInventoryServices inventoryService, LibraryRootFolder libraryRootFolder,
+            UserManagerBase userManager, IInterServiceInventoryServices inventoryService,
+            LibraryRootFolder libraryRootFolder,
             UserConfig config, string welcomeMess)
             : base(userManager, libraryRootFolder, welcomeMess)
         {
@@ -69,8 +71,8 @@ namespace OpenSim.Grid.UserServer
             try
             {
                 SimInfo = RegionProfileData.RequestSimProfileData(
-                                theUser.CurrentAgent.Handle, m_config.GridServerURL,
-                                m_config.GridSendKey, m_config.GridRecvKey);
+                    theUser.CurrentAgent.Handle, m_config.GridServerURL,
+                    m_config.GridSendKey, m_config.GridRecvKey);
 
                 if (SimInfo == null)
                 {
@@ -99,7 +101,8 @@ namespace OpenSim.Grid.UserServer
 
             m_log.InfoFormat(
                 "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
-                SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, theUser.FirstName + " " + theUser.SurName);
+                SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI,
+                theUser.FirstName + " " + theUser.SurName);
 
             try
             {
@@ -120,6 +123,7 @@ namespace OpenSim.Grid.UserServer
 
             //base.LogOffUser(theUser);
         }
+
         //public override void LogOffUser(UserProfileData theUser)
         //{
 
@@ -131,7 +135,8 @@ namespace OpenSim.Grid.UserServer
         /// <param name="response">The existing response</param>
         /// <param name="theUser">The user profile</param>
         /// <param name="startLocationRequest">Destination of the user</param>
-        public override void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
+        public override void CustomiseResponse(LoginResponse response, UserProfileData theUser,
+                                               string startLocationRequest)
         {
             bool tryDefault = false;
             //CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one.
@@ -175,7 +180,9 @@ namespace OpenSim.Grid.UserServer
                 else
                 {
                     string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest);
-                    m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" + startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" + startLocationRequestParsed[3]);
+                    m_log.Info("[DEBUGLOGINPARSE]: 1:" + startLocationRequestParsed[0] + ", 2:" +
+                               startLocationRequestParsed[1] + ", 3:" + startLocationRequestParsed[2] + ", 4:" +
+                               startLocationRequestParsed[3]);
                     if (startLocationRequestParsed[0] == "last")
                     {
                         SimInfo =
@@ -187,9 +194,9 @@ namespace OpenSim.Grid.UserServer
                     {
                         m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
                         SimInfo =
-                        RegionProfileData.RequestSimProfileData(
-                            startLocationRequestParsed[0], m_config.GridServerURL,
-                            m_config.GridSendKey, m_config.GridRecvKey);
+                            RegionProfileData.RequestSimProfileData(
+                                startLocationRequestParsed[0], m_config.GridServerURL,
+                                m_config.GridSendKey, m_config.GridRecvKey);
 
                         if (SimInfo == null)
                         {
@@ -208,11 +215,13 @@ namespace OpenSim.Grid.UserServer
                 // Customise the response
                 //CFK: This is redundant and the next message should always appear.
                 //CFK: m_log.Info("[LOGIN]: Home Location");
-                response.Home = string.Format("{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}", 
-                    (HomeInfo.regionLocX * Constants.RegionSize), 
-                    (HomeInfo.regionLocY * Constants.RegionSize), 
-                    theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, 
-                    theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
+                response.Home =
+                    string.Format(
+                        "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
+                        (HomeInfo.regionLocX*Constants.RegionSize),
+                        (HomeInfo.regionLocY*Constants.RegionSize),
+                        theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
+                        theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
 
                 // Destination
                 //CFK: The "Notifying" message always seems to appear, so subsume the data from this message into
@@ -220,7 +229,7 @@ namespace OpenSim.Grid.UserServer
                 //CFK: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
                 //CFK: "; Region Y: " + SimInfo.regionLocY);
                 response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString();
-                response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]);
+                response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] {'/', ':'})[4]);
                 response.RegionX = SimInfo.regionLocX;
                 response.RegionY = SimInfo.regionLocY;
 
@@ -283,10 +292,10 @@ namespace OpenSim.Grid.UserServer
 
                     if (GridResp.Value != null)
                     {
-                        Hashtable resp = (Hashtable)GridResp.Value;
+                        Hashtable resp = (Hashtable) GridResp.Value;
                         if (resp.ContainsKey("success"))
                         {
-                            if ((string)resp["success"] == "FALSE")
+                            if ((string) resp["success"] == "FALSE")
                             {
                                 responseSuccess = false;
                                 tryDefault = true;
@@ -300,15 +309,18 @@ namespace OpenSim.Grid.UserServer
                         if (handlerUserLoggedInAtLocation != null)
                         {
                             //m_log.Info("[LOGIN]: Letting other objects know about login");
-                            handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
-                                theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z,
-                                theUser.FirstName, theUser.SurName);
+                            handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID,
+                                                          theUser.CurrentAgent.Region,
+                                                          theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,
+                                                          theUser.CurrentAgent.Position.Y,
+                                                          theUser.CurrentAgent.Position.Z,
+                                                          theUser.FirstName, theUser.SurName);
                         }
                     }
                 }
             }
             catch (Exception)
-            //catch (System.AccessViolationException)
+                //catch (System.AccessViolationException)
             {
                 tryDefault = true;
             }
@@ -318,7 +330,8 @@ namespace OpenSim.Grid.UserServer
                 // Send him to default region instead
                 // Load information from the gridserver
 
-                ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize);
+                ulong defaultHandle = (((ulong) m_config.DefaultX*Constants.RegionSize) << 32) |
+                                      ((ulong) m_config.DefaultY*Constants.RegionSize);
 
                 m_log.Warn(
                     "[LOGIN]: Home region not available: sending to default " + defaultHandle);
@@ -345,7 +358,7 @@ namespace OpenSim.Grid.UserServer
                                "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
                                SimInfo.regionLocY);
                     response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString();
-                    response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] { '/', ':' })[4]);
+                    response.SimPort = uint.Parse(SimInfo.serverURI.Split(new char[] {'/', ':'})[4]);
                     response.RegionX = SimInfo.regionLocX;
                     response.RegionY = SimInfo.regionLocY;
 
@@ -391,7 +404,7 @@ namespace OpenSim.Grid.UserServer
                             Hashtable resp = (Hashtable) GridResp.Value;
                             if (resp.ContainsKey("success"))
                             {
-                                if ((string)resp["success"] == "FALSE")
+                                if ((string) resp["success"] == "FALSE")
                                 {
                                     responseSuccess = false;
                                 }
@@ -404,9 +417,13 @@ namespace OpenSim.Grid.UserServer
                             if (handlerUserLoggedInAtLocation != null)
                             {
                                 m_log.Info("[LOGIN]: Letting other objects know about login");
-                                handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region,
-                                theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z,
-                                theUser.FirstName, theUser.SurName);
+                                handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID,
+                                                              theUser.CurrentAgent.Region,
+                                                              theUser.CurrentAgent.Handle,
+                                                              theUser.CurrentAgent.Position.X,
+                                                              theUser.CurrentAgent.Position.Y,
+                                                              theUser.CurrentAgent.Position.Z,
+                                                              theUser.FirstName, theUser.SurName);
                             }
                         }
                         else
@@ -432,8 +449,8 @@ namespace OpenSim.Grid.UserServer
         protected override InventoryData GetInventorySkeleton(LLUUID userID)
         {
             m_log.DebugFormat(
-                 "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
-                 m_config.InventoryUrl, userID);
+                "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
+                m_config.InventoryUrl, userID);
 
             List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
 
@@ -451,7 +468,7 @@ namespace OpenSim.Grid.UserServer
                     throw new Exception(
                         String.Format(
                             "The inventory creation request for user {0} did not succeed."
-                                + "  Please contact your inventory service provider for more information.",
+                            + "  Please contact your inventory service provider for more information.",
                             userID));
                 }
                 m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
@@ -490,4 +507,4 @@ namespace OpenSim.Grid.UserServer
                     userID));
         }
     }
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 760dfe3..69c550a 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -29,7 +29,6 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Reflection;
-using System.Text.RegularExpressions;
 using libsecondlife;
 using log4net;
 using Nwc.XmlRpc;
@@ -46,7 +45,7 @@ namespace OpenSim.Grid.UserServer
         private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
         public event logOffUser OnLogOffUser;
-        private logOffUser handlerLogOffUser = null;
+        private logOffUser handlerLogOffUser;
 
         /// <summary>
         /// Deletes an active agent session
@@ -85,14 +84,14 @@ namespace OpenSim.Grid.UserServer
             XmlRpcResponse response = new XmlRpcResponse();
             Hashtable responseData = new Hashtable();
             // Query Result Information
-            responseData["queryid"] = (string) queryID.ToString();
-            responseData["avcount"] = (string) returnUsers.Count.ToString();
+            responseData["queryid"] = queryID.ToString();
+            responseData["avcount"] = returnUsers.Count.ToString();
 
             for (int i = 0; i < returnUsers.Count; i++)
             {
-                responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString();
-                responseData["firstname" + i.ToString()] = returnUsers[i].firstName;
-                responseData["lastname" + i.ToString()] = returnUsers[i].lastName;
+                responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString();
+                responseData["firstname" + i] = returnUsers[i].firstName;
+                responseData["lastname" + i] = returnUsers[i].lastName;
             }
             response.Value = responseData;
 
@@ -105,14 +104,14 @@ namespace OpenSim.Grid.UserServer
             Hashtable responseData = new Hashtable();
             // Query Result Information
 
-            responseData["avcount"] = (string)returnUsers.Count.ToString();
+            responseData["avcount"] = returnUsers.Count.ToString();
 
             for (int i = 0; i < returnUsers.Count; i++)
             {
-                responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString();
-                responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString();
-                responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString();
-                responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString();
+                responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString();
+                responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString();
+                responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString();
+                responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString();
             }
             response.Value = responseData;
 
@@ -159,7 +158,7 @@ namespace OpenSim.Grid.UserServer
 
             responseData["user_flags"] = profile.UserFlags.ToString();
             responseData["god_level"] = profile.GodLevel.ToString();
-            responseData["custom_type"] = profile.CustomType.ToString();
+            responseData["custom_type"] = profile.CustomType;
             responseData["partner"] = profile.Partner.ToString();
             response.Value = responseData;
 
@@ -188,24 +187,25 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
             Hashtable responseData = new Hashtable();
             string returnstring = "FALSE";
 
-            if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") && requestData.Contains("region_uuid"))
+            if (requestData.Contains("avatar_id") && requestData.Contains("region_handle") &&
+                requestData.Contains("region_uuid"))
             {
                 // ulong cregionhandle = 0;
-                LLUUID regionUUID = LLUUID.Zero;
-                LLUUID avatarUUID = LLUUID.Zero;
+                LLUUID regionUUID;
+                LLUUID avatarUUID;
 
-                Helpers.TryParse((string)requestData["avatar_id"], out avatarUUID);
-                Helpers.TryParse((string)requestData["region_uuid"], out regionUUID);
+                Helpers.TryParse((string) requestData["avatar_id"], out avatarUUID);
+                Helpers.TryParse((string) requestData["region_uuid"], out regionUUID);
 
                 if (avatarUUID != LLUUID.Zero)
                 {
                     UserProfileData userProfile = GetUserProfile(avatarUUID);
                     userProfile.CurrentAgent.Region = regionUUID;
-                    userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
+                    userProfile.CurrentAgent.Handle = (ulong) Convert.ToInt64((string) requestData["region_handle"]);
                     //userProfile.CurrentAgent.
                     CommitAgent(ref userProfile);
                     //setUserProfile(userProfile);
@@ -213,7 +213,6 @@ namespace OpenSim.Grid.UserServer
 
                     returnstring = "TRUE";
                 }
-
             }
             responseData.Add("returnString", returnstring);
             response.Value = responseData;
@@ -223,15 +222,18 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
             Hashtable responseData = new Hashtable();
             string returnString = "FALSE";
             // Query Result Information
 
-            if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
+            if (requestData.Contains("ownerID") && requestData.Contains("friendID") &&
+                requestData.Contains("friendPerms"))
             {
                 // UserManagerBase.AddNewuserFriend
-                AddNewUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
+                AddNewUserFriend(new LLUUID((string) requestData["ownerID"]),
+                                 new LLUUID((string) requestData["friendID"]),
+                                 (uint) Convert.ToInt32((string) requestData["friendPerms"]));
                 returnString = "TRUE";
             }
             responseData["returnString"] = returnString;
@@ -242,7 +244,7 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
             Hashtable responseData = new Hashtable();
             string returnString = "FALSE";
             // Query Result Information
@@ -250,7 +252,8 @@ namespace OpenSim.Grid.UserServer
             if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
             {
                 // UserManagerBase.AddNewuserFriend
-                RemoveUserFriend(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]));
+                RemoveUserFriend(new LLUUID((string) requestData["ownerID"]),
+                                 new LLUUID((string) requestData["friendID"]));
                 returnString = "TRUE";
             }
             responseData["returnString"] = returnString;
@@ -261,13 +264,16 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
             Hashtable responseData = new Hashtable();
             string returnString = "FALSE";
 
-            if (requestData.Contains("ownerID") && requestData.Contains("friendID") && requestData.Contains("friendPerms"))
+            if (requestData.Contains("ownerID") && requestData.Contains("friendID") &&
+                requestData.Contains("friendPerms"))
             {
-                UpdateUserFriendPerms(new LLUUID((string)requestData["ownerID"]), new LLUUID((string)requestData["friendID"]), (uint)Convert.ToInt32((string)requestData["friendPerms"]));
+                UpdateUserFriendPerms(new LLUUID((string) requestData["ownerID"]),
+                                      new LLUUID((string) requestData["friendID"]),
+                                      (uint) Convert.ToInt32((string) requestData["friendPerms"]));
                 // UserManagerBase.
                 returnString = "TRUE";
             }
@@ -279,14 +285,14 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
         {
             // XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
             // Hashtable responseData = new Hashtable();
 
             List<FriendListItem> returndata = new List<FriendListItem>();
 
             if (requestData.Contains("ownerID"))
             {
-                returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
+                returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"]));
             }
 
             return FriendListItemListtoXmlRPCResponse(returndata);
@@ -295,12 +301,12 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
-            AvatarAppearance appearance = null;
-            Hashtable responseData = null;
+            Hashtable requestData = (Hashtable) request.Params[0];
+            AvatarAppearance appearance;
+            Hashtable responseData;
             if (requestData.Contains("owner"))
             {
-                appearance = GetUserAppearance(new LLUUID((string)requestData["owner"]));
+                appearance = GetUserAppearance(new LLUUID((string) requestData["owner"]));
                 if (appearance == null)
                 {
                     responseData = new Hashtable();
@@ -326,12 +332,12 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
-            Hashtable responseData = null;
+            Hashtable requestData = (Hashtable) request.Params[0];
+            Hashtable responseData;
             if (requestData.Contains("owner"))
             {
                 AvatarAppearance appearance = new AvatarAppearance(requestData);
-                UpdateUserAppearance(new LLUUID((string)requestData["owner"]), appearance);
+                UpdateUserAppearance(new LLUUID((string) requestData["owner"]), appearance);
                 responseData = new Hashtable();
                 responseData["returnString"] = "TRUE";
             }
@@ -356,8 +362,7 @@ namespace OpenSim.Grid.UserServer
 
                 // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
 
-                string[] querysplit;
-                querysplit = query.Split(' ');
+                string[] querysplit = query.Split(' ');
 
                 if (querysplit.Length == 2)
                 {
@@ -389,10 +394,9 @@ namespace OpenSim.Grid.UserServer
             //CFK: Console.WriteLine("METHOD BY UUID CALLED");
             if (requestData.Contains("avatar_uuid"))
             {
-                LLUUID guess = new LLUUID();
                 try
                 {
-                    guess = new LLUUID((string) requestData["avatar_uuid"]);
+                    LLUUID guess = new LLUUID((string) requestData["avatar_uuid"]);
 
                     userProfile = GetUserProfile(guess);
                 }
@@ -417,15 +421,15 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
             UserProfileData userProfile;
             //CFK: this clogs the UserServer log and is not necessary at this time.
             //CFK: Console.WriteLine("METHOD BY UUID CALLED");
             if (requestData.Contains("avatar_uuid"))
             {
-                LLUUID guess = LLUUID.Zero;
+                LLUUID guess;
 
-                Helpers.TryParse((string)requestData["avatar_uuid"],out guess);
+                Helpers.TryParse((string) requestData["avatar_uuid"], out guess);
 
                 if (guess == LLUUID.Zero)
                 {
@@ -446,12 +450,12 @@ namespace OpenSim.Grid.UserServer
                 }
                 Hashtable responseData = new Hashtable();
 
-                responseData["handle"]=userProfile.CurrentAgent.Handle.ToString();
-                responseData["session"]=userProfile.CurrentAgent.SessionID.ToString();
+                responseData["handle"] = userProfile.CurrentAgent.Handle.ToString();
+                responseData["session"] = userProfile.CurrentAgent.SessionID.ToString();
                 if (userProfile.CurrentAgent.AgentOnline)
-                    responseData["agent_online"]="TRUE";
+                    responseData["agent_online"] = "TRUE";
                 else
-                    responseData["agent_online"]="FALSE";
+                    responseData["agent_online"] = "FALSE";
 
                 response.Value = responseData;
             }
@@ -466,27 +470,28 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
             UserProfileData userProfile;
 
             string authed = "FALSE";
             if (requestData.Contains("avatar_uuid") && requestData.Contains("session_id"))
             {
-                LLUUID guess_aid = LLUUID.Zero;
-                LLUUID guess_sid = LLUUID.Zero;
+                LLUUID guess_aid;
+                LLUUID guess_sid;
 
-                Helpers.TryParse((string)requestData["avatar_uuid"], out guess_aid);
+                Helpers.TryParse((string) requestData["avatar_uuid"], out guess_aid);
                 if (guess_aid == LLUUID.Zero)
                 {
                     return CreateUnknownUserErrorResponse();
                 }
-                Helpers.TryParse((string)requestData["session_id"], out guess_sid);
+                Helpers.TryParse((string) requestData["session_id"], out guess_sid);
                 if (guess_sid == LLUUID.Zero)
                 {
                     return CreateUnknownUserErrorResponse();
                 }
                 userProfile = GetUserProfile(guess_aid);
-                if (userProfile != null && userProfile.CurrentAgent != null && userProfile.CurrentAgent.SessionID == guess_sid)
+                if (userProfile != null && userProfile.CurrentAgent != null &&
+                    userProfile.CurrentAgent.SessionID == guess_sid)
                 {
                     authed = "TRUE";
                 }
@@ -507,17 +512,16 @@ namespace OpenSim.Grid.UserServer
         {
             m_log.Debug("[UserManager]: Got request to update user profile");
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
             Hashtable responseData = new Hashtable();
 
-            UserProfileData userProfile;
             if (!requestData.Contains("avatar_uuid"))
             {
                 return CreateUnknownUserErrorResponse();
             }
 
-            LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]);
-            userProfile = GetUserProfile(UserUUID);
+            LLUUID UserUUID = new LLUUID((string) requestData["avatar_uuid"]);
+            UserProfileData userProfile = GetUserProfile(UserUUID);
             if (null == userProfile)
             {
                 return CreateUnknownUserErrorResponse();
@@ -528,11 +532,11 @@ namespace OpenSim.Grid.UserServer
             }
             if (requestData.Contains("FLImageID"))
             {
-                userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]);
+                userProfile.FirstLifeImage = new LLUUID((string) requestData["FLImageID"]);
             }
             if (requestData.Contains("ImageID"))
             {
-                userProfile.Image = new LLUUID((string)requestData["ImageID"]);
+                userProfile.Image = new LLUUID((string) requestData["ImageID"]);
             }
             // dont' know how yet
             if (requestData.Contains("MaturePublish"))
@@ -540,11 +544,11 @@ namespace OpenSim.Grid.UserServer
             }
             if (requestData.Contains("AboutText"))
             {
-                userProfile.AboutText = (string)requestData["AboutText"];
+                userProfile.AboutText = (string) requestData["AboutText"];
             }
             if (requestData.Contains("FLAboutText"))
             {
-                userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"];
+                userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"];
             }
             // not in DB yet.
             if (requestData.Contains("ProfileURL"))
@@ -554,7 +558,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]);
+                    userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]);
                 }
                 catch (ArgumentException)
                 {
@@ -568,31 +572,29 @@ namespace OpenSim.Grid.UserServer
                 {
                     m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
                 }
-
             }
             if (requestData.Contains("home_region_id"))
             {
-                LLUUID regionID = LLUUID.Zero;
-                LLUUID.TryParse((string)requestData["home_region_id"], out regionID);
+                LLUUID regionID;
+                LLUUID.TryParse((string) requestData["home_region_id"], out regionID);
                 userProfile.HomeRegionID = regionID;
             }
             if (requestData.Contains("home_pos_x"))
             {
                 try
                 {
-                    userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]);
+                    userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]);
                 }
                 catch (InvalidCastException)
                 {
                     m_log.Error("[PROFILE]:Failed to set home postion x");
                 }
-
             }
             if (requestData.Contains("home_pos_y"))
             {
                 try
                 {
-                    userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]);
+                    userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]);
                 }
                 catch (InvalidCastException)
                 {
@@ -603,7 +605,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]);
+                    userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]);
                 }
                 catch (InvalidCastException)
                 {
@@ -614,7 +616,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]);
+                    userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]);
                 }
                 catch (InvalidCastException)
                 {
@@ -625,7 +627,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]);
+                    userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]);
                 }
                 catch (InvalidCastException)
                 {
@@ -636,7 +638,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]);
+                    userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]);
                 }
                 catch (InvalidCastException)
                 {
@@ -647,7 +649,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]);
+                    userProfile.UserFlags = Convert.ToInt32((string) requestData["user_flags"]);
                 }
                 catch (InvalidCastException)
                 {
@@ -658,7 +660,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]);
+                    userProfile.GodLevel = Convert.ToInt32((string) requestData["god_level"]);
                 }
                 catch (InvalidCastException)
                 {
@@ -669,7 +671,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.CustomType = (string)requestData["custom_type"];
+                    userProfile.CustomType = (string) requestData["custom_type"];
                 }
                 catch (InvalidCastException)
                 {
@@ -680,7 +682,7 @@ namespace OpenSim.Grid.UserServer
             {
                 try
                 {
-                    userProfile.Partner = new LLUUID((string)requestData["partner"]);
+                    userProfile.Partner = new LLUUID((string) requestData["partner"]);
                 }
                 catch (InvalidCastException)
                 {
@@ -689,7 +691,7 @@ namespace OpenSim.Grid.UserServer
             }
             else
             {
-                 userProfile.Partner = LLUUID.Zero;
+                userProfile.Partner = LLUUID.Zero;
             }
 
             // call plugin!
@@ -702,18 +704,18 @@ namespace OpenSim.Grid.UserServer
         public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
         {
             XmlRpcResponse response = new XmlRpcResponse();
-            Hashtable requestData = (Hashtable)request.Params[0];
+            Hashtable requestData = (Hashtable) request.Params[0];
 
             if (requestData.Contains("avatar_uuid"))
             {
                 try
                 {
-                    LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]);
-                    LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]);
-                    ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
-                    float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]);
-                    float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]);
-                    float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]);
+                    LLUUID userUUID = new LLUUID((string) requestData["avatar_uuid"]);
+                    LLUUID RegionID = new LLUUID((string) requestData["region_uuid"]);
+                    ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]);
+                    float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]);
+                    float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]);
+                    float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]);
 
                     handlerLogOffUser = OnLogOffUser;
                     if (handlerLogOffUser != null)
@@ -752,4 +754,4 @@ namespace OpenSim.Grid.UserServer
             throw new Exception("The method or operation is not implemented.");
         }
     }
-}
+}
\ No newline at end of file
-- 
cgit v1.1