Beispiel #1
0
        void onChatMessageReceive(string message, ChatAudibleLevel audible, ChatType type,
                                  ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position)
        {
            if ((message.Length != 0) && (message != null) && (message != String.Empty) && !(id == Self.AgentID))
            {
                Self.AutoPilotCancel();
                string[] sender = fromName.Split(' ');


                XmlRpcAgencyConnector.MethodName = "XmlRpcAgencyConnector.onChatMessageReceive";
                XmlRpcAgencyConnector.Params.Clear();
                XmlRpcAgencyConnector.Params.Add(agentName);
                XmlRpcAgencyConnector.Params.Add(message);
                XmlRpcAgencyConnector.Params.Add((int)position.X);
                XmlRpcAgencyConnector.Params.Add((int)position.Y);
                XmlRpcAgencyConnector.Params.Add((int)position.Z);
                XmlRpcAgencyConnector.Params.Add(sender[0]);
                XmlRpcAgencyConnector.Params.Add(sender[1]);

                try
                {
                        #if DEBUG
                    Console.WriteLine("Request: " + XmlRpcAgencyConnector);
                        #endif
                    XmlRpcResponse response = XmlRpcAgencyConnector.Send(XmlRpcAgencyConnectorUrl);
                        #if DEBUG
                    Console.WriteLine("Response: " + response);
                        #endif

                    if (response.IsFault)
                    {
                            #if DEBUG
                        Console.WriteLine("Fault {0}: {1}", response.FaultCode, response.FaultString);
                            #endif
                    }
                    else
                    {
                            #if DEBUG
                        Console.WriteLine("Returned: " + response.Value);
                            #endif
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception " + e);
                }
            }
        }
Beispiel #2
0
        public bool RequestClosestRegion(string gridServerURL, string sendKey, string receiveKey, string regionName, out RegionInfo regionInfo, out string errorMsg)
        {
            regionInfo = null;
            errorMsg   = string.Empty;
            try
            {
                Hashtable requestData = new Hashtable();
                requestData["region_name_search"] = regionName;
                requestData["authkey"]            = sendKey;
                ArrayList SendParams = new ArrayList();
                SendParams.Add(requestData);
                XmlRpcRequest  GridReq  = new XmlRpcRequest("simulator_data_request", SendParams);
                XmlRpcResponse GridResp = GridReq.Send(gridServerURL, 3000);

                Hashtable responseData = (Hashtable)GridResp.Value;

                if (responseData.ContainsKey("error"))
                {
                    errorMsg = (string)responseData["error"];
                    return(false);
                }

                regionInfo = BuildRegionInfo(responseData, "");
            }
            catch (Exception e)
            {
                errorMsg = e.Message;
                return(false);
            }
            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
        /// </summary>
        /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks>
        /// <param name="minX">Minimum X value</param>
        /// <param name="minY">Minimum Y value</param>
        /// <param name="maxX">Maximum X value</param>
        /// <param name="maxY">Maximum Y value</param>
        /// <returns>Hashtable of hashtables containing map data elements</returns>
        public bool MapBlockQuery(string gridServerURL, int minX, int minY, int maxX, int maxY, out Hashtable respData, out string errorMsg)
        {
            respData = new Hashtable();
            errorMsg = string.Empty;

            Hashtable param = new Hashtable();

            param["xmin"] = minX;
            param["ymin"] = minY;
            param["xmax"] = maxX;
            param["ymax"] = maxY;
            IList parameters = new ArrayList();

            parameters.Add(param);

            try
            {
                XmlRpcRequest  req  = new XmlRpcRequest("map_block", parameters);
                XmlRpcResponse resp = req.Send(gridServerURL, 10000);
                respData = (Hashtable)resp.Value;
                return(true);
            }
            catch (Exception e)
            {
                errorMsg = e.Message;
                return(false);
            }
        }
        private void NotifyMessageServerOfShutdown(Scene scene)
        {
            Hashtable xmlrpcdata = new Hashtable();

            xmlrpcdata["RegionUUID"] = scene.RegionInfo.RegionID.ToString();
            ArrayList SendParams = new ArrayList();

            SendParams.Add(xmlrpcdata);
            try
            {
                string         methodName  = "region_shutdown";
                XmlRpcRequest  DownRequest = new XmlRpcRequest(methodName, SendParams);
                XmlRpcResponse resp        = DownRequest.Send(Util.XmlRpcRequestURI(scene.CommsManager.NetworkServersInfo.MessagingURL, methodName), 5000);

                Hashtable responseData = (Hashtable)resp.Value;
                if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
                {
                    m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName);
                }
            }
            catch (WebException)
            {
                m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of region shutdown for region {0}", scene.RegionInfo.RegionName);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
        /// </summary>
        /// <remarks>REDUNDANT - OGS1 is to be phased out in favour of OGS2</remarks>
        /// <param name="minX">Minimum X value</param>
        /// <param name="minY">Minimum Y value</param>
        /// <param name="maxX">Maximum X value</param>
        /// <param name="maxY">Maximum Y value</param>
        /// <returns>Hashtable of hashtables containing map data elements</returns>
        private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY)
        {
            Hashtable param = new Hashtable();

            param["xmin"] = minX;
            param["ymin"] = minY;
            param["xmax"] = maxX;
            param["ymax"] = maxY;
            IList parameters = new ArrayList();

            parameters.Add(param);

            try
            {
                XmlRpcRequest  req      = new XmlRpcRequest("map_block", parameters);
                XmlRpcResponse resp     = req.Send(serversInfo.GridURL, 10000);
                Hashtable      respData = (Hashtable)resp.Value;
                return(respData);
            }
            catch (Exception e)
            {
                m_log.Error("MapBlockQuery XMLRPC failure: " + e);
                return(new Hashtable());
            }
        }
Beispiel #6
0
        /// <summary>
        /// Request sim data based on arbitrary key/value
        /// </summary>
        private RegionProfileData RequestSimData(Uri gridserverUrl, string gridserverSendkey, string keyField, string keyValue)
        {
            Hashtable requestData = new Hashtable();

            requestData[keyField]  = keyValue;
            requestData["authkey"] = gridserverSendkey;
            ArrayList SendParams = new ArrayList();

            SendParams.Add(requestData);
            XmlRpcRequest  GridReq  = new XmlRpcRequest("simulator_data_request", SendParams);
            XmlRpcResponse GridResp = GridReq.Send(gridserverUrl.ToString(), 3000);

            Hashtable responseData = (Hashtable)GridResp.Value;

            RegionProfileData simData = null;

            if (!responseData.ContainsKey("error"))
            {
                uint   locX             = Convert.ToUInt32((string)responseData["region_locx"]);
                uint   locY             = Convert.ToUInt32((string)responseData["region_locy"]);
                string externalHostName = (string)responseData["sim_ip"];
                uint   simPort          = Convert.ToUInt32((string)responseData["sim_port"]);
                uint   httpPort         = Convert.ToUInt32((string)responseData["http_port"]);
                uint   remotingPort     = Convert.ToUInt32((string)responseData["remoting_port"]);
                string serverUri        = (string)responseData["server_uri"];
                UUID   regionID         = new UUID((string)responseData["region_UUID"]);
                string regionName       = (string)responseData["region_name"];
                byte   access           = Convert.ToByte((string)responseData["access"]);

                simData = RegionProfileData.Create(regionID, regionName, locX, locY, externalHostName, simPort, httpPort, remotingPort, serverUri, access);
            }

            return(simData);
        }
Beispiel #7
0
        public bool Login(int?timeout = null)
        {
            latestException = "";
            int userTimeout = timeout == null ? commonTimeout : (int)timeout;

            XmlRpcRequest client = new XmlRpcRequest();

            client.MethodName = "login";
            client.Params.Clear();
            client.Params.Add(this.dbName);
            client.Params.Add(this.userName);
            client.Params.Add(this.userPwd);
            int ui;

            try
            {
                XmlRpcResponse response = client.Send(this.Url + "/common", userTimeout);
                if (response.IsFault)
                {
                    latestException = response.Value.ToString();
                    return(false);
                }
                ui = (int)response.Value;
            }
            catch (Exception exc)
            {
                latestException = exc.Message;
                return(false);
            }

            this.userId = ui;
            return(true);
        }
		//
		// Make external XMLRPC request
		//
		private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method)
		{
			ArrayList SendParams = new ArrayList();
			SendParams.Add(ReqParams);

			// Send Request
			XmlRpcResponse Resp;
			try
			{
				XmlRpcRequest Req = new XmlRpcRequest(method, SendParams);
				Resp = Req.Send(m_ProfileServer, 30000);
			}

			catch (WebException ex)
			{
				m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile Server {0}.  Exception {1}", m_ProfileServer, ex);
				Hashtable ErrorHash = new Hashtable();
				ErrorHash["success"] = false;
				ErrorHash["errorMessage"] = "WEB Connecton Error.";
				ErrorHash["errorURI"] = "";

				return ErrorHash;
			}

			catch (SocketException ex)
			{
				m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. Exception {3}", 
															m_ProfileServer, method, ReqParams, ex);
				Hashtable ErrorHash = new Hashtable();
				ErrorHash["success"] = false;
				ErrorHash["errorMessage"] = "Network Socket Error.";
				ErrorHash["errorURI"] = "";

				return ErrorHash;
			}

			catch (XmlException ex)
			{
				m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. Exception {3}", 
															m_ProfileServer, method, ReqParams.ToString(), ex);
				Hashtable ErrorHash = new Hashtable();
				ErrorHash["success"] = false;
				ErrorHash["errorMessage"] = "XML Parse Error.";
				ErrorHash["errorURI"] = "";

				return ErrorHash;
			}

			if (Resp.IsFault)
			{
				Hashtable ErrorHash = new Hashtable();
				ErrorHash["success"] = false;
				ErrorHash["errorMessage"] = "Response Fault.";
				ErrorHash["errorURI"] = "";
				return ErrorHash;
			}
			Hashtable RespData = (Hashtable)Resp.Value;

			return RespData;
		}
