本文整理汇总了C#中OpenSim.Services.Connectors.Hypergrid.UserAgentServiceConnector.GetUUID方法的典型用法代码示例。如果您正苦于以下问题:C# UserAgentServiceConnector.GetUUID方法的具体用法?C# UserAgentServiceConnector.GetUUID怎么用?C# UserAgentServiceConnector.GetUUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenSim.Services.Connectors.Hypergrid.UserAgentServiceConnector
的用法示例。
在下文中一共展示了UserAgentServiceConnector.GetUUID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: osAvatarName2Key
public string osAvatarName2Key(string firstname, string lastname)
{
CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
m_host.AddScriptLPS(1);
if (lastname.Contains("@"))
{
String realFirstName; String realLastName; String serverURI;
realFirstName = firstname.Split('.')[0];
realLastName = firstname.Split('.')[1];
serverURI = new Uri("http://" + lastname.Replace("@", "")).ToString();
try
{
UserAgentServiceConnector userConnection = new UserAgentServiceConnector(serverURI, true);
if (userConnection != null)
{
UUID ruserid = userConnection.GetUUID(realFirstName, realLastName);
if (ruserid != null)
{
IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface<IUserManagement>();
if (userManager != null)
{
//Use the HomeURI from the script to get user infos and then ask the remote gridserver for the real HomeURI.
userManager.AddUser(ruserid, realFirstName, realLastName, serverURI);
serverURI = userManager.GetUserServerURL(ruserid, "HomeURI");
userManager.AddUser(ruserid, realFirstName, realLastName, serverURI);
return ruserid.ToString();
}
}
}
}
catch (Exception osAvatarException)
{
//m_log.Warn("[osAvatarName2Key] UserAgentServiceConnector - Unable to connect to destination grid\n" + osAvatarException.Message);
}
}
else
{
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
if (account != null) return account.PrincipalID.ToString();
}
return UUID.Zero.ToString();
}
示例2: osAvatarName2Key
public string osAvatarName2Key(string firstname, string lastname)
{
CheckThreatLevel(ThreatLevel.Low, "osAvatarName2Key");
m_host.AddScriptLPS(1);
IUserManagement userManager = World.RequestModuleInterface<IUserManagement>();
if (userManager == null)
{
OSSLShoutError("osAvatarName2Key: UserManagement module not available");
return string.Empty;
}
// Check if the user is already cached
UUID userID = userManager.GetUserIdByName(firstname, lastname);
if (userID != UUID.Zero)
return userID.ToString();
// Query for the user
String realFirstName; String realLastName; String serverURI;
if (Util.ParseForeignAvatarName(firstname, lastname, out realFirstName, out realLastName, out serverURI))
{
try
{
UserAgentServiceConnector userConnection = new UserAgentServiceConnector(serverURI, true);
if (userConnection != null)
{
userID = userConnection.GetUUID(realFirstName, realLastName);
if (userID != UUID.Zero)
{
userManager.AddUser(userID, realFirstName, realLastName, serverURI);
return userID.ToString();
}
}
}
catch (Exception /*e*/)
{
// m_log.Warn("[osAvatarName2Key] UserAgentServiceConnector - Unable to connect to destination grid ", e);
}
}
else
{
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, firstname, lastname);
if (account != null)
return account.PrincipalID.ToString();
}
return UUID.Zero.ToString();
}
示例3: AddAdditionalUsers
protected override void AddAdditionalUsers(UUID avatarID, string query, List<UserData> users)
{
if (query.Contains("@")) // [email protected], maybe?
{
string[] words = query.Split(new char[] { '@' });
if (words.Length != 2)
{
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", query);
return;
}
words[0] = words[0].Trim(); // it has at least 1
words[1] = words[1].Trim();
if (words[0] == String.Empty) // query was @foo.com?
{
foreach (UserData d in m_UserCache.Values)
{
if (d.LastName.ToLower().StartsWith("@" + words[1].ToLower()))
users.Add(d);
}
// We're done
return;
}
// words.Length == 2 and words[0] != string.empty
// [email protected] ?
foreach (UserData d in m_UserCache.Values)
{
if (d.LastName.StartsWith("@") &&
d.FirstName.ToLower().Equals(words[0].ToLower()) &&
d.LastName.ToLower().Equals("@" + words[1].ToLower()))
{
users.Add(d);
// It's cached. We're done
return;
}
}
// This is it! Let's ask the other world
if (words[0].Contains("."))
{
string[] names = words[0].Split(new char[] { '.' });
if (names.Length >= 2)
{
string uriStr = "http://" + words[1];
// Let's check that the last name is a valid address
try
{
new Uri(uriStr);
}
catch (UriFormatException)
{
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr);
return;
}
UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
UUID userID = uasConn.GetUUID(names[0], names[1]);
if (!userID.Equals(UUID.Zero))
{
UserData ud = new UserData();
ud.Id = userID;
ud.FirstName = words[0];
ud.LastName = "@" + words[1];
users.Add(ud);
AddUser(userID, names[0], names[1], uriStr);
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
}
else
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]);
}
}
}
//else
//{
// foreach (UserData d in m_UserCache.Values)
// {
// if (d.LastName.StartsWith("@") &&
// (d.FirstName.ToLower().StartsWith(query.ToLower()) ||
// d.LastName.ToLower().StartsWith(query.ToLower())))
// users.Add(d);
// }
//}
}