Esempio n. 1
0
        public DateTime llEmail(string address, string subject, string message)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Low, "llEmail", m_host, "LSL", m_itemID))
            {
                return(DateTime.Now);
            }
            IEmailModule emailModule = World.RequestModuleInterface <IEmailModule>();

            if (emailModule == null)
            {
                Error("llEmail", "Email module not configured");
                return(DateTime.Now);
            }

            emailModule.SendEmail(m_host.UUID, address, subject, message, World);
            return(PScriptSleep(m_sleepMsOnEmail));
        }
Esempio n. 2
0
        /// <summary>
        ///     This deals with saving the report into the database.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="regionName"></param>
        /// <param name="abuserID"></param>
        /// <param name="catagory"></param>
        /// <param name="checkflags"></param>
        /// <param name="details"></param>
        /// <param name="objectID"></param>
        /// <param name="position"></param>
        /// <param name="reportType"></param>
        /// <param name="screenshotID"></param>
        /// <param name="summery"></param>
        /// <param name="reporter"></param>
        void UserReport(IClientAPI client, string regionName, UUID abuserID, byte catagory, byte checkflags,
                        string details, UUID objectID, Vector3 position, byte reportType, UUID screenshotID,
                        string summery, UUID reporter)
        {
            AbuseReport report = new AbuseReport
            {
                ObjectUUID     = objectID,
                ObjectPosition = position.ToString(),
                Active         = true,
                Checked        = false,
                Notes          = "",
                AssignedTo     = "No One",
                ScreenshotID   = screenshotID
            };

            if (objectID != UUID.Zero)
            {
                ISceneChildEntity Object = client.Scene.GetSceneObjectPart(objectID);
                report.ObjectName = Object.Name;
            }
            else
            {
                report.ObjectName = "";
            }

            string[] detailssplit = details.Split('\n');

            string AbuseDetails = detailssplit[detailssplit.Length - 1];

            report.AbuseDetails = AbuseDetails;

            report.ReporterName = client.Name;

            string[] findRegion = summery.Split('|');
            report.RegionName = findRegion[1];

            string[] findLocation    = summery.Split('(');
            string[] findLocationend = findLocation[1].Split(')');
            report.AbuseLocation = findLocationend[0];

            string[] findCategory    = summery.Split('[');
            string[] findCategoryend = findCategory[1].Split(']');
            report.Category = findCategoryend[0];

            string[] findAbuserName    = summery.Split('{');
            string[] findAbuserNameend = findAbuserName[1].Split('}');
            report.AbuserName = findAbuserNameend[0];

            string[] findSummary = summery.Split('\"');

            string abuseSummary = findSummary[1];

            if (findSummary.Length != 0)
            {
                abuseSummary = findSummary[1];
            }

            report.AbuseSummary = abuseSummary;


            report.Number = (-1);

            EstateSettings ES = client.Scene.RegionInfo.EstateSettings;

            //If the abuse email is set up and the email module is available, send the email
            if (ES.AbuseEmailToEstateOwner && ES.AbuseEmail != "")
            {
                IEmailModule Email = m_Scene.RequestModuleInterface <IEmailModule>();
                if (Email != null)
                {
                    string msg = "This abuse report was submitted by " +
                                 report.ReporterName + " against " +
                                 report.AbuserName + " at " +
                                 report.AbuseLocation + " in your region " +
                                 report.RegionName +
                                 ". Summary: " + report.AbuseSummary +
                                 ". Details: " + report.AbuseDetails + ".";

                    Email.SendEmail(
                        UUID.Zero,
                        ES.AbuseEmail,
                        "Abuse Report",
                        msg,
                        client.Scene
                        );
                }
            }
            //Tell the DB about it
            IAbuseReports conn = m_Scene.RequestModuleInterface <IAbuseReports>();

            if (conn != null)
            {
                conn.AddAbuseReport(report);
            }
        }
