public List<Email> GetEmails(UUID objectID)
        {
            OSDMap map = new OSDMap();

            map["ObjectID"] = objectID;
            map["Method"] = "getemails";

            List<Email> Messages = new List<Email>();
            try
            {
                List<string> urls =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string url in urls)
                {
                    OSDMap result = WebUtils.PostToService(url + "osd", map, true, false);
                    OSDArray array = (OSDArray) OSDParser.DeserializeJson(result["_RawResult"]);
                    foreach (OSD o in array)
                    {
                        Email message = new Email();
                        message.FromOSD((OSDMap) o);
                        Messages.Add(message);
                    }
                }
                return Messages;
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteEmailConnector]: Exception when contacting server: {0}", e);
            }
            return Messages;
        }
        public void InsertEmail(Email email)
        {
            object remoteValue = DoRemote(email);
            if (remoteValue != null || m_doRemoteOnly)
                return;

            GenericUtils.AddGeneric(email.toPrimID, "Emails", UUID.Random().ToString(),
                                            email.ToOSD(), GD);
        }
        public byte[] InsertEmail(OSDMap request)
        {
            Email message = new Email();
            message.FromOSD(request);
            OSDMap map = new OSDMap();
            map["Result"] = true;
            EmailConnector.InsertEmail(message);

            string xmlString = OSDParser.SerializeJsonString(map);
            UTF8Encoding encoding = new UTF8Encoding();
            return encoding.GetBytes(xmlString);
        }
 /// <summary>
 ///   Adds a new offline message for the user.
 /// </summary>
 /// <param name = "message"></param>
 public void InsertEmail(Email email)
 {
     GenericUtils.AddGeneric(email.toPrimID, "Emails", UUID.Random().ToString(),
                                     email.ToOSD(), GD);
 }
        public void InsertEmail(Email email)
        {
            OSDMap sendData = email.ToOSD();

            sendData["Method"] = "insertemail";

            try
            {
                List<string> urls =
                    m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
#if (!ISWIN)
                foreach (string url in urls)
                {
                    OSDMap result = WebUtils.PostToService(url + "osd", sendData, true, false);
                    if(((OSDMap) OSDParser.DeserializeJson(result["_RawResult"]))["Result"].AsBoolean())
                        return;
                }
#else
                foreach (OSDMap result in urls.Select(url => WebUtils.PostToService(url + "osd", sendData, true, false)))
                {
                    if(((OSDMap) OSDParser.DeserializeJson(result["_RawResult"]))["Result"].AsBoolean()) return;
                }
#endif
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteEmailConnector]: Exception when contacting server: {0}", e);
            }
        }