Beispiel #9
0
        /// <summary>
        /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates
        /// </summary>
        /// <param name="minX">Minimum X value</param>
        /// <param name="minY">Minimum Y value</param>
        /// <param name="maxX">Maximum X value</param>
        /// <param name="maxY">Maximum Y value</param>
        /// <returns>Hashtable of hashtables containing map data elements</returns>
        private Hashtable MapBlockQuery(int minX, int minY, int maxX, int maxY)
        {
            Hashtable param = new Hashtable();

            param["xmin"] = minX;
            param["ymin"] = minY;
            param["xmax"] = maxX;
            param["ymax"] = maxY;
            IList parameters = new ArrayList();

            parameters.Add(param);

            try
            {
                string         methodName = "map_block";
                XmlRpcRequest  req        = new XmlRpcRequest(methodName, parameters);
                XmlRpcResponse resp       = req.Send(Util.XmlRpcRequestURI(serversInfo.GridURL, methodName), 10000);
                Hashtable      respData   = (Hashtable)resp.Value;
                if (respData != null && respData.Contains("faultCode"))
                {
                    m_log.ErrorFormat("[OGS1 GRID SERVICES]: Got an error while contacting GridServer: {0}", respData["faultString"]);
                    return(null);
                }

                return(respData);
            }
            catch (Exception e)
            {
                m_log.Error("MapBlockQuery XMLRPC failure: " + e);
                return(new Hashtable());
            }
        }