Esempio n. 3
0
        private void UndeliveredMessage(GridInstantMessage im, string reason)
        {
            if (OfflineMessagesConnector == null || im == null)
            {
                return;
            }
            IClientAPI client = FindClient(im.FromAgentID);

            if ((client == null) && (im.Dialog != 32))
            {
                return;
            }
            if (!OfflineMessagesConnector.AddOfflineMessage(im))
            {
                if ((!im.FromGroup) && (reason != "User does not exist.") && (client != null))
                {
                    client.SendInstantMessage(new GridInstantMessage()
                    {
                        FromAgentID   = im.ToAgentID,
                        FromAgentName = "System",
                        ToAgentID     = im.FromAgentID,
                        Dialog        = (byte)InstantMessageDialog.MessageFromAgent,
                        Message       = "User has too many IMs already, please try again later.",
                        Offline       = 0,
                        RegionID      = im.RegionID
                    });
                }
                else if (client == null)
                {
                    return;
                }
            }
            else if ((im.Offline != 0) &&
                     (!im.FromGroup || im.FromGroup))
            {
                if (im.Dialog == 32) //Group notice
                {
                    IGroupsModule module = m_Scene.RequestModuleInterface <IGroupsModule>();
                    if (module != null)
                    {
                        im = module.BuildOfflineGroupNotice(im);
                    }
                    return;
                }
                if (client == null)
                {
                    return;
                }
                IEmailModule emailModule = m_Scene.RequestModuleInterface <IEmailModule>();
                if (emailModule != null && m_SendOfflineMessagesToEmail)
                {
                    IUserProfileInfo profile =
                        Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>().GetUserProfile(im.ToAgentID);
                    if (profile != null && profile.IMViaEmail)
                    {
                        UserAccount account = m_Scene.UserAccountService.GetUserAccount(null, im.ToAgentID);
                        if (account != null && !string.IsNullOrEmpty(account.Email))
                        {
                            emailModule.SendEmail(UUID.Zero, account.Email,
                                                  string.Format("Offline Message from {0}", im.FromAgentName),
                                                  string.Format("Time: {0}\n",
                                                                Util.ToDateTime(im.Timestamp).ToShortDateString()) +
                                                  string.Format("From: {0}\n", im.FromAgentName) +
                                                  string.Format("Message: {0}\n", im.Message), m_Scene);
                        }
                    }
                }

                if (im.Dialog == (byte)InstantMessageDialog.MessageFromAgent && !im.FromGroup)
                {
                    client.SendInstantMessage(new GridInstantMessage()
                    {
                        FromAgentID   = im.ToAgentID,
                        FromAgentName = "System",
                        ToAgentID     = im.FromAgentID,
                        Dialog        = (byte)InstantMessageDialog.MessageFromAgent,
                        Message       = "Message saved, reason: " + reason,
                        Offline       = 0,
                        RegionID      = im.RegionID
                    });
                }

                if (im.Dialog == (byte)InstantMessageDialog.InventoryOffered)
                {
                    client.SendAlertMessage("User is not online. Inventory has been saved");
                }
            }
            else if (im.Offline == 0)
            {
                if (client == null)
                {
                    return;
                }
                if (im.Dialog == (byte)InstantMessageDialog.MessageFromAgent && !im.FromGroup)
                {
                    client.SendInstantMessage(new GridInstantMessage()
                    {
                        FromAgentID   = im.ToAgentID,
                        FromAgentName = "System",
                        ToAgentID     = im.FromAgentID,
                        Dialog        = (byte)InstantMessageDialog.MessageFromAgent,
                        Message       = "Message saved, reason: " + reason,
                        Offline       = 0,
                        RegionID      = im.RegionID
                    });
                }

                if (im.Dialog == (byte)InstantMessageDialog.InventoryOffered)
                {
                    client.SendAlertMessage("User not able to be found. Inventory has been saved");
                }
            }
        }
        private void UndeliveredMessage(GridInstantMessage im)
        {
            if ((im.offline != 0) &&
                (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages)))
            {
                if (im.dialog == 32) //Group notice
                {
                    IGroupsModule module = m_SceneList[0].RequestModuleInterface <IGroupsModule>();
                    if (module != null)
                    {
                        im = module.BuildOfflineGroupNotice(im);
                    }
                }
                OfflineMessagesConnector.AddOfflineMessage(im);

                IEmailModule emailModule = m_SceneList[0].RequestModuleInterface <IEmailModule> ();
                if (emailModule != null && m_SendOfflineMessagesToEmail)
                {
                    IUserProfileInfo profile = Aurora.DataManager.DataManager.RequestPlugin <IProfileConnector> ().GetUserProfile(UUID.Parse(im.toAgentID.ToString()));
                    if (profile.IMViaEmail)
                    {
                        UserAccount account = m_SceneList[0].UserAccountService.GetUserAccount(UUID.Zero, UUID.Parse(im.toAgentID.ToString()));
                        if (account != null && account.Email != "" && account.Email != null)
                        {
                            emailModule.SendEmail(UUID.Zero, account.Email, string.Format("Offline Message from {0}", im.fromAgentName),
                                                  string.Format("Time: {0}\n", Util.ToDateTime(im.timestamp).ToShortDateString()) +
                                                  string.Format("From: {0}\n", im.fromAgentName) +
                                                  string.Format("Message: {0}\n", im.message));
                        }
                    }
                }

                if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
                {
                    IClientAPI client = FindClient(new UUID(im.fromAgentID));
                    if (client == null)
                    {
                        return;
                    }

                    client.SendInstantMessage(new GridInstantMessage(
                                                  null, new UUID(im.toAgentID),
                                                  "System", new UUID(im.fromAgentID),
                                                  (byte)InstantMessageDialog.MessageFromAgent,
                                                  "User is not logged in. Message saved.",
                                                  false, new Vector3()));
                }

                if (im.dialog == (byte)InstantMessageDialog.InventoryOffered)
                {
                    OfflineMessagesConnector.AddOfflineMessage(im);
                    IClientAPI client = FindClient(new UUID(im.fromAgentID));
                    if (client == null)
                    {
                        return;
                    }

                    client.SendAlertMessage("User is not online. Inventory has been saved");
                }
            }
            else if (im.offline == 0)
            {
                OfflineMessagesConnector.AddOfflineMessage(im);

                if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
                {
                    IClientAPI client = FindClient(new UUID(im.fromAgentID));
                    if (client == null)
                    {
                        return;
                    }

                    client.SendInstantMessage(new GridInstantMessage(
                                                  null, new UUID(im.toAgentID),
                                                  "System", new UUID(im.fromAgentID),
                                                  (byte)InstantMessageDialog.MessageFromAgent,
                                                  "User is not able to be found. Message saved.",
                                                  false, new Vector3()));
                }

                if (im.dialog == (byte)InstantMessageDialog.InventoryOffered)
                {
                    OfflineMessagesConnector.AddOfflineMessage(im);
                    IClientAPI client = FindClient(new UUID(im.fromAgentID));
                    if (client == null)
                    {
                        return;
                    }

                    client.SendAlertMessage("User not able to be found. Inventory has been saved");
                }
            }
        }
