diff options
author | Dr Scofield | 2009-04-29 09:35:35 +0000 |
---|---|---|
committer | Dr Scofield | 2009-04-29 09:35:35 +0000 |
commit | d0753ad9ef8ac937a4cb6340775de929b079f5db (patch) | |
tree | 22ae02f4895d74a75b06dab4532e02209aa69f2a | |
parent | From: Alan Webb <alan_webb@us.ibm.com> & Dr Scofield <drscofield@xyzzyxyzzy.net> (diff) | |
download | opensim-SC_OLD-d0753ad9ef8ac937a4cb6340775de929b079f5db.zip opensim-SC_OLD-d0753ad9ef8ac937a4cb6340775de929b079f5db.tar.gz opensim-SC_OLD-d0753ad9ef8ac937a4cb6340775de929b079f5db.tar.bz2 opensim-SC_OLD-d0753ad9ef8ac937a4cb6340775de929b079f5db.tar.xz |
From: Alan Webb <alan_webb@us.ibm.com>
Added two new (optional) attributes to create_user and update_user
requests.
<gender> - can be 'm' or 'f'. 'm' is default if not specified.
<model> - specifies another, existing, avatar that should be used
as an appearance prototype for this user.
If <model> is specified, then <gender> is ignored. If <model> is not
specified, then 'm' implies a model avatar of "Default Male", and 'f'
implies a default of "Default Female".
At the moment the inventory is not copied. This change means that an
avatar will only look like ruth if none of the possible models exist
in the user database.
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 76 |
1 files changed, 67 insertions, 9 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index b72ef04..ecdbb52 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -948,6 +948,32 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
948 | throw new Exception(String.Format("failed to create new user {0} {1}", | 948 | throw new Exception(String.Format("failed to create new user {0} {1}", |
949 | firstname, lastname)); | 949 | firstname, lastname)); |
950 | 950 | ||
951 | // User has been created. Now establish gender and appearance. | ||
952 | // Default appearance is 'Default Male'. Specifying gender can | ||
953 | // establish "Default Female". Specifying a specific model can | ||
954 | // establish a specific appearance without regard for gender. | ||
955 | |||
956 | try | ||
957 | { | ||
958 | string model = "Default Male"; | ||
959 | if (requestData.Contains("gender")) | ||
960 | if ((string)requestData["gender"] == "f") | ||
961 | model = "Default Female"; | ||
962 | |||
963 | if (requestData.Contains("model")) | ||
964 | model = (string)requestData["model"]; | ||
965 | |||
966 | string[] uname = model.Split(); | ||
967 | UserProfileData udata = m_app.CommunicationsManager.UserService.GetUserProfile(uname[0],uname[1]); | ||
968 | AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(udata.ID); | ||
969 | m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(userID, ava); | ||
970 | |||
971 | } | ||
972 | catch (Exception e) | ||
973 | { | ||
974 | m_log.ErrorFormat("[RADMIN] Error establishing initial appearance : {0}", e.Message); | ||
975 | } | ||
976 | |||
951 | responseData["success"] = "true"; | 977 | responseData["success"] = "true"; |
952 | responseData["avatar_uuid"] = userID.ToString(); | 978 | responseData["avatar_uuid"] = userID.ToString(); |
953 | 979 | ||
@@ -1170,6 +1196,38 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1170 | if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; | 1196 | if (String.Empty != aboutFirstLive) userProfile.FirstLifeAboutText = aboutFirstLive; |
1171 | if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; | 1197 | if (String.Empty != aboutAvatar) userProfile.AboutText = aboutAvatar; |
1172 | 1198 | ||
1199 | // User has been created. Now establish gender and appearance. | ||
1200 | // Default appearance is 'Default Male'. Specifying gender can | ||
1201 | // establish "Default Female". Specifying a specific model can | ||
1202 | // establish a specific appearance without regard for gender. | ||
1203 | |||
1204 | try | ||
1205 | { | ||
1206 | string model = "*none*"; | ||
1207 | if (requestData.Contains("gender")) | ||
1208 | { | ||
1209 | if ((string)requestData["gender"] == "f") | ||
1210 | model = "Default Female"; | ||
1211 | else | ||
1212 | model = "Default Male"; | ||
1213 | } | ||
1214 | |||
1215 | if (requestData.Contains("model")) | ||
1216 | model = (string)requestData["model"]; | ||
1217 | |||
1218 | if (model != "*none*") | ||
1219 | { | ||
1220 | string[] uname = model.Split(); | ||
1221 | UserProfileData udata = m_app.CommunicationsManager.UserService.GetUserProfile(uname[0],uname[1]); | ||
1222 | AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(udata.ID); | ||
1223 | m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(userProfile.ID, ava); | ||
1224 | } | ||
1225 | } | ||
1226 | catch (Exception e) | ||
1227 | { | ||
1228 | m_log.ErrorFormat("[RADMIN] Error establishing initial appearance : {0}", e.Message); | ||
1229 | } | ||
1230 | |||
1173 | if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) | 1231 | if (!m_app.CommunicationsManager.UserService.UpdateUserProfile(userProfile)) |
1174 | throw new Exception("did not manage to update user profile"); | 1232 | throw new Exception("did not manage to update user profile"); |
1175 | 1233 | ||
@@ -1744,21 +1802,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1744 | 1802 | ||
1745 | int addk = 0; | 1803 | int addk = 0; |
1746 | 1804 | ||
1747 | if(requestData.Contains("users")) | 1805 | if (requestData.Contains("users")) |
1748 | { | 1806 | { |
1749 | UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | 1807 | UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; |
1750 | Scene s = m_app.SceneManager.CurrentScene; | 1808 | Scene s = m_app.SceneManager.CurrentScene; |
1751 | Hashtable users = (Hashtable) requestData["users"]; | 1809 | Hashtable users = (Hashtable) requestData["users"]; |
1752 | List<UUID> uuids = new List<UUID>(); | 1810 | List<UUID> uuids = new List<UUID>(); |
1753 | foreach(string name in users.Values) | 1811 | foreach (string name in users.Values) |
1754 | { | 1812 | { |
1755 | string[] parts = name.Split(); | 1813 | string[] parts = name.Split(); |
1756 | uuids.Add(ups.GetUserDetails(parts[0],parts[1]).UserProfile.ID); | 1814 | uuids.Add(ups.GetUserDetails(parts[0],parts[1]).UserProfile.ID); |
1757 | } | 1815 | } |
1758 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); | 1816 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); |
1759 | foreach(UUID uuid in uuids) | 1817 | foreach (UUID uuid in uuids) |
1760 | { | 1818 | { |
1761 | if(!acl.Contains(uuid)) | 1819 | if (!acl.Contains(uuid)) |
1762 | { | 1820 | { |
1763 | acl.Add(uuid); | 1821 | acl.Add(uuid); |
1764 | addk++; | 1822 | addk++; |
@@ -1823,21 +1881,21 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1823 | 1881 | ||
1824 | int remk = 0; | 1882 | int remk = 0; |
1825 | 1883 | ||
1826 | if(requestData.Contains("users")) | 1884 | if (requestData.Contains("users")) |
1827 | { | 1885 | { |
1828 | UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; | 1886 | UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService; |
1829 | Scene s = m_app.SceneManager.CurrentScene; | 1887 | Scene s = m_app.SceneManager.CurrentScene; |
1830 | Hashtable users = (Hashtable) requestData["users"]; | 1888 | Hashtable users = (Hashtable) requestData["users"]; |
1831 | List<UUID> uuids = new List<UUID>(); | 1889 | List<UUID> uuids = new List<UUID>(); |
1832 | foreach(string name in users.Values) | 1890 | foreach (string name in users.Values) |
1833 | { | 1891 | { |
1834 | string[] parts = name.Split(); | 1892 | string[] parts = name.Split(); |
1835 | uuids.Add(ups.GetUserDetails(parts[0],parts[1]).UserProfile.ID); | 1893 | uuids.Add(ups.GetUserDetails(parts[0],parts[1]).UserProfile.ID); |
1836 | } | 1894 | } |
1837 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); | 1895 | List<UUID> acl = new List<UUID>(s.RegionInfo.EstateSettings.EstateAccess); |
1838 | foreach(UUID uuid in uuids) | 1896 | foreach (UUID uuid in uuids) |
1839 | { | 1897 | { |
1840 | if(acl.Contains(uuid)) | 1898 | if (acl.Contains(uuid)) |
1841 | { | 1899 | { |
1842 | acl.Remove(uuid); | 1900 | acl.Remove(uuid); |
1843 | remk++; | 1901 | remk++; |
@@ -1905,7 +1963,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
1905 | UUID[] acl = s.RegionInfo.EstateSettings.EstateAccess; | 1963 | UUID[] acl = s.RegionInfo.EstateSettings.EstateAccess; |
1906 | Hashtable users = new Hashtable(); | 1964 | Hashtable users = new Hashtable(); |
1907 | 1965 | ||
1908 | foreach(UUID user in acl) | 1966 | foreach (UUID user in acl) |
1909 | { | 1967 | { |
1910 | users[user.ToString()] = | 1968 | users[user.ToString()] = |
1911 | m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(user).UserProfile.Name; | 1969 | m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(user).UserProfile.Name; |