Beispiel #10
0
        public bool SearchRegionByName(string gridServerURL, IList parameters, out Hashtable respData, out string errorMsg)
        {
            respData = null;
            errorMsg = string.Empty;
            try
            {
                string         methodName = "search_for_region_by_name";
                XmlRpcRequest  request    = new XmlRpcRequest(methodName, parameters);
                XmlRpcResponse resp       = request.Send(Util.XmlRpcRequestURI(gridServerURL, methodName), 10000);

                respData = (Hashtable)resp.Value;
                if (respData != null && respData.Contains("faultCode"))
                {
                    errorMsg = (string)respData["faultString"];
                    return(false);
                }

                return(true);
            }
            catch (Exception e)
            {
                errorMsg = e.Message;
                return(false);
            }
        }
        /// <summary>
        /// This actually does the XMLRPC Request
        /// </summary>
        /// <param name="reginfo">RegionInfo we pull the data out of to send the request to</param>
        /// <param name="xmlrpcdata">The Instant Message data Hashtable</param>
        /// <returns>Bool if the message was successfully delivered at the other side.</returns>
        protected virtual bool doIMSending(GridRegion reginfo, Hashtable xmlrpcdata)
        {
            ArrayList SendParams = new ArrayList();

            SendParams.Add(xmlrpcdata);
            XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams);

            try
            {
                XmlRpcResponse GridResp     = GridReq.Send(reginfo.ServerURI, 3000);
                Hashtable      responseData = (Hashtable)GridResp.Value;
                if (responseData.ContainsKey("success"))
                {
                    if ((string)responseData["success"] == "TRUE")
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (WebException e)
            {
                m_log.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to {0} the host didn't respond " + e.ToString(), reginfo.ServerURI.ToString());
            }

            return(false);
        }
Beispiel #12
0
        private Hashtable CallDamageControlServer(string methodName)
        {
            UpdateCredentials();
            XmlRpcRequest client = new XmlRpcRequest();

            client.MethodName = methodName;
            client.Params.Add(this.name);

            //Console.WriteLine("Calling " + url);
            XmlRpcResponse response = client.Send(XmlRpcUrl);

            if (response.IsFault)
            {
                throw new Exception(response.FaultString);
            }
            if (response.Value == null)
            {
                throw new Exception(string.Format("Project '{0}' does not exist", this.name));
            }

            Hashtable ret = response.Value as Hashtable;

            if (ret == null)
            {
                throw new Exception("XMLRPC connection not compatible");
            }
            return(ret);
        }
Beispiel #13
0
        private void NotifyMessageServerOfAgentLeaving(UUID agentID, UUID region, ulong regionHandle)
        {
            Hashtable xmlrpcdata = new Hashtable();

            xmlrpcdata["AgentID"]      = agentID.ToString();
            xmlrpcdata["RegionUUID"]   = region.ToString();
            xmlrpcdata["RegionHandle"] = regionHandle.ToString();
            ArrayList SendParams = new ArrayList();

            SendParams.Add(xmlrpcdata);
            try
            {
                XmlRpcRequest  LeavingRequest = new XmlRpcRequest("agent_leaving", SendParams);
                XmlRpcResponse resp           = LeavingRequest.Send(m_Scenes[0].CommsManager.NetworkServersInfo.MessagingURL, 5000);

                Hashtable responseData = (Hashtable)resp.Value;
                if ((!responseData.ContainsKey("success")) || (string)responseData["success"] != "TRUE")
                {
                    m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of agent leaving for {0}", agentID.ToString());
                }
            }
            catch (WebException)
            {
                m_log.ErrorFormat("[PRESENCE]: Failed to notify message server of agent leaving for {0}", agentID.ToString());
            }
        }
Beispiel #14
0
        public static bool VerifySession(string authurl, UUID userID, UUID sessionID)
        {
            Hashtable requestData = new Hashtable();

            requestData["avatar_uuid"] = userID.ToString();
            requestData["session_id"]  = sessionID.ToString();
            ArrayList SendParams = new ArrayList();

            SendParams.Add(requestData);

            string        methodName = "check_auth_session";
            XmlRpcRequest UserReq    = new XmlRpcRequest(methodName, SendParams);

            try
            {
                XmlRpcResponse UserResp = UserReq.Send(Util.XmlRpcRequestURI(authurl, methodName), 10000);

                Hashtable responseData = (Hashtable)UserResp.Value;
                if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE")
                {
                    //System.Console.WriteLine("[Authorization]: userserver reported authorized session for user " + userID);
                    return(true);
                }
                else
                {
                    //System.Console.WriteLine("[Authorization]: userserver reported unauthorized session for user " + userID);
                    return(false);
                }
            }
            catch (System.Net.WebException)
            {
                return(false);
            }
        }
Beispiel #15
0
        private bool GetBoolResponse(XmlRpcRequest request, out string reason)
        {
            //m_log.Debug("[USER AGENT CONNECTOR]: GetBoolResponse from/to " + m_ServerURL);
            XmlRpcResponse response = null;

            try
            {
                response = request.Send(m_ServerURL, 10000);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetBoolResponse", m_ServerURL);
                reason = "Exception: " + e.Message;
                return(false);
            }

            if (response.IsFault)
            {
                m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetBoolResponse returned an error: {1}", m_ServerURL, response.FaultString);
                reason = "XMLRPC Fault";
                return(false);
            }

            Hashtable hash = (Hashtable)response.Value;

            //foreach (Object o in hash)
            //    m_log.Debug(">> " + ((DictionaryEntry)o).Key + ":" + ((DictionaryEntry)o).Value);
            try
            {
                if (hash == null)
                {
                    m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
                    reason = "Internal error 1";
                    return(false);
                }
                bool success = false;
                reason = string.Empty;
                if (hash.ContainsKey("result"))
                {
                    Boolean.TryParse((string)hash["result"], out success);
                }
                else
                {
                    reason = "Internal error 2";
                    m_log.WarnFormat("[USER AGENT CONNECTOR]: response from {0} does not have expected key 'result'", m_ServerURL);
                }

                return(success);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetBoolResponse response.");
                if (hash.ContainsKey("result") && hash["result"] != null)
                {
                    m_log.ErrorFormat("Reply was ", (string)hash["result"]);
                }
                reason = "Exception: " + e.Message;
                return(false);
            }
        }
Beispiel #16
0
        private Hashtable CallServer(string methodName, Hashtable hash)
        {
            IList paramList = new ArrayList();

            paramList.Add(hash);

            XmlRpcRequest request = new XmlRpcRequest(methodName, paramList);

            // Send and get reply
            XmlRpcResponse response = null;

            try
            {
                response = request.Send(m_ServerURL, 10000);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[USER AGENT CONNECTOR]: {0} call to {1} failed: {2}", methodName, m_ServerURL, e.Message);
                throw;
            }

            if (response.IsFault)
            {
                throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned an error: {2}", methodName, m_ServerURL, response.FaultString));
            }

            hash = (Hashtable)response.Value;

            if (hash == null)
            {
                throw new Exception(string.Format("[USER AGENT CONNECTOR]: {0} call to {1} returned null", methodName, m_ServerURL));
            }

            return(hash);
        }
Beispiel #17
0
        public static bool VerifySession(string authurl, UUID userID, UUID sessionID)
        {
            Hashtable requestData = new Hashtable();

            requestData["avatar_uuid"] = userID.ToString();
            requestData["session_id"]  = sessionID.ToString();
            ArrayList SendParams = new ArrayList();

            SendParams.Add(requestData);
            XmlRpcRequest  UserReq  = new XmlRpcRequest("check_auth_session", SendParams);
            XmlRpcResponse UserResp = null;

            try
            {
                UserResp = UserReq.Send(authurl, 3000);
            }
            catch (Exception e)
            {
                System.Console.WriteLine("[Session Auth]: VerifySession XmlRpc: " + e.Message);
                return(false);
            }

            Hashtable responseData = (Hashtable)UserResp.Value;

            if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE")
            {
                //System.Console.WriteLine("[Authorization]: userserver reported authorized session for user " + userID);
                return(true);
            }
            else
            {
                //System.Console.WriteLine("[Authorization]: userserver reported unauthorized session for user " + userID);
                return(false);
            }
        }
        /// <summary>
        /// Returns a list of FriendsListItems that describe the friends and permissions in the friend
        /// relationship for UUID friendslistowner. For faster lookup, we index by friend's UUID.
        /// </summary>
        /// <param name="friendlistowner">The agent that we're retreiving the friends Data for.</param>
        private Dictionary <UUID, FriendListItem> GetUserFriendListOld(UUID friendlistowner)
        {
            m_log.Warn("[FRIEND]: Calling Messaging/GetUserFriendListOld for " + friendlistowner.ToString());

            Dictionary <UUID, FriendListItem> buddies = new Dictionary <UUID, FriendListItem>();

            try
            {
                Hashtable param = new Hashtable();
                param["ownerID"] = friendlistowner.ToString();

                IList parameters = new ArrayList();
                parameters.Add(param);

                string         methodName = "get_user_friend_list";
                XmlRpcRequest  req        = new XmlRpcRequest(methodName, parameters);
                XmlRpcResponse resp       = req.Send(Util.XmlRpcRequestURI(m_cfg.UserServerURL, methodName), 3000);

                Hashtable respData = (Hashtable)resp.Value;

                if (respData.Contains("avcount"))
                {
                    buddies = ConvertXMLRPCDataToFriendListItemList(respData);
                }
            }
            catch (WebException e)
            {
                m_log.Warn("[FRIEND]: Error when trying to fetch Avatar's friends list: " +
                           e.Message);
                // Return Empty list (no friends)
            }
            return(buddies);
        }
Beispiel #19
0
        /// <summary>
        /// Logs off a user on the user server
        /// </summary>
        /// <param name="UserID">UUID of the user</param>
        /// <param name="regionID">UUID of the Region</param>
        /// <param name="regionhandle">regionhandle</param>
        /// <param name="position">final position</param>
        /// <param name="lookat">final lookat</param>
        public override void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat)
        {
            Hashtable param = new Hashtable();

            param["avatar_uuid"]   = userid.Guid.ToString();
            param["region_uuid"]   = regionid.Guid.ToString();
            param["region_handle"] = regionhandle.ToString();
            param["region_pos_x"]  = position.X.ToString();
            param["region_pos_y"]  = position.Y.ToString();
            param["region_pos_z"]  = position.Z.ToString();
            param["lookat_x"]      = lookat.X.ToString();
            param["lookat_y"]      = lookat.Y.ToString();
            param["lookat_z"]      = lookat.Z.ToString();

            IList parameters = new ArrayList();

            parameters.Add(param);
            XmlRpcRequest req = new XmlRpcRequest("logout_of_simulator", parameters);

            try
            {
                req.Send(GetUserServerURL(userid), 3000);
            }
            catch (WebException)
            {
                m_log.Warn("[LOGOFF]: Unable to notify grid server of user logoff");
            }
        }
