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");
                }
            }
        }
示例#2
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");
                }
            }
        }
示例#3
0
        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);

                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");
                }
            }
        }