From fc6fe75268d611fe1f4f87e698ae3df8e152c983 Mon Sep 17 00:00:00 2001 From: Cinder Date: Sun, 16 Aug 2015 14:54:15 -0600 Subject: [PATCH 1/2] MANTIS-7684 - Use the user management module to get username for script dialogs Signed-off-by: Diva Canto --- .../CoreModules/Avatar/Dialog/DialogModule.cs | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index d26907b322..4b41867e60 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -133,13 +133,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog UUID objectID, UUID ownerID, string message, UUID textureID, int ch, string[] buttonlabels) { - UserAccount account = m_scene.UserAccountService.GetUserAccount( - m_scene.RegionInfo.ScopeID, ownerID); + string username = m_scene.UserManagementModule.GetUserName(ownerID); string ownerFirstName, ownerLastName; - if (account != null) + if (!String.IsNullOrEmpty(username)) { - ownerFirstName = account.FirstName; - ownerLastName = account.LastName; + ownerFirstName = username.Split(' ')[0]; + ownerLastName = username.Split(' ')[1]; } else { @@ -170,17 +169,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog } public void SendTextBoxToUser(UUID avatarid, string message, - int chatChannel, string name, UUID objectid, UUID ownerid) + int chatChannel, string name, UUID objectid, UUID ownerID) { - UserAccount account = m_scene.UserAccountService.GetUserAccount( - m_scene.RegionInfo.ScopeID, ownerid); + string username = m_scene.UserManagementModule.GetUserName(ownerID); string ownerFirstName, ownerLastName; - UUID ownerID = UUID.Zero; - if (account != null) + if (!String.IsNullOrEmpty(username)) { - ownerFirstName = account.FirstName; - ownerLastName = account.LastName; - ownerID = account.PrincipalID; + ownerFirstName = username.Split(' ')[0]; + ownerLastName = username.Split(' ')[1]; } else { From 0cdd1165c80c6542927a8470e44346ee0e524085 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 16 Aug 2015 21:23:41 -0700 Subject: [PATCH 2/2] Minor improvement of previous patch. --- .../CoreModules/Avatar/Dialog/DialogModule.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 4b41867e60..a8968979e4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -134,11 +134,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog int ch, string[] buttonlabels) { string username = m_scene.UserManagementModule.GetUserName(ownerID); - string ownerFirstName, ownerLastName; + string ownerFirstName, ownerLastName = String.Empty; if (!String.IsNullOrEmpty(username)) { - ownerFirstName = username.Split(' ')[0]; - ownerLastName = username.Split(' ')[1]; + string[] parts = username.Split(' '); + ownerFirstName = parts[0]; + if (parts.Length > 1) + ownerLastName = username.Split(' ')[1]; } else { @@ -172,11 +174,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog int chatChannel, string name, UUID objectid, UUID ownerID) { string username = m_scene.UserManagementModule.GetUserName(ownerID); - string ownerFirstName, ownerLastName; + string ownerFirstName, ownerLastName = String.Empty; if (!String.IsNullOrEmpty(username)) { - ownerFirstName = username.Split(' ')[0]; - ownerLastName = username.Split(' ')[1]; + string[] parts = username.Split(' '); + ownerFirstName = parts[0]; + if (parts.Length > 1) + ownerLastName = username.Split(' ')[1]; } else {