Esempio n. 5
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters,
                                                ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object> ();

            string error = "";

            if (requestParameters.ContainsKey("Submit"))
            {
                string username  = requestParameters ["username"].ToString();
                string UserEmail = requestParameters ["UserEmail"].ToString();

                UserAccount account = webInterface.Registry.RequestModuleInterface <IUserAccountService> ().GetUserAccount(null, username);

                if (account == null)
                {
                    response = "<h3>Please enter a valid username</h3>";
                    return(null);
                }

                // email user etc here...
                if (account.Email == "")
                {
                    response = "<h3>Sorry! Your account has no email details. Please contact the administrator to correct</h3>" +
                               "<script language=\"javascript\">" +
                               "setTimeout(function() {window.location.href = \"index.html\";}, 5000);" +
                               "</script>";

                    return(null);
                }

                var emailAddress = account.Email;

                if (UserEmail != emailAddress)
                {
                    response = "<h3>Sorry! Unable to authenticate your account. Please contact the administrator to correct</h3>" +
                               "<script language=\"javascript\">" +
                               "setTimeout(function() {window.location.href = \"index.html\";}, 5000);" +
                               "</script>";

                    return(null);
                }

                IEmailModule Email = webInterface.Registry.RequestModuleInterface <IEmailModule> ();

                if ((Email != null) && (!Email.LocalOnly()))
                {
                    var  newPassword = Utilities.RandomPassword.Generate(2, 1, 0);
                    var  authService = webInterface.Registry.RequestModuleInterface <IAuthenticationService> ();
                    var  gridName    = webInterface.Registry.RequestModuleInterface <IGridInfo> ().GridName;
                    bool success     = false;

                    if (authService != null)
                    {
                        success = authService.SetPassword(account.PrincipalID, "UserAccount", newPassword);
                    }

                    if (success)
                    {
                        Email.SendEmail(
                            UUID.Zero,
                            emailAddress,
                            "Password reset request",
                            string.Format("This request was made via the {0} WebUi at {1}\n\nYour new passsword is : {2}",
                                          gridName, Culture.LocaleTimeDate(), newPassword), null);

                        response = "<h3>An email has been sent with your new password</h3>Redirecting to main page";
                    }
                    else
                    {
                        response = "<h3>Sorry! Your password was not able to be reset.<h3>Please contact the administrator directly<br>Redirecting to main page</h3>";
                    }
                }
                else
                {
                    response = "<h3>The email functions are local to the grid or have not yet been set up<h3>Please contact the administrator directly<br>Redirecting to main page</h3>";
                }

                response = response +
                           "<script language=\"javascript\">" +
                           "setTimeout(function() {window.location.href = \"index.html\";}, 5000);" +
                           "</script>";

                return(null);
            }

            vars.Add("ErrorMessage", error);
            vars.Add("ForgotPassword", translator.GetTranslatedString("ForgotPassword"));
            vars.Add("UserNameText", translator.GetTranslatedString("UserName"));
            vars.Add("UserEmailText", translator.GetTranslatedString("UserEmailText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));

            return(vars);
        }