* More cleanup, including UserManager.

0.6.0-stable
Adam Frisby 2008-08-30 13:03:38 +00:00
parent 50a62145ad
commit d0397af998
2 changed files with 138 additions and 119 deletions

View File

@ -40,7 +40,8 @@ using OpenSim.Framework.Communications.Cache;
namespace OpenSim.Grid.UserServer namespace OpenSim.Grid.UserServer
{ {
public delegate void UserLoggedInAtLocation(LLUUID agentID, LLUUID sessionID, LLUUID RegionID, 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 public class UserLoginService : LoginService
{ {
@ -55,7 +56,8 @@ namespace OpenSim.Grid.UserServer
public UserConfig m_config; public UserConfig m_config;
public UserLoginService( public UserLoginService(
UserManagerBase userManager, IInterServiceInventoryServices inventoryService, LibraryRootFolder libraryRootFolder, UserManagerBase userManager, IInterServiceInventoryServices inventoryService,
LibraryRootFolder libraryRootFolder,
UserConfig config, string welcomeMess) UserConfig config, string welcomeMess)
: base(userManager, libraryRootFolder, welcomeMess) : base(userManager, libraryRootFolder, welcomeMess)
{ {
@ -69,8 +71,8 @@ namespace OpenSim.Grid.UserServer
try try
{ {
SimInfo = RegionProfileData.RequestSimProfileData( SimInfo = RegionProfileData.RequestSimProfileData(
theUser.CurrentAgent.Handle, m_config.GridServerURL, theUser.CurrentAgent.Handle, m_config.GridServerURL,
m_config.GridSendKey, m_config.GridRecvKey); m_config.GridSendKey, m_config.GridRecvKey);
if (SimInfo == null) if (SimInfo == null)
{ {
@ -99,7 +101,8 @@ namespace OpenSim.Grid.UserServer
m_log.InfoFormat( m_log.InfoFormat(
"[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", "[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 try
{ {
@ -120,6 +123,7 @@ namespace OpenSim.Grid.UserServer
//base.LogOffUser(theUser); //base.LogOffUser(theUser);
} }
//public override void LogOffUser(UserProfileData theUser) //public override void LogOffUser(UserProfileData theUser)
//{ //{
@ -131,7 +135,8 @@ namespace OpenSim.Grid.UserServer
/// <param name="response">The existing response</param> /// <param name="response">The existing response</param>
/// <param name="theUser">The user profile</param> /// <param name="theUser">The user profile</param>
/// <param name="startLocationRequest">Destination of the user</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; bool tryDefault = false;
//CFK: Since the try is always "tried", the "Home Location" message should always appear, so comment this one. //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 else
{ {
string[] startLocationRequestParsed = Util.ParseStartLocationRequest(startLocationRequest); 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") if (startLocationRequestParsed[0] == "last")
{ {
SimInfo = SimInfo =
@ -187,9 +194,9 @@ namespace OpenSim.Grid.UserServer
{ {
m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]); m_log.Info("[LOGIN]: Looking up Sim: " + startLocationRequestParsed[0]);
SimInfo = SimInfo =
RegionProfileData.RequestSimProfileData( RegionProfileData.RequestSimProfileData(
startLocationRequestParsed[0], m_config.GridServerURL, startLocationRequestParsed[0], m_config.GridServerURL,
m_config.GridSendKey, m_config.GridRecvKey); m_config.GridSendKey, m_config.GridRecvKey);
if (SimInfo == null) if (SimInfo == null)
{ {
@ -208,11 +215,13 @@ namespace OpenSim.Grid.UserServer
// Customise the response // Customise the response
//CFK: This is redundant and the next message should always appear. //CFK: This is redundant and the next message should always appear.
//CFK: m_log.Info("[LOGIN]: Home Location"); //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}]}}", response.Home =
(HomeInfo.regionLocX * Constants.RegionSize), string.Format(
(HomeInfo.regionLocY * Constants.RegionSize), "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z, (HomeInfo.regionLocX*Constants.RegionSize),
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z); (HomeInfo.regionLocY*Constants.RegionSize),
theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
// Destination // Destination
//CFK: The "Notifying" message always seems to appear, so subsume the data from this message into //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: m_log.Info("[LOGIN]: CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX +
//CFK: "; Region Y: " + SimInfo.regionLocY); //CFK: "; Region Y: " + SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString(); 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.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY; response.RegionY = SimInfo.regionLocY;
@ -283,10 +292,10 @@ namespace OpenSim.Grid.UserServer
if (GridResp.Value != null) if (GridResp.Value != null)
{ {
Hashtable resp = (Hashtable)GridResp.Value; Hashtable resp = (Hashtable) GridResp.Value;
if (resp.ContainsKey("success")) if (resp.ContainsKey("success"))
{ {
if ((string)resp["success"] == "FALSE") if ((string) resp["success"] == "FALSE")
{ {
responseSuccess = false; responseSuccess = false;
tryDefault = true; tryDefault = true;
@ -300,15 +309,18 @@ namespace OpenSim.Grid.UserServer
if (handlerUserLoggedInAtLocation != null) if (handlerUserLoggedInAtLocation != null)
{ {
//m_log.Info("[LOGIN]: Letting other objects know about login"); //m_log.Info("[LOGIN]: Letting other objects know about login");
handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID,
theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, theUser.CurrentAgent.Region,
theUser.FirstName, theUser.SurName); theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X,
theUser.CurrentAgent.Position.Y,
theUser.CurrentAgent.Position.Z,
theUser.FirstName, theUser.SurName);
} }
} }
} }
} }
catch (Exception) catch (Exception)
//catch (System.AccessViolationException) //catch (System.AccessViolationException)
{ {
tryDefault = true; tryDefault = true;
} }
@ -318,7 +330,8 @@ namespace OpenSim.Grid.UserServer
// Send him to default region instead // Send him to default region instead
// Load information from the gridserver // 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( m_log.Warn(
"[LOGIN]: Home region not available: sending to default " + defaultHandle); "[LOGIN]: Home region not available: sending to default " + defaultHandle);
@ -345,7 +358,7 @@ namespace OpenSim.Grid.UserServer
"CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " + "CUSTOMISERESPONSE: Region X: " + SimInfo.regionLocX + "; Region Y: " +
SimInfo.regionLocY); SimInfo.regionLocY);
response.SimAddress = Util.GetHostFromURL(SimInfo.serverURI).ToString(); 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.RegionX = SimInfo.regionLocX;
response.RegionY = SimInfo.regionLocY; response.RegionY = SimInfo.regionLocY;
@ -391,7 +404,7 @@ namespace OpenSim.Grid.UserServer
Hashtable resp = (Hashtable) GridResp.Value; Hashtable resp = (Hashtable) GridResp.Value;
if (resp.ContainsKey("success")) if (resp.ContainsKey("success"))
{ {
if ((string)resp["success"] == "FALSE") if ((string) resp["success"] == "FALSE")
{ {
responseSuccess = false; responseSuccess = false;
} }
@ -404,9 +417,13 @@ namespace OpenSim.Grid.UserServer
if (handlerUserLoggedInAtLocation != null) if (handlerUserLoggedInAtLocation != null)
{ {
m_log.Info("[LOGIN]: Letting other objects know about login"); m_log.Info("[LOGIN]: Letting other objects know about login");
handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID, theUser.CurrentAgent.Region, handlerUserLoggedInAtLocation(theUser.ID, theUser.CurrentAgent.SessionID,
theUser.CurrentAgent.Handle, theUser.CurrentAgent.Position.X, theUser.CurrentAgent.Position.Y, theUser.CurrentAgent.Position.Z, theUser.CurrentAgent.Region,
theUser.FirstName, theUser.SurName); theUser.CurrentAgent.Handle,
theUser.CurrentAgent.Position.X,
theUser.CurrentAgent.Position.Y,
theUser.CurrentAgent.Position.Z,
theUser.FirstName, theUser.SurName);
} }
} }
else else
@ -432,8 +449,8 @@ namespace OpenSim.Grid.UserServer
protected override InventoryData GetInventorySkeleton(LLUUID userID) protected override InventoryData GetInventorySkeleton(LLUUID userID)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
m_config.InventoryUrl, userID); m_config.InventoryUrl, userID);
List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID); List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
@ -451,7 +468,7 @@ namespace OpenSim.Grid.UserServer
throw new Exception( throw new Exception(
String.Format( String.Format(
"The inventory creation request for user {0} did not succeed." "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)); userID));
} }
m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID); m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);

View File

@ -29,7 +29,6 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions;
using libsecondlife; using libsecondlife;
using log4net; using log4net;
using Nwc.XmlRpc; using Nwc.XmlRpc;
@ -46,7 +45,7 @@ namespace OpenSim.Grid.UserServer
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public event logOffUser OnLogOffUser; public event logOffUser OnLogOffUser;
private logOffUser handlerLogOffUser = null; private logOffUser handlerLogOffUser;
/// <summary> /// <summary>
/// Deletes an active agent session /// Deletes an active agent session
@ -85,14 +84,14 @@ namespace OpenSim.Grid.UserServer
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
// Query Result Information // Query Result Information
responseData["queryid"] = (string) queryID.ToString(); responseData["queryid"] = queryID.ToString();
responseData["avcount"] = (string) returnUsers.Count.ToString(); responseData["avcount"] = returnUsers.Count.ToString();
for (int i = 0; i < returnUsers.Count; i++) for (int i = 0; i < returnUsers.Count; i++)
{ {
responseData["avatarid" + i.ToString()] = returnUsers[i].AvatarID.ToString(); responseData["avatarid" + i] = returnUsers[i].AvatarID.ToString();
responseData["firstname" + i.ToString()] = returnUsers[i].firstName; responseData["firstname" + i] = returnUsers[i].firstName;
responseData["lastname" + i.ToString()] = returnUsers[i].lastName; responseData["lastname" + i] = returnUsers[i].lastName;
} }
response.Value = responseData; response.Value = responseData;
@ -105,14 +104,14 @@ namespace OpenSim.Grid.UserServer
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
// Query Result Information // Query Result Information
responseData["avcount"] = (string)returnUsers.Count.ToString(); responseData["avcount"] = returnUsers.Count.ToString();
for (int i = 0; i < returnUsers.Count; i++) for (int i = 0; i < returnUsers.Count; i++)
{ {
responseData["ownerID" + i.ToString()] = returnUsers[i].FriendListOwner.UUID.ToString(); responseData["ownerID" + i] = returnUsers[i].FriendListOwner.UUID.ToString();
responseData["friendID" + i.ToString()] = returnUsers[i].Friend.UUID.ToString(); responseData["friendID" + i] = returnUsers[i].Friend.UUID.ToString();
responseData["ownerPerms" + i.ToString()] = returnUsers[i].FriendListOwnerPerms.ToString(); responseData["ownerPerms" + i] = returnUsers[i].FriendListOwnerPerms.ToString();
responseData["friendPerms" + i.ToString()] = returnUsers[i].FriendPerms.ToString(); responseData["friendPerms" + i] = returnUsers[i].FriendPerms.ToString();
} }
response.Value = responseData; response.Value = responseData;
@ -159,7 +158,7 @@ namespace OpenSim.Grid.UserServer
responseData["user_flags"] = profile.UserFlags.ToString(); responseData["user_flags"] = profile.UserFlags.ToString();
responseData["god_level"] = profile.GodLevel.ToString(); responseData["god_level"] = profile.GodLevel.ToString();
responseData["custom_type"] = profile.CustomType.ToString(); responseData["custom_type"] = profile.CustomType;
responseData["partner"] = profile.Partner.ToString(); responseData["partner"] = profile.Partner.ToString();
response.Value = responseData; response.Value = responseData;
@ -188,24 +187,25 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request) public XmlRpcResponse XmlRPCAtRegion(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
string returnstring = "FALSE"; 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; // ulong cregionhandle = 0;
LLUUID regionUUID = LLUUID.Zero; LLUUID regionUUID;
LLUUID avatarUUID = LLUUID.Zero; LLUUID avatarUUID;
Helpers.TryParse((string)requestData["avatar_id"], out avatarUUID); Helpers.TryParse((string) requestData["avatar_id"], out avatarUUID);
Helpers.TryParse((string)requestData["region_uuid"], out regionUUID); Helpers.TryParse((string) requestData["region_uuid"], out regionUUID);
if (avatarUUID != LLUUID.Zero) if (avatarUUID != LLUUID.Zero)
{ {
UserProfileData userProfile = GetUserProfile(avatarUUID); UserProfileData userProfile = GetUserProfile(avatarUUID);
userProfile.CurrentAgent.Region = regionUUID; 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. //userProfile.CurrentAgent.
CommitAgent(ref userProfile); CommitAgent(ref userProfile);
//setUserProfile(userProfile); //setUserProfile(userProfile);
@ -213,7 +213,6 @@ namespace OpenSim.Grid.UserServer
returnstring = "TRUE"; returnstring = "TRUE";
} }
} }
responseData.Add("returnString", returnstring); responseData.Add("returnString", returnstring);
response.Value = responseData; response.Value = responseData;
@ -223,15 +222,18 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request) public XmlRpcResponse XmlRpcResponseXmlRPCAddUserFriend(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
string returnString = "FALSE"; string returnString = "FALSE";
// Query Result Information // 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 // 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"; returnString = "TRUE";
} }
responseData["returnString"] = returnString; responseData["returnString"] = returnString;
@ -242,7 +244,7 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request) public XmlRpcResponse XmlRpcResponseXmlRPCRemoveUserFriend(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
string returnString = "FALSE"; string returnString = "FALSE";
// Query Result Information // Query Result Information
@ -250,7 +252,8 @@ namespace OpenSim.Grid.UserServer
if (requestData.Contains("ownerID") && requestData.Contains("friendID")) if (requestData.Contains("ownerID") && requestData.Contains("friendID"))
{ {
// UserManagerBase.AddNewuserFriend // 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"; returnString = "TRUE";
} }
responseData["returnString"] = returnString; responseData["returnString"] = returnString;
@ -261,13 +264,16 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request) public XmlRpcResponse XmlRpcResponseXmlRPCUpdateUserFriendPerms(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
string returnString = "FALSE"; 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. // UserManagerBase.
returnString = "TRUE"; returnString = "TRUE";
} }
@ -279,14 +285,14 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request) public XmlRpcResponse XmlRpcResponseXmlRPCGetUserFriendList(XmlRpcRequest request)
{ {
// XmlRpcResponse response = new XmlRpcResponse(); // XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
// Hashtable responseData = new Hashtable(); // Hashtable responseData = new Hashtable();
List<FriendListItem> returndata = new List<FriendListItem>(); List<FriendListItem> returndata = new List<FriendListItem>();
if (requestData.Contains("ownerID")) if (requestData.Contains("ownerID"))
{ {
returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"])); returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"]));
} }
return FriendListItemListtoXmlRPCResponse(returndata); return FriendListItemListtoXmlRPCResponse(returndata);
@ -295,12 +301,12 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request) public XmlRpcResponse XmlRPCGetAvatarAppearance(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
AvatarAppearance appearance = null; AvatarAppearance appearance;
Hashtable responseData = null; Hashtable responseData;
if (requestData.Contains("owner")) if (requestData.Contains("owner"))
{ {
appearance = GetUserAppearance(new LLUUID((string)requestData["owner"])); appearance = GetUserAppearance(new LLUUID((string) requestData["owner"]));
if (appearance == null) if (appearance == null)
{ {
responseData = new Hashtable(); responseData = new Hashtable();
@ -326,12 +332,12 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request) public XmlRpcResponse XmlRPCUpdateAvatarAppearance(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = null; Hashtable responseData;
if (requestData.Contains("owner")) if (requestData.Contains("owner"))
{ {
AvatarAppearance appearance = new AvatarAppearance(requestData); AvatarAppearance appearance = new AvatarAppearance(requestData);
UpdateUserAppearance(new LLUUID((string)requestData["owner"]), appearance); UpdateUserAppearance(new LLUUID((string) requestData["owner"]), appearance);
responseData = new Hashtable(); responseData = new Hashtable();
responseData["returnString"] = "TRUE"; responseData["returnString"] = "TRUE";
} }
@ -356,8 +362,7 @@ namespace OpenSim.Grid.UserServer
// Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]"); // Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
string[] querysplit; string[] querysplit = query.Split(' ');
querysplit = query.Split(' ');
if (querysplit.Length == 2) if (querysplit.Length == 2)
{ {
@ -389,10 +394,9 @@ namespace OpenSim.Grid.UserServer
//CFK: Console.WriteLine("METHOD BY UUID CALLED"); //CFK: Console.WriteLine("METHOD BY UUID CALLED");
if (requestData.Contains("avatar_uuid")) if (requestData.Contains("avatar_uuid"))
{ {
LLUUID guess = new LLUUID();
try try
{ {
guess = new LLUUID((string) requestData["avatar_uuid"]); LLUUID guess = new LLUUID((string) requestData["avatar_uuid"]);
userProfile = GetUserProfile(guess); userProfile = GetUserProfile(guess);
} }
@ -417,15 +421,15 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request) public XmlRpcResponse XmlRPCGetAgentMethodUUID(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
UserProfileData userProfile; UserProfileData userProfile;
//CFK: this clogs the UserServer log and is not necessary at this time. //CFK: this clogs the UserServer log and is not necessary at this time.
//CFK: Console.WriteLine("METHOD BY UUID CALLED"); //CFK: Console.WriteLine("METHOD BY UUID CALLED");
if (requestData.Contains("avatar_uuid")) 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) if (guess == LLUUID.Zero)
{ {
@ -446,12 +450,12 @@ namespace OpenSim.Grid.UserServer
} }
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
responseData["handle"]=userProfile.CurrentAgent.Handle.ToString(); responseData["handle"] = userProfile.CurrentAgent.Handle.ToString();
responseData["session"]=userProfile.CurrentAgent.SessionID.ToString(); responseData["session"] = userProfile.CurrentAgent.SessionID.ToString();
if (userProfile.CurrentAgent.AgentOnline) if (userProfile.CurrentAgent.AgentOnline)
responseData["agent_online"]="TRUE"; responseData["agent_online"] = "TRUE";
else else
responseData["agent_online"]="FALSE"; responseData["agent_online"] = "FALSE";
response.Value = responseData; response.Value = responseData;
} }
@ -466,27 +470,28 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request) public XmlRpcResponse XmlRPCCheckAuthSession(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
UserProfileData userProfile; UserProfileData userProfile;
string authed = "FALSE"; string authed = "FALSE";
if (requestData.Contains("avatar_uuid") && requestData.Contains("session_id")) if (requestData.Contains("avatar_uuid") && requestData.Contains("session_id"))
{ {
LLUUID guess_aid = LLUUID.Zero; LLUUID guess_aid;
LLUUID guess_sid = LLUUID.Zero; 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) if (guess_aid == LLUUID.Zero)
{ {
return CreateUnknownUserErrorResponse(); 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) if (guess_sid == LLUUID.Zero)
{ {
return CreateUnknownUserErrorResponse(); return CreateUnknownUserErrorResponse();
} }
userProfile = GetUserProfile(guess_aid); 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"; authed = "TRUE";
} }
@ -507,17 +512,16 @@ namespace OpenSim.Grid.UserServer
{ {
m_log.Debug("[UserManager]: Got request to update user profile"); m_log.Debug("[UserManager]: Got request to update user profile");
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
UserProfileData userProfile;
if (!requestData.Contains("avatar_uuid")) if (!requestData.Contains("avatar_uuid"))
{ {
return CreateUnknownUserErrorResponse(); return CreateUnknownUserErrorResponse();
} }
LLUUID UserUUID = new LLUUID((string)requestData["avatar_uuid"]); LLUUID UserUUID = new LLUUID((string) requestData["avatar_uuid"]);
userProfile = GetUserProfile(UserUUID); UserProfileData userProfile = GetUserProfile(UserUUID);
if (null == userProfile) if (null == userProfile)
{ {
return CreateUnknownUserErrorResponse(); return CreateUnknownUserErrorResponse();
@ -528,11 +532,11 @@ namespace OpenSim.Grid.UserServer
} }
if (requestData.Contains("FLImageID")) if (requestData.Contains("FLImageID"))
{ {
userProfile.FirstLifeImage = new LLUUID((string)requestData["FLImageID"]); userProfile.FirstLifeImage = new LLUUID((string) requestData["FLImageID"]);
} }
if (requestData.Contains("ImageID")) if (requestData.Contains("ImageID"))
{ {
userProfile.Image = new LLUUID((string)requestData["ImageID"]); userProfile.Image = new LLUUID((string) requestData["ImageID"]);
} }
// dont' know how yet // dont' know how yet
if (requestData.Contains("MaturePublish")) if (requestData.Contains("MaturePublish"))
@ -540,11 +544,11 @@ namespace OpenSim.Grid.UserServer
} }
if (requestData.Contains("AboutText")) if (requestData.Contains("AboutText"))
{ {
userProfile.AboutText = (string)requestData["AboutText"]; userProfile.AboutText = (string) requestData["AboutText"];
} }
if (requestData.Contains("FLAboutText")) if (requestData.Contains("FLAboutText"))
{ {
userProfile.FirstLifeAboutText = (string)requestData["FLAboutText"]; userProfile.FirstLifeAboutText = (string) requestData["FLAboutText"];
} }
// not in DB yet. // not in DB yet.
if (requestData.Contains("ProfileURL")) if (requestData.Contains("ProfileURL"))
@ -554,7 +558,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeRegion = Convert.ToUInt64((string)requestData["home_region"]); userProfile.HomeRegion = Convert.ToUInt64((string) requestData["home_region"]);
} }
catch (ArgumentException) catch (ArgumentException)
{ {
@ -568,31 +572,29 @@ namespace OpenSim.Grid.UserServer
{ {
m_log.Error("[PROFILE]:Failed to set home region, Value was too large"); m_log.Error("[PROFILE]:Failed to set home region, Value was too large");
} }
} }
if (requestData.Contains("home_region_id")) if (requestData.Contains("home_region_id"))
{ {
LLUUID regionID = LLUUID.Zero; LLUUID regionID;
LLUUID.TryParse((string)requestData["home_region_id"], out regionID); LLUUID.TryParse((string) requestData["home_region_id"], out regionID);
userProfile.HomeRegionID = regionID; userProfile.HomeRegionID = regionID;
} }
if (requestData.Contains("home_pos_x")) if (requestData.Contains("home_pos_x"))
{ {
try try
{ {
userProfile.HomeLocationX = (float)Convert.ToDecimal((string)requestData["home_pos_x"]); userProfile.HomeLocationX = (float) Convert.ToDecimal((string) requestData["home_pos_x"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
m_log.Error("[PROFILE]:Failed to set home postion x"); m_log.Error("[PROFILE]:Failed to set home postion x");
} }
} }
if (requestData.Contains("home_pos_y")) if (requestData.Contains("home_pos_y"))
{ {
try try
{ {
userProfile.HomeLocationY = (float)Convert.ToDecimal((string)requestData["home_pos_y"]); userProfile.HomeLocationY = (float) Convert.ToDecimal((string) requestData["home_pos_y"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -603,7 +605,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeLocationZ = (float)Convert.ToDecimal((string)requestData["home_pos_z"]); userProfile.HomeLocationZ = (float) Convert.ToDecimal((string) requestData["home_pos_z"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -614,7 +616,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeLookAtX = (float)Convert.ToDecimal((string)requestData["home_look_x"]); userProfile.HomeLookAtX = (float) Convert.ToDecimal((string) requestData["home_look_x"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -625,7 +627,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeLookAtY = (float)Convert.ToDecimal((string)requestData["home_look_y"]); userProfile.HomeLookAtY = (float) Convert.ToDecimal((string) requestData["home_look_y"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -636,7 +638,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.HomeLookAtZ = (float)Convert.ToDecimal((string)requestData["home_look_z"]); userProfile.HomeLookAtZ = (float) Convert.ToDecimal((string) requestData["home_look_z"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -647,7 +649,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]); userProfile.UserFlags = Convert.ToInt32((string) requestData["user_flags"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -658,7 +660,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]); userProfile.GodLevel = Convert.ToInt32((string) requestData["god_level"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -669,7 +671,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.CustomType = (string)requestData["custom_type"]; userProfile.CustomType = (string) requestData["custom_type"];
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -680,7 +682,7 @@ namespace OpenSim.Grid.UserServer
{ {
try try
{ {
userProfile.Partner = new LLUUID((string)requestData["partner"]); userProfile.Partner = new LLUUID((string) requestData["partner"]);
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -689,7 +691,7 @@ namespace OpenSim.Grid.UserServer
} }
else else
{ {
userProfile.Partner = LLUUID.Zero; userProfile.Partner = LLUUID.Zero;
} }
// call plugin! // call plugin!
@ -702,18 +704,18 @@ namespace OpenSim.Grid.UserServer
public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request) public XmlRpcResponse XmlRPCLogOffUserMethodUUID(XmlRpcRequest request)
{ {
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();
Hashtable requestData = (Hashtable)request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
if (requestData.Contains("avatar_uuid")) if (requestData.Contains("avatar_uuid"))
{ {
try try
{ {
LLUUID userUUID = new LLUUID((string)requestData["avatar_uuid"]); LLUUID userUUID = new LLUUID((string) requestData["avatar_uuid"]);
LLUUID RegionID = new LLUUID((string)requestData["region_uuid"]); LLUUID RegionID = new LLUUID((string) requestData["region_uuid"]);
ulong regionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); ulong regionhandle = (ulong) Convert.ToInt64((string) requestData["region_handle"]);
float posx = (float)Convert.ToDecimal((string)requestData["region_pos_x"]); float posx = (float) Convert.ToDecimal((string) requestData["region_pos_x"]);
float posy = (float)Convert.ToDecimal((string)requestData["region_pos_y"]); float posy = (float) Convert.ToDecimal((string) requestData["region_pos_y"]);
float posz = (float)Convert.ToDecimal((string)requestData["region_pos_z"]); float posz = (float) Convert.ToDecimal((string) requestData["region_pos_z"]);
handlerLogOffUser = OnLogOffUser; handlerLogOffUser = OnLogOffUser;
if (handlerLogOffUser != null) if (handlerLogOffUser != null)