Aurora.Addon.HyperGrid.UserAgentServiceConnector.GetUserInfo C# (CSharp) Method

GetUserInfo() public method

public GetUserInfo ( UUID userID ) : object>.Dictionary
userID UUID
return object>.Dictionary
        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
            {
                MainConsole.Instance.DebugFormat("[USER AGENT CONNECTOR]: Unable to contact remote server {0} for GetUserInfo", m_ServerURL);
                return info;
            }

            if (response.IsFault)
            {
                MainConsole.Instance.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)
                {
                    MainConsole.Instance.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
            {
                MainConsole.Instance.ErrorFormat("[USER AGENT CONNECTOR]: Got exception on GetOnlineFriends response.");
            }

            return info;
        }

Usage Example

Beispiel #1
0
        private bool GetUserProfileData(UUID userID, out Dictionary <string, object> userInfo)
        {
            IUserFinder uManage = m_registry.RequestModuleInterface <IUserFinder>();

            userInfo = new Dictionary <string, object>();

            if (!uManage.IsLocalGridUser(userID))
            {
                // Is Foreign
                string home_url = uManage.GetUserServerURL(userID, "HomeURI");

                if (String.IsNullOrEmpty(home_url))
                {
                    userInfo["user_flags"]   = 0;
                    userInfo["user_created"] = 0;
                    userInfo["user_title"]   = "Unavailable";

                    return(true);
                }

                UserAgentServiceConnector uConn = new UserAgentServiceConnector(home_url);

                Dictionary <string, object> account = uConn.GetUserInfo(userID);

                if (account.Count > 0)
                {
                    if (account.ContainsKey("user_flags"))
                    {
                        userInfo["user_flags"] = account["user_flags"];
                    }
                    else
                    {
                        userInfo["user_flags"] = "";
                    }

                    if (account.ContainsKey("user_created"))
                    {
                        userInfo["user_created"] = account["user_created"];
                    }
                    else
                    {
                        userInfo["user_created"] = "";
                    }

                    userInfo["user_title"] = "HG Visitor";
                }
                else
                {
                    userInfo["user_flags"]   = 0;
                    userInfo["user_created"] = 0;
                    userInfo["user_title"]   = "HG Visitor";
                }
                return(true);
            }
            return(false);
        }
All Usage Examples Of Aurora.Addon.HyperGrid.UserAgentServiceConnector::GetUserInfo