Beispiel #20
0
        /// <summary>
        /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for UUID friendslistowner
        /// </summary>
        /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
        public virtual List <FriendListItem> GetUserFriendList(UUID friendlistowner)
        {
            List <FriendListItem> buddylist = new List <FriendListItem>();

            try
            {
                Hashtable param = new Hashtable();
                param["ownerID"] = friendlistowner.Guid.ToString();

                IList parameters = new ArrayList();
                parameters.Add(param);
                XmlRpcRequest  req      = new XmlRpcRequest("get_user_friend_list", parameters);
                XmlRpcResponse resp     = req.Send(m_commsManager.NetworkServersInfo.UserURL, 8000);
                Hashtable      respData = (Hashtable)resp.Value;

                if (respData != null && respData.Contains("avcount"))
                {
                    buddylist = ConvertXMLRPCDataToFriendListItemList(respData);
                }
            }
            catch (WebException e)
            {
                m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar's friends list: " +
                           e.Message);
                // Return Empty list (no friends)
            }
            return(buddylist);
        }
 public bool Connect(string GridServerURL, string username, string password)
 {
     try
     {
         this.ServerURL = GridServerURL;
         Hashtable LoginParamsHT = new Hashtable();
         LoginParamsHT["username"] = username;
         LoginParamsHT["password"] = password;
         ArrayList LoginParams = new ArrayList();
         LoginParams.Add(LoginParamsHT);
         XmlRpcRequest  GridLoginReq = new XmlRpcRequest("manager_login", LoginParams);
         XmlRpcResponse GridResp     = GridLoginReq.Send(ServerURL, 3000);
         if (GridResp.IsFault)
         {
             connected = false;
             return(false);
         }
         else
         {
             Hashtable gridrespData = (Hashtable)GridResp.Value;
             this.SessionID = new LLUUID((string)gridrespData["session_id"]);
             connected      = true;
             return(true);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         connected = false;
         return(false);
     }
 }
Beispiel #22
0
        public virtual List <AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query)
        {
            List <AvatarPickerAvatar> pickerlist = new List <AvatarPickerAvatar>();
            Regex objAlphaNumericPattern         = new Regex("[^a-zA-Z0-9 ]");

            try
            {
                Hashtable param = new Hashtable();
                param["queryid"] = (string)queryID.ToString();
                param["avquery"] = objAlphaNumericPattern.Replace(query, String.Empty);
                IList parameters = new ArrayList();
                parameters.Add(param);
                XmlRpcRequest  req      = new XmlRpcRequest("get_avatar_picker_avatar", parameters);
                XmlRpcResponse resp     = req.Send(m_commsManager.NetworkServersInfo.UserURL, 3000);
                Hashtable      respData = (Hashtable)resp.Value;
                pickerlist = ConvertXMLRPCDataToAvatarPickerList(queryID, respData);
            }
            catch (WebException e)
            {
                m_log.Warn("[OGS1 USER SERVICES]: Error when trying to fetch Avatar Picker Response: " +
                           e.Message);
                // Return Empty picker list (no results)
            }
            return(pickerlist);
        }
