aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
diff options
context:
space:
mode:
authorMelanie2011-12-08 03:24:25 +0000
committerMelanie2011-12-08 03:24:25 +0000
commit50aa89dae66246395e9aac4d7d31f010e55473e8 (patch)
treeb2d23662cc5a51e13f582728bf7064077f9edc32 /OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
parentFix intersim object give messages (diff)
parentRemove unused SceneManager.TryGetAvatarsScene() (diff)
downloadopensim-SC-50aa89dae66246395e9aac4d7d31f010e55473e8.zip
opensim-SC-50aa89dae66246395e9aac4d7d31f010e55473e8.tar.gz
opensim-SC-50aa89dae66246395e9aac4d7d31f010e55473e8.tar.bz2
opensim-SC-50aa89dae66246395e9aac4d7d31f010e55473e8.tar.xz
Merge commit 'eda770e978c09c756d15ba62dbbf6ee34a61b2f5' into bigmerge
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs113
1 files changed, 113 insertions, 0 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 468eeb4..256a971 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -135,16 +135,22 @@ namespace OpenSim.ApplicationPlugins.RemoteController
135 availableMethods["admin_restart"] = XmlRpcRestartMethod; 135 availableMethods["admin_restart"] = XmlRpcRestartMethod;
136 availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; 136 availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
137 availableMethods["admin_save_heightmap"] = XmlRpcSaveHeightmapMethod; 137 availableMethods["admin_save_heightmap"] = XmlRpcSaveHeightmapMethod;
138
139 // Agent management
140 availableMethods["admin_teleport_agent"] = XmlRpcTeleportAgentMethod;
141
138 // User management 142 // User management
139 availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; 143 availableMethods["admin_create_user"] = XmlRpcCreateUserMethod;
140 availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod; 144 availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod;
141 availableMethods["admin_exists_user"] = XmlRpcUserExistsMethod; 145 availableMethods["admin_exists_user"] = XmlRpcUserExistsMethod;
142 availableMethods["admin_update_user"] = XmlRpcUpdateUserAccountMethod; 146 availableMethods["admin_update_user"] = XmlRpcUpdateUserAccountMethod;
147
143 // Region state management 148 // Region state management
144 availableMethods["admin_load_xml"] = XmlRpcLoadXMLMethod; 149 availableMethods["admin_load_xml"] = XmlRpcLoadXMLMethod;
145 availableMethods["admin_save_xml"] = XmlRpcSaveXMLMethod; 150 availableMethods["admin_save_xml"] = XmlRpcSaveXMLMethod;
146 availableMethods["admin_load_oar"] = XmlRpcLoadOARMethod; 151 availableMethods["admin_load_oar"] = XmlRpcLoadOARMethod;
147 availableMethods["admin_save_oar"] = XmlRpcSaveOARMethod; 152 availableMethods["admin_save_oar"] = XmlRpcSaveOARMethod;
153
148 // Estate access list management 154 // Estate access list management
149 availableMethods["admin_acl_clear"] = XmlRpcAccessListClear; 155 availableMethods["admin_acl_clear"] = XmlRpcAccessListClear;
150 availableMethods["admin_acl_add"] = XmlRpcAccessListAdd; 156 availableMethods["admin_acl_add"] = XmlRpcAccessListAdd;
@@ -3073,6 +3079,112 @@ namespace OpenSim.ApplicationPlugins.RemoteController
3073 return response; 3079 return response;
3074 } 3080 }
3075 3081
3082 public XmlRpcResponse XmlRpcTeleportAgentMethod(XmlRpcRequest request, IPEndPoint remoteClient)
3083 {
3084 XmlRpcResponse response = new XmlRpcResponse();
3085 Hashtable responseData = new Hashtable();
3086
3087 try
3088 {
3089 responseData["success"] = true;
3090
3091 Hashtable requestData = (Hashtable)request.Params[0];
3092
3093 CheckStringParameters(request, new string[] {"password"});
3094
3095 FailIfRemoteAdminNotAllowed((string)requestData["password"], remoteClient.Address.ToString());
3096
3097 UUID agentId;
3098 string regionName = null;
3099 Vector3 pos, lookAt;
3100 bool agentSpecified = false;
3101 ScenePresence sp = null;
3102
3103 if (requestData.Contains("agent_first_name") && requestData.Contains("agent_last_name"))
3104 {
3105 string firstName = requestData["agent_first_name"].ToString();
3106 string lastName = requestData["agent_last_name"].ToString();
3107 m_application.SceneManager.TryGetRootScenePresenceByName(firstName, lastName, out sp);
3108
3109 if (sp == null)
3110 throw new Exception(
3111 string.Format(
3112 "No agent found with agent_first_name {0} and agent_last_name {1}", firstName, lastName));
3113 }
3114 else if (requestData.Contains("agent_id"))
3115 {
3116 string rawAgentId = (string)requestData["agent_id"];
3117
3118 if (!UUID.TryParse(rawAgentId, out agentId))
3119 throw new Exception(string.Format("agent_id {0} does not have the correct id format", rawAgentId));
3120
3121 m_application.SceneManager.TryGetRootScenePresence(agentId, out sp);
3122
3123 if (sp == null)
3124 throw new Exception(string.Format("No agent with agent_id {0} found in this simulator", agentId));
3125 }
3126 else
3127 {
3128 throw new Exception("No agent_id or agent_first_name and agent_last_name parameters specified");
3129 }
3130
3131 if (requestData.Contains("region_name"))
3132 regionName = (string)requestData["region_name"];
3133
3134 pos.X = ParseFloat(requestData, "pos_x", sp.AbsolutePosition.X);
3135 pos.Y = ParseFloat(requestData, "pos_y", sp.AbsolutePosition.Y);
3136 pos.Z = ParseFloat(requestData, "pos_z", sp.AbsolutePosition.Z);
3137 lookAt.X = ParseFloat(requestData, "lookat_x", sp.Lookat.X);
3138 lookAt.Y = ParseFloat(requestData, "lookat_y", sp.Lookat.Y);
3139 lookAt.Z = ParseFloat(requestData, "lookat_z", sp.Lookat.Z);
3140
3141 sp.Scene.RequestTeleportLocation(
3142 sp.ControllingClient, regionName, pos, lookAt, (uint)Constants.TeleportFlags.ViaLocation);
3143 }
3144 catch (Exception e)
3145 {
3146 m_log.ErrorFormat("[RADMIN]: admin_teleport_agent exception: {0}{1}", e.Message, e.StackTrace);
3147
3148 responseData["success"] = false;
3149 responseData["error"] = e.Message;
3150 }
3151 finally
3152 {
3153 response.Value = responseData;
3154 }
3155
3156 return response;
3157 }
3158
3159 /// <summary>
3160 /// Parse a float with the given parameter name from a request data hash table.
3161 /// </summary>
3162 /// <remarks>
3163 /// Will throw an exception if parameter is not a float.
3164 /// Will not throw if parameter is not found, passes back default value instead.
3165 /// </remarks>
3166 /// <param name="requestData"></param>
3167 /// <param name="paramName"></param>
3168 /// <param name="defaultVal"></param>
3169 /// <returns></returns>
3170 private static float ParseFloat(Hashtable requestData, string paramName, float defaultVal)
3171 {
3172 if (requestData.Contains(paramName))
3173 {
3174 string rawVal = (string)requestData[paramName];
3175 float val;
3176
3177 if (!float.TryParse(rawVal, out val))
3178 throw new Exception(string.Format("{0} {1} is not a valid float", paramName, rawVal));
3179 else
3180 return val;
3181 }
3182 else
3183 {
3184 return defaultVal;
3185 }
3186 }
3187
3076 private static void CheckStringParameters(XmlRpcRequest request, string[] param) 3188 private static void CheckStringParameters(XmlRpcRequest request, string[] param)
3077 { 3189 {
3078 Hashtable requestData = (Hashtable) request.Params[0]; 3190 Hashtable requestData = (Hashtable) request.Params[0];
@@ -3252,6 +3364,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
3252 return false; 3364 return false;
3253 } 3365 }
3254 } 3366 }
3367
3255 private bool LoadHeightmap(string file, UUID regionID) 3368 private bool LoadHeightmap(string file, UUID regionID)
3256 { 3369 {
3257 m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file); 3370 m_log.InfoFormat("[RADMIN]: Terrain Loading: {0}", file);