From 13c1c33ed410566fa341c5affcb93f540f1df95f Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Mon, 24 Sep 2007 04:49:05 +0000 Subject: * Added TryGetAvatarByName --- OpenSim/Framework/UserManager/LoginService.cs | 9 +++------ OpenSim/Region/Environment/Scenes/Scene.cs | 20 ++++++++++++++++++++ OpenSim/Region/Environment/Scenes/SceneManager.cs | 14 ++++++++++++++ 3 files changed, 37 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/UserManager/LoginService.cs b/OpenSim/Framework/UserManager/LoginService.cs index 483665e..8e7cf80 100644 --- a/OpenSim/Framework/UserManager/LoginService.cs +++ b/OpenSim/Framework/UserManager/LoginService.cs @@ -44,18 +44,15 @@ namespace OpenSim.Framework.UserManagement bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && requestData.Contains("passwd")); bool GoodLogin = false; - string firstname = ""; - string lastname = ""; - string passwd = ""; UserProfileData userProfile; LoginResponse logResponse = new LoginResponse(); if (GoodXML) { - firstname = (string)requestData["first"]; - lastname = (string)requestData["last"]; - passwd = (string)requestData["passwd"]; + string firstname = (string)requestData["first"]; + string lastname = (string)requestData["last"]; + string passwd = (string)requestData["passwd"]; userProfile = GetTheUser(firstname, lastname); if (userProfile == null) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 97a4ae1..cff832e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -1363,5 +1363,25 @@ namespace OpenSim.Region.Environment.Scenes base.Close(); } + + internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) + { + foreach( ScenePresence presence in m_scenePresences.Values ) + { + if( !presence.IsChildAgent ) + { + string name = presence.ControllingClient.FirstName + " " + presence.ControllingClient.LastName; + + if( String.Compare( avatarName, name, true ) == 0 ) + { + avatar = presence; + return true; + } + } + } + + avatar = null; + return false; + } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 79fdff7..196976c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -233,5 +233,19 @@ namespace OpenSim.Region.Environment.Scenes m_localScenes.Remove(scene); scene.Close(); } + + public bool TryGetAvatarByName(string avatarName, out ScenePresence avatar) + { + foreach (Scene scene in m_localScenes) + { + if (scene.TryGetAvatarByName(avatarName, out avatar)) + { + return true; + } + } + + avatar = null; + return false; + } } } \ No newline at end of file -- cgit v1.1