* More cleanup, including UserManager.
parent
50a62145ad
commit
d0397af998
|
@ -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)
|
||||
{
|
||||
|
@ -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 =
|
||||
|
@ -208,7 +215,9 @@ 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}]}}",
|
||||
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,
|
||||
|
@ -300,8 +309,11 @@ 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,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -404,8 +417,12 @@ 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,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -192,11 +191,12 @@ namespace OpenSim.Grid.UserServer
|
|||
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);
|
||||
|
@ -213,7 +213,6 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
returnstring = "TRUE";
|
||||
}
|
||||
|
||||
}
|
||||
responseData.Add("returnString", returnstring);
|
||||
response.Value = responseData;
|
||||
|
@ -228,10 +227,13 @@ namespace OpenSim.Grid.UserServer
|
|||
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;
|
||||
|
@ -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;
|
||||
|
@ -265,9 +268,12 @@ namespace OpenSim.Grid.UserServer
|
|||
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";
|
||||
}
|
||||
|
@ -286,7 +292,7 @@ namespace OpenSim.Grid.UserServer
|
|||
|
||||
if (requestData.Contains("ownerID"))
|
||||
{
|
||||
returndata = this.GetUserFriendList(new LLUUID((string)requestData["ownerID"]));
|
||||
returndata = GetUserFriendList(new LLUUID((string) requestData["ownerID"]));
|
||||
}
|
||||
|
||||
return FriendListItemListtoXmlRPCResponse(returndata);
|
||||
|
@ -296,8 +302,8 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
AvatarAppearance appearance = null;
|
||||
Hashtable responseData = null;
|
||||
AvatarAppearance appearance;
|
||||
Hashtable responseData;
|
||||
if (requestData.Contains("owner"))
|
||||
{
|
||||
appearance = GetUserAppearance(new LLUUID((string) requestData["owner"]));
|
||||
|
@ -327,7 +333,7 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
Hashtable responseData = null;
|
||||
Hashtable responseData;
|
||||
if (requestData.Contains("owner"))
|
||||
{
|
||||
AvatarAppearance appearance = new AvatarAppearance(requestData);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -423,7 +427,7 @@ namespace OpenSim.Grid.UserServer
|
|||
//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);
|
||||
|
||||
|
@ -472,8 +476,8 @@ namespace OpenSim.Grid.UserServer
|
|||
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);
|
||||
if (guess_aid == LLUUID.Zero)
|
||||
|
@ -486,7 +490,8 @@ namespace OpenSim.Grid.UserServer
|
|||
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";
|
||||
}
|
||||
|
@ -510,14 +515,13 @@ namespace OpenSim.Grid.UserServer
|
|||
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);
|
||||
UserProfileData userProfile = GetUserProfile(UserUUID);
|
||||
if (null == userProfile)
|
||||
{
|
||||
return CreateUnknownUserErrorResponse();
|
||||
|
@ -568,11 +572,10 @@ 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 regionID;
|
||||
LLUUID.TryParse((string) requestData["home_region_id"], out regionID);
|
||||
userProfile.HomeRegionID = regionID;
|
||||
}
|
||||
|
@ -586,7 +589,6 @@ namespace OpenSim.Grid.UserServer
|
|||
{
|
||||
m_log.Error("[PROFILE]:Failed to set home postion x");
|
||||
}
|
||||
|
||||
}
|
||||
if (requestData.Contains("home_pos_y"))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue