예제 #1
0
파일: Plugin.cs 프로젝트: nbhopson/QMail
        private void onMailAudited(string sender, ime.notification.NotifyMessage e, NotificationCenter.Stage stage)
        {
            if (stage == NotificationCenter.Stage.Receiving)
            {
                Application.Current.Dispatcher.Invoke((System.Action)delegate
                {
                    if (!DBWorker.IsDBCreated())
                        return;
                    XElement xml = e.Body as XElement;
                    if (xml == null)
                        return;
                    XElement msgXml = xml.Element("message");
                    if (msgXml == null)
                        return;

                    ASObject mail = new ASObject();
                    mail["uuid"] = msgXml.AttributeValue("uuid");
                    mail["folder"] = "SENDED";
                    MailWorker.instance.updateMailRecord(mail, new string[] { "folder" });
                    MailWorker.instance.dispatchMailEvent(MailWorker.Event.Reset, null, null);
                    Application.Current.Dispatcher.Invoke((System.Action)delegate
                    {
                        e.Show();
                    }, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
                }, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
            }
        }
예제 #2
0
        public static void QuickSend(ime.mail.Net.Mime.Mime message)
        {
            if(message == null){
                throw new ArgumentNullException("message");
            }

            string from = "";
            if(message.MainEntity.From != null && message.MainEntity.From.Count > 0){
                from = ((MailboxAddress)message.MainEntity.From[0]).EmailAddress;
            }

            List<string> recipients = new List<string>();
            if(message.MainEntity.To != null){
                MailboxAddress[] addresses = message.MainEntity.To.Mailboxes;
                foreach(MailboxAddress address in addresses){
                    recipients.Add(address.EmailAddress);
                }
            }
            if(message.MainEntity.Cc != null){
                MailboxAddress[] addresses = message.MainEntity.Cc.Mailboxes;
                foreach(MailboxAddress address in addresses){
                    recipients.Add(address.EmailAddress);
                }
            }
            if(message.MainEntity.Bcc != null){
                MailboxAddress[] addresses = message.MainEntity.Bcc.Mailboxes;
                foreach(MailboxAddress address in addresses){
                    recipients.Add(address.EmailAddress);
                }

                // We must hide BCC
                message.MainEntity.Bcc.Clear();
            }

            foreach(string recipient in recipients){
                QuickSend(null,from,recipient,new MemoryStream(message.ToByteData()));
            }
        }
예제 #3
0
        private void onSubscribe(string sender, ime.notification.NotifyMessage e, NotificationCenter.Stage stage)
        {
            if (isJoinAccept)
                return;
            if (stage == NotificationCenter.Stage.Receiving)
            {
                XElement xml = e.Body as XElement;
                if (xml == null)
                    return;
                XElement subscribe = xml.Element("subscribe");
                if (subscribe == null)
                    return;

                if (subscribe.AttributeValue("principal") == Desktop.instance.loginedPrincipal.loginId)
                    return;

                string type = subscribe.AttributeValue("type");
                if (type == "accept_mail")
                {
                    workInfo.SetInfo(subscribe.AttributeValue("principal_name") + "邮件账户" + subscribe.AttributeValue("account") + subscribe.AttributeValue("subject"));
                    workInfo.SetProgress(NumberUtil.parseInt(subscribe.AttributeValue("total")), NumberUtil.parseInt(subscribe.AttributeValue("count")));
                    if (subscribe.AttributeValue("detail") == "true")
                        workInfo.AddDetail(subscribe.AttributeValue("principal_name") + "邮件账户" + subscribe.AttributeValue("subject"), Colors.Black);
                }
                else if (type == "accept_mail_stram")
                {
                    workInfo.SetItemProgress(NumberUtil.parseInt(subscribe.AttributeValue("total")), NumberUtil.parseInt(subscribe.AttributeValue("count")));
                }
            }
        }
예제 #4
0
파일: Plugin.cs 프로젝트: nbhopson/QMail
 private void onMailDsBoxDeliver(string sender, ime.notification.NotifyMessage e, NotificationCenter.Stage stage)
 {
     if (stage == NotificationCenter.Stage.Receiving)
     {
         Application.Current.Dispatcher.Invoke((System.Action)delegate
         {
             e.Show();
         }, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
     }
     else if (stage == NotificationCenter.Stage.UserInteracting)
     {
         Application.Current.Dispatcher.Invoke((System.Action)delegate
         {
             Desktop.openALinkWindow(ALink.parseALink("alink://ime.mail/MailManager"));
         }, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
     }
 }
예제 #5
0
 private void onNewMail(string sender, ime.notification.NotifyMessage e, NotificationCenter.Stage stage)
 {
     if (stage == NotificationCenter.Stage.Receiving)
         e.Show();
 }