public bool DeleteFriendship(UUID PrincipalID, UUID Friend, string secret)
        {
            FriendInfo finfo = new FriendInfo();

            finfo.PrincipalID = PrincipalID;
            finfo.Friend      = Friend.ToString();

            Dictionary <string, object> sendData = finfo.ToKeyValuePairs();

            sendData["METHOD"] = "deletefriendship";
            sendData["SECRET"] = secret;

            string reply = string.Empty;
            string uri   = m_ServerURI + "/hgfriends";

            try
            {
                reply = SynchronousRestFormsRequester.MakeRequest("POST",
                                                                  uri,
                                                                  ServerUtils.BuildQueryString(sendData));
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message);
                return(false);
            }

            if (reply != string.Empty)
            {
                Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply);

                if (replyData.ContainsKey("RESULT"))
                {
                    if (replyData["RESULT"].ToString().ToLower() == "true")
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    m_log.DebugFormat("[HGFRIENDS CONNECTOR]: reply data does not contain result field");
                }
            }
            else
            {
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: received empty reply");
            }

            return(false);
        }
        public bool NewFriendship(UUID PrincipalID, string Friend)
        {
            FriendInfo finfo = new FriendInfo();

            finfo.PrincipalID = PrincipalID;
            finfo.Friend      = Friend;

            Dictionary <string, object> sendData = finfo.ToKeyValuePairs();

            sendData["METHOD"]    = "newfriendship";
            sendData["KEY"]       = m_ServiceKey;
            sendData["SESSIONID"] = m_SessionID.ToString();

            string reply = string.Empty;
            string uri   = m_ServerURI + "/hgfriends";

            try
            {
                reply = SynchronousRestFormsRequester.MakeRequest("POST",
                                                                  uri,
                                                                  ServerUtils.BuildQueryString(sendData));
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message);
                return(false);
            }

            if (reply != string.Empty)
            {
                Dictionary <string, object> replyData = ServerUtils.ParseXmlResponse(reply);

                if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null))
                {
                    bool success = false;
                    Boolean.TryParse(replyData["Result"].ToString(), out success);
                    return(success);
                }
                else
                {
                    m_log.DebugFormat("[HGFRIENDS CONNECTOR]: StoreFriend {0} {1} received null response",
                                      PrincipalID, Friend);
                }
            }
            else
            {
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: StoreFriend received null reply");
            }

            return(false);
        }
        public bool ValidateFriendshipOffered(UUID fromID, UUID toID)
        {
            FriendInfo finfo = new FriendInfo();
            finfo.PrincipalID = fromID;
            finfo.Friend = toID.ToString();

            Dictionary<string, object> sendData = finfo.ToKeyValuePairs();

            sendData["METHOD"] = "validate_friendship_offered";

            string reply = string.Empty;
            string uri = m_ServerURI + "/hgfriends";
            try
            {
                reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        uri,
                        ServerUtils.BuildQueryString(sendData));
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message);
                return false;
            }

            if (reply != string.Empty)
            {
                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

                if (replyData.ContainsKey("RESULT"))
                {
                    if (replyData["RESULT"].ToString().ToLower() == "true")
                        return true;
                    else
                        return false;
                }
                else
                    m_log.DebugFormat("[HGFRIENDS CONNECTOR]: reply data does not contain result field");

            }
            else
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: received empty reply");

            return false;

        }
        public bool NewFriendship(UUID PrincipalID, string Friend)
        {
            FriendInfo finfo = new FriendInfo();
            finfo.PrincipalID = PrincipalID;
            finfo.Friend = Friend;

            Dictionary<string, object> sendData = finfo.ToKeyValuePairs();

            sendData["METHOD"] = "newfriendship";
            sendData["KEY"] = m_ServiceKey;
            sendData["SESSIONID"] = m_SessionID.ToString();

            string reply = string.Empty;
            string uri = m_ServerURI + "/hgfriends";
            try
            {
                reply = SynchronousRestFormsRequester.MakeRequest("POST",
                        uri,
                        ServerUtils.BuildQueryString(sendData));
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message);
                return false;
            }

            if (reply != string.Empty)
            {
                Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);

                if ((replyData != null) && replyData.ContainsKey("Result") && (replyData["Result"] != null))
                {
                    bool success = false;
                    Boolean.TryParse(replyData["Result"].ToString(), out success);
                    return success;
                }
                else
                    m_log.DebugFormat("[HGFRIENDS CONNECTOR]: StoreFriend {0} {1} received null response",
                        PrincipalID, Friend);
            }
            else
                m_log.DebugFormat("[HGFRIENDS CONNECTOR]: StoreFriend received null reply");

            return false;

        }