diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 198bd83290..1bf8c0550f 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -261,6 +261,24 @@ namespace OpenSim.Framework.Communications
return userProf.ID;
}
}
+
+ public UUID AddUser(string firstName, string lastName, string password, uint regX, uint regY, UUID SetUUID)
+ {
+ string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
+
+ m_userServiceAdmin.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY, SetUUID);
+ UserProfileData userProf = UserService.GetUserProfile(firstName, lastName);
+ if (userProf == null)
+ {
+ return UUID.Zero;
+ }
+ else
+ {
+ InterServiceInventoryService.CreateNewUserInventory(userProf.ID);
+ m_log.Info("[USERS]: Created new inventory set for " + firstName + " " + lastName);
+ return userProf.ID;
+ }
+ }
///
/// Reset a user password
diff --git a/OpenSim/Framework/Communications/IUserServiceAdmin.cs b/OpenSim/Framework/Communications/IUserServiceAdmin.cs
index 9d1ab9f917..169385f5fa 100644
--- a/OpenSim/Framework/Communications/IUserServiceAdmin.cs
+++ b/OpenSim/Framework/Communications/IUserServiceAdmin.cs
@@ -35,8 +35,11 @@ namespace OpenSim.Framework.Communications
/// Add a new user profile
///
///
- UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
-
+ UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
+
+ // Adds one for allowing setting of the UUID from modules.. SHOULD ONLY BE USED in very special circumstances!
+ UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID setUUID);
+
///
/// Reset a user password
///
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 46a9b67441..b7f9f5ad4c 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -545,10 +545,15 @@ namespace OpenSim.Framework.Communications
///
///
public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
+ {
+ return AddUserProfile(firstName, lastName, pass, regX, regY, UUID.Random());
+ }
+
+ public UUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY, UUID SetUUID)
{
UserProfileData user = new UserProfileData();
user.HomeLocation = new Vector3(128, 128, 100);
- user.ID = UUID.Random();
+ user.ID = SetUUID;
user.FirstName = firstName;
user.SurName = lastName;
user.PasswordHash = pass;
@@ -572,7 +577,7 @@ namespace OpenSim.Framework.Communications
return user.ID;
}
-
+
///
/// Reset a user password
///
diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
index 478fbb7d17..f0737a60a1 100644
--- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
+++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs
@@ -37,6 +37,7 @@ using System.Web;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
+using OpenMetaverse.Packets;
using log4net;
using Nini.Config;
@@ -94,6 +95,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
private string httpsCN = "";
private bool httpSSL = false;
private uint httpsslport = 0;
+ private bool GridMode = false;
#region IRegionModule Members
@@ -102,6 +104,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
bool enabled = false;
IConfig cfg = null;
IConfig httpcfg = null;
+ IConfig startupcfg = null;
try
{
cfg = config.Configs["OpenGridProtocol"];
@@ -118,6 +121,19 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
{
}
+ try
+ {
+ startupcfg = config.Configs["Startup"];
+ }
+ catch (NullReferenceException)
+ {
+
+ }
+
+ if (startupcfg != null)
+ {
+ GridMode = enabled = cfg.GetBoolean("gridmode", false);
+ }
if (cfg != null)
{
@@ -182,17 +198,18 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
// Of interest to this module potentially
//scene.EventManager.OnNewClient += OnNewClient;
//scene.EventManager.OnGridInstantMessageToFriendsModule += OnGridInstantMessage;
- //scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
+ // scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
//scene.EventManager.OnMakeChildAgent += MakeChildAgent;
//scene.EventManager.OnClientClosed += ClientLoggedOut;
}
-
+
public void PostInitialise()
{
}
public void Close()
{
+ //scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
}
public string Name
@@ -516,8 +533,21 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
userProfile.WebLoginKey = UUID.Random();
// Do caps registration
- // get seed cap
+ // get seed capagentData.firstname = FirstName;agentData.lastname = LastName;
+ if (homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID) == null && !GridMode)
+ {
+ homeScene.CommsManager.AddUser(agentData.firstname, agentData.lastname, CreateRandomStr(7), homeScene.RegionInfo.RegionLocX, homeScene.RegionInfo.RegionLocY, agentData.AgentID);
+ UserProfileData userProfile2 = homeScene.CommsManager.UserService.GetUserProfile(agentData.AgentID);
+ if (userProfile2 != null)
+ {
+ userProfile = userProfile2;
+ userProfile.AboutText = "OGP USER";
+ userProfile.FirstLifeAboutText = "OGP USER";
+ homeScene.CommsManager.UserService.UpdateUserProfile(userProfile);
+ }
+ }
+
// Stick our data in the cache so the region will know something about us
homeScene.CommsManager.UserProfileCacheService.PreloadUserCache(agentData.AgentID, userProfile);
@@ -576,6 +606,7 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
CapsLoginID.Add(rezAvatarPath, agentData);
}
}
+
//System.Console.WriteLine("Response:" + responseMap.ToString());
return responseMap;
}
@@ -733,6 +764,8 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
responseMap["connect"] = LLSD.FromBoolean(true);
+
+
m_log.InfoFormat("[OGP]: host: {0}, IP {1}", responseMap["sim_host"].ToString(), responseMap["sim_ip"].ToString());
}
}
@@ -1162,6 +1195,18 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
}
}
+ private string CreateRandomStr(int len)
+ {
+ Random rnd = new Random(System.Environment.TickCount);
+ string returnstring = "";
+ string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
+
+ for (int i = 0; i < len; i++)
+ {
+ returnstring += chars.Substring(rnd.Next(chars.Length), 1);
+ }
+ return returnstring;
+ }
// Temporary hack to allow teleporting to and from Vaak
private static bool customXertificateValidation(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{
@@ -1206,8 +1251,9 @@ namespace OpenSim.Region.Environment.Modules.InterGrid
}
}
}
+
}
-
+
public class MonoCert : ICertificatePolicy
{
#region ICertificatePolicy Members