Beispiel #23
0
        /// <summary>
        /// Send a generic XMLRPC request but with encryption on the values
        /// </summary>
        /// <param name="ReqParams">Params to send</param>
        /// <param name="method"></param>
        /// <param name="URL">URL to post to</param>
        /// <param name="passPhrase">pass to remove the encryption</param>
        /// <param name="salt">Extra additional piece that is added to the password</param>
        /// <returns></returns>
        public static Hashtable GenericXMLRPCRequestEncrypted(Hashtable ReqParams, string method, string URL, string passPhrase, string salt)
        {
            Hashtable reqP = new Hashtable();

            //Encrypt the values
            foreach (KeyValuePair <string, object> kvp in ReqParams)
            {
                reqP.Add(kvp.Key, Encrypt(kvp.Value.ToString(), passPhrase, salt));
            }

            ArrayList SendParams = new ArrayList();

            SendParams.Add(reqP);

            // Send Request
            XmlRpcResponse Resp;

            try
            {
                XmlRpcRequest Req = new XmlRpcRequest(method, SendParams);
                Resp = Req.Send(URL, 30000);
            }
            catch (WebException)
            {
                Hashtable ErrorHash = new Hashtable();
                ErrorHash["success"] = "false";
                return(ErrorHash);
            }
            catch (SocketException)
            {
                Hashtable ErrorHash = new Hashtable();
                ErrorHash["success"] = "false";
                return(ErrorHash);
            }
            catch (XmlException)
            {
                Hashtable ErrorHash = new Hashtable();
                ErrorHash["success"] = "false";
                return(ErrorHash);
            }
            if (Resp.IsFault)
            {
                Hashtable ErrorHash = new Hashtable();
                ErrorHash["success"] = "false";
                return(ErrorHash);
            }
            Hashtable RespData = (Hashtable)Resp.Value;

            if (RespData != null)
            {
                RespData["success"] = "true";
                return(RespData);
            }
            else
            {
                RespData            = new Hashtable();
                RespData["success"] = "false";
                return(RespData);
            }
        }
 public bool ShutdownServer()
 {
     try
     {
         Hashtable ShutdownParamsHT = new Hashtable();
         ArrayList ShutdownParams   = new ArrayList();
         ShutdownParamsHT["session_id"] = this.SessionID.ToString();
         ShutdownParams.Add(ShutdownParamsHT);
         XmlRpcRequest  GridShutdownReq = new XmlRpcRequest("shutdown", ShutdownParams);
         XmlRpcResponse GridResp        = GridShutdownReq.Send(this.ServerURL, 3000);
         if (GridResp.IsFault)
         {
             return(false);
         }
         else
         {
             connected = false;
             return(true);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         return(false);
     }
 }
Beispiel #25
0
        public SimProfile LoadFromGrid(LLUUID UUID, string GridURL, string SendKey, string RecvKey)
        {
            try
            {
                Hashtable GridReqParams = new Hashtable();
                GridReqParams["UUID"]    = UUID.ToString();
                GridReqParams["authkey"] = SendKey;
                ArrayList SendParams = new ArrayList();
                SendParams.Add(GridReqParams);
                XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);

                XmlRpcResponse GridResp = GridReq.Send(GridURL, 3000);

                Hashtable RespData = (Hashtable)GridResp.Value;
                this.UUID         = new LLUUID((string)RespData["UUID"]);
                this.regionhandle = Helpers.UIntsToLong(((uint)Convert.ToUInt32(RespData["region_locx"]) * 256), ((uint)Convert.ToUInt32(RespData["region_locy"]) * 256));
                this.regionname   = (string)RespData["regionname"];
                this.sim_ip       = (string)RespData["sim_ip"];
                this.sim_port     = (uint)Convert.ToUInt16(RespData["sim_port"]);
                this.caps_url     = "http://" + ((string)RespData["sim_ip"]) + ":" + (string)RespData["sim_port"] + "/";
                this.RegionLocX   = (uint)Convert.ToUInt32(RespData["region_locx"]);
                this.RegionLocY   = (uint)Convert.ToUInt32(RespData["region_locy"]);
                this.sendkey      = SendKey;
                this.recvkey      = RecvKey;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            return(this);
        }
        /// <summary>
        ///   This actually does the XMLRPC Request
        /// </summary>
        /// <param name = "httpInfo">RegionInfo we pull the data out of to send the request to</param>
        /// <param name = "xmlrpcdata">The Instant Message data Hashtable</param>
        /// <returns>Bool if the message was successfully delivered at the other side.</returns>
        protected virtual bool doIMSending(string httpInfo, Hashtable xmlrpcdata)
        {
            ArrayList SendParams = new ArrayList {
                xmlrpcdata
            };
            XmlRpcRequest GridReq = new XmlRpcRequest("grid_instant_message", SendParams);

            try
            {
                XmlRpcResponse GridResp = GridReq.Send(httpInfo, 7000);

                Hashtable responseData = (Hashtable)GridResp.Value;

                if (responseData.ContainsKey("success"))
                {
                    if ((string)responseData["success"] == "TRUE")
                    {
                        return(true);
                    }
                    return(false);
                }
                return(false);
            }
            catch (WebException e)
            {
                MainConsole.Instance.ErrorFormat("[GRID INSTANT MESSAGE]: Error sending message to " + httpInfo, e.Message);
            }

            return(false);
        }
Beispiel #27
0
        public bool RequestNeighborInfo(string gridServerURL, string sendKey, string receiveKey, ulong regionHandle, out RegionInfo regionInfo, out string errorMsg)
        {
            // didn't find it so far, we have to go the long way
            regionInfo = null;
            errorMsg = String.Empty;

            try
            {
                Hashtable requestData = new Hashtable();
                requestData["region_handle"] = regionHandle.ToString();
                requestData["authkey"] = sendKey;
                ArrayList SendParams = new ArrayList();
                SendParams.Add(requestData);

                string methodName = "simulator_data_request";
                XmlRpcRequest GridReq = new XmlRpcRequest(methodName, SendParams);
                XmlRpcResponse GridResp = GridReq.Send(Util.XmlRpcRequestURI(gridServerURL, methodName), DEFAULT_TIMEOUT);

                Hashtable responseData = (Hashtable)GridResp.Value;

                if (responseData.ContainsKey("error"))
                {
                    errorMsg = (string)responseData["error"];
                    return false;
                }

                uint regX = Convert.ToUInt32((string)responseData["region_locx"]);
                uint regY = Convert.ToUInt32((string)responseData["region_locy"]);
                string externalHostName = (string)responseData["sim_ip"];
                uint simPort = Convert.ToUInt32(responseData["sim_port"]);
                string regionName = (string)responseData["region_name"];
                UUID regionID = new UUID((string)responseData["region_UUID"]);
                uint remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);

                uint httpPort = 9000;
                if (responseData.ContainsKey("http_port"))
                {
                    httpPort = Convert.ToUInt32((string)responseData["http_port"]);
                }

                if (responseData.ContainsKey("product"))
                    regionInfo.Product = (ProductRulesUse)Convert.ToInt32(responseData["product"]);
                else
                    regionInfo.Product = ProductRulesUse.UnknownUse;

                string outsideIp = null;
                if (responseData.ContainsKey("outside_ip"))
                    regionInfo.OutsideIP = (string)responseData["outside_ip"];

                regionInfo = RegionInfo.Create(regionID, regionName, regX, regY, externalHostName, httpPort, simPort, remotingPort, outsideIp);
            }
            catch (Exception e)
            {
                errorMsg = e.Message;
                return false;
            }

            return true;
        }
Beispiel #28
0
        public object Call(string methodName, params object[] parameters)
        {
            XmlRpcRequest client = new XmlRpcRequest(methodName, parameters);

            XmlRpcResponse response = client.Send(Url);

            return(response.Value);
        }
Beispiel #29
0
        public DateTime?Ping()
        {
            XmlRpcResponse response;

            client.MethodName = "sample.Ping";
            Console.WriteLine(client);
            response = client.Send(host);
            if (response.IsFault)
            {
                Console.WriteLine("Fault {0}: {1}", response.FaultCode, response.FaultString);
                return(null);
            }
            else
            {
                return((DateTime)response.Value);
            }
        }
        public Dictionary <string, object> GetUserInfo(UUID userID)
        {
            Hashtable hash = new Hashtable();

            hash["userID"] = userID.ToString();

            IList paramList = new ArrayList();

            paramList.Add(hash);

            XmlRpcRequest request = new XmlRpcRequest("get_user_info", paramList);

            Dictionary <string, object> info = new Dictionary <string, object>();
            XmlRpcResponse response          = null;

            try
            {
                response = request.Send(m_ServerURL, 10000);
            }
            catch
            {
                m_log.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL);
                return(info);
            }

            if (response.IsFault)
            {
                m_log.ErrorFormat("[USER AGENT CONNECTOR]: remote call to {0} for GetServerURLs returned an error: {1}", m_ServerURL, response.FaultString);
                return(info);
            }

            hash = (Hashtable)response.Value;
            try
            {
                if (hash == null)
                {
                    m_log.ErrorFormat("[USER AGENT CONNECTOR]: GetUserInfo Got null response from {0}! THIS IS BAAAAD", m_ServerURL);
                    return(info);
                }

                // Here is the actual response
                foreach (object key in hash.Keys)
                {
                    if (hash[key] != null)
                    {
                        info.Add(key.ToString(), hash[key]);
                    }
                }
            }
            catch
            {
                m_log.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
            }

            return(info);
        }