Ejemplo n.º 1
0
        /// Ouverture de la fenêtre de rédaction de mail, préchargée avec les informations en fonction du mail à l'origine de la réponse
        private void loadMailReponse()
        {
            if (currentCompteMessagerie.isAuthenticated() & gCurrentMail != null)
            {
                inboxMode = InboxMode.Reponse;
                SIMAIL.Classes.Email.Email vEmail = new SIMAIL.Classes.Email.Email();

                // Les émetteurs (From) deviennent récepteurs (To)
                foreach (var vDestinataire in gCurrentMail.From.Mailboxes)
                {
                    cEmail_Contact vContact = new cEmail_Contact(vDestinataire.Address, vDestinataire.Name);
                    vEmail.To.Add(vContact);
                }
                vEmail.From             = currentCompteMessagerie.Login;
                vEmail.Object           = "RE : " + gCurrentMail.Subject;
                vEmail.Body.Text        = "";
                vEmail.Body.TextReponse = vEmail.getReponseHeader(gCurrentMail);

                SIMAIL.Views.Email fenEmail = new SIMAIL.Views.Email();
                // Chargement de la fenetre
                fenEmail.action = Email.Action.Reponse;
                fenEmail.currentCompteMessagerie = currentCompteMessagerie;
                vEmail.ShowFenMail(fenEmail);
            }
        }
Ejemplo n.º 2
0
 private void UpdateInboxContents(InboxMode mode)
 {
     m_MessageManager.GetMessages(false, () =>
     {
         InboxReceived(mode);
     },
                                  NoConnection,
                                  MessagesFailed);
 }
Ejemplo n.º 3
0
    public void ShowSent()
    {
        m_MessagePanel.gameObject.SetActive(false);
        m_MessageListPanel.gameObject.SetActive(true);
        m_LastShownBox             = InboxMode.Sent;
        m_ReceivedButtonText.color = m_UnselectedBoxTextColor;
        m_SentButtonText.color     = m_SelectedBoxTextColor;

        UpdateInboxContents(InboxMode.Sent);
    }
Ejemplo n.º 4
0
        private void nouveauMail()
        {
            if (currentCompteMessagerie.isAuthenticated())
            {
                inboxMode = InboxMode.Nouveau;
                SIMAIL.Views.Email vFenEmail = new SIMAIL.Views.Email();

                vFenEmail.currentCompteMessagerie = currentCompteMessagerie;
                vFenEmail.Show();
            }
        }
Ejemplo n.º 5
0
        public async Task <Boolean> openInbox()
        {
            if (currentCompteMessagerie.isAuthenticated())
            {
                // Ouverture de la boite mail
                // Mode réception à l'ouverture de l'inbox
                currentClient = await currentCompteMessagerie.getIMAPConnection();

                inboxMode = InboxMode.Reception;
                currentClient.Inbox.Open(FolderAccess.ReadWrite);

                await getMailInbox();
            }
            else
            {
                MessageBox.Show("Aucune authentification !");
            }
            return(false);
        }
Ejemplo n.º 6
0
        // Transférer un mail
        private void loadMailTransfert()
        {
            if (currentCompteMessagerie.isAuthenticated() & gCurrentMail != null)
            {
                inboxMode = InboxMode.Transfert;
                SIMAIL.Classes.Email.Email vEmail = new SIMAIL.Classes.Email.Email();

                vEmail.From             = currentCompteMessagerie.Login;
                vEmail.Object           = "TR : " + gCurrentMail.Subject;
                vEmail.Body.Text        = "";
                vEmail.Body.TextReponse = vEmail.getReponseHeader(gCurrentMail);

                SIMAIL.Views.Email fenEmail = new SIMAIL.Views.Email();
                // Chargement de la fenetre
                fenEmail.action = Email.Action.Transfert;
                fenEmail.currentCompteMessagerie = currentCompteMessagerie;
                vEmail.ShowFenMail(fenEmail);
            }
        }
Ejemplo n.º 7
0
    private void InboxReceived(InboxMode mode)
    {
        MessageManager.ThreadStructure threads = m_MessageManager.GetThreads();

        // Find and sort the messages that started a thread and should be shown in this mailbox
        List <string> visibleThreadRoots = new List <string>();

        for (int i = 0; i < threads.m_Roots.Count; ++i)
        {
            if (CheckThreadVisibility(threads.m_Roots[i], threads, mode))
            {
                visibleThreadRoots.Add(threads.m_Roots[i]);
            }
        }

        visibleThreadRoots.Sort((t1, t2) => { return(GetThreadTimestamp(t2, threads).CompareTo(GetThreadTimestamp(t1, threads))); });

        int index = 0;

        for (int i = 0; i < visibleThreadRoots.Count; ++i)
        {
            // create a new instance if it doesn't exist already
            if (m_MessageHeaderInstances.Count <= index)
            {
                if (index > 0)
                {
                    m_MessageHeaderSeparators.Add(Instantiate(m_MessageSeparator));
                    m_MessageHeaderSeparators[index - 1].transform.SetParent(m_MessageListContentParent, false);
                }

                m_MessageHeaderInstances.Add(Instantiate <MessageHeaderTemplate>(m_MessageHeaderTemplate));
                m_MessageHeaderInstances[index].transform.SetParent(m_MessageListContentParent, false);
            }

            if (index > 0)
            {
                m_MessageHeaderSeparators[index - 1].gameObject.SetActive(true);
            }

            // update instance data
            MessageHeaderTemplate instance = m_MessageHeaderInstances[index];
            string      message            = visibleThreadRoots[i];
            string      partner            = GetLastThreadPartner(threads, message);
            MessageInfo m = m_MessageManager.GetMessage(message);
            instance.SetData(m, GetThreadTimestamp(message, threads), m_UserManager.GetUserRealName(partner), this, CountThreadLength(threads, message));
            m_UserManager.GetUserImage(partner, instance.m_SenderImage);
            instance.gameObject.SetActive(true);

            ++index;
        }

        // disable the rest of the instances
        for (; index <= m_LastActiveMessageHeader; ++index)
        {
            if (index > 0 && index <= m_LastActiveMessageHeader)
            {
                m_MessageHeaderSeparators[index - 1].gameObject.SetActive(false);
            }

            m_MessageHeaderInstances[index].gameObject.SetActive(false);
        }

        m_LastActiveMessageHeader = visibleThreadRoots.Count - 1;
    }
Ejemplo n.º 8
0
    // Inbox: Everything is visible except threads where all messages are sent by myself
    // Sent: Threads where I am the senders in at least one message are visible
    private bool CheckThreadVisibility(string root, MessageManager.ThreadStructure threads, InboxMode mode)
    {
        int    loops          = 0;
        string usernameToShow = m_UserManager.GetUserName(m_MessageManager.GetUserToShow());

        do
        {
            MessageInfo m = m_MessageManager.GetMessage(root);
            if (mode == InboxMode.Sent && m.sender.username != null && m.sender.username.Equals(usernameToShow))
            {
                return(true);
            }

            //if ( mode == InboxMode.Received && m.recipient != null && m.recipient.Equals(m_MessageManager.GetUserToShow()) )
            if (mode == InboxMode.Received && m.sender.username != null && !m.sender.username.Equals(usernameToShow))
            {
                return(true);
            }

            if (threads.m_Next.ContainsKey(root))
            {
                ++loops;
                root = threads.m_Next[root];
            }
            else
            {
                break;
            }
        } while (loops < 10000);

        return(false);
    }