コード例 #1
0
ファイル: ImapClient.cs プロジェクト: D-A-W-N/Gangwars-Bot
		static async void OnNewMessage (object sender, IdleMessageEventArgs e)
		{
			MailMessage Message = Client.GetMessage (e.MessageUID);
			if (Message.Body.Contains ("Angriffswarnung")) {
				await Task.Run (() => Irc.FilterEmail (Message));
			}
		}
コード例 #2
0
ファイル: ImapClientWrapper.cs プロジェクト: alexed1/dtrack
 private void InternalClientOnIdleError(object sender, IdleMessageEventArgs idleMessageEventArgs)
 {
     if (NewMessageInternal != null)
         NewMessageInternal(sender, new IdleMessageEventArgsWrapper(this));
 }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: fretelweb/SocialMail
 private void OnNewMessage(object sender, IdleMessageEventArgs e)
 {
     var m = e.Client.GetMessage(e.MessageUID,false);
       var d = Convert.ToDateTime(m.Headers.Get("Date"));
       var indice = dataGridView1.Rows.Add(m.From, m.Subject, d);
       dataGridView1.Rows[indice].Tag = m;
       dataGridView1.Sort(dataGridView1.Columns[2], System.ComponentModel.ListSortDirection.Descending);
       dataGridView1.Refresh();
 }
コード例 #4
0
 private void ImapClientNewMessage(object sender, IdleMessageEventArgs e)
 {
 }
コード例 #5
0
ファイル: ReceiveMailPlugin.cs プロジェクト: TNOCS/csTouch
        private void OnNewMessage(object sender, IdleMessageEventArgs e)
        {
            string mailFolder = Directory.GetCurrentDirectory() + "\\" +
                                AppStateSettings.Instance.Config.Get("ReceiveMailPlugin.Folder", "\\Presenter\\");
            if (!mailFolder.EndsWith("\\")) mailFolder += "\\";
            if (!Directory.Exists(mailFolder)) Directory.CreateDirectory(mailFolder);
            if (!Directory.Exists(mailFolder)) return;

            // Fetch the new message's headers and print the subject line
            MailMessage m = e.Client.GetMessage(e.MessageUID, FetchOptions.Normal);
            if (m.Attachments.Any())
            {
                foreach (Attachment a in m.Attachments)
                {
                    try
                    {
                        byte[] bytes = default(byte[]);
                        using (var memstream = new MemoryStream())
                        {
                            a.ContentStream.CopyTo(memstream);
                            bytes = memstream.ToArray();
                        }
                        string f = mailFolder + DateTime.Now.Ticks + "-" + a.Name;
                        File.WriteAllBytes(f, bytes);

                        if (AppState.Config.GetBool("ReceiveMailPlugin.ShowDirectly", false))
                        {
                            var fe = FloatingHelpers.CreateFloatingElement(new Document() {Location = f, OriginalUrl = f});
                            AppState.FloatingItems.AddFloatingElement(fe);
                        }

                        Execute.OnUIThread(
                            () =>
                            {
                                NotificationEventArgs nea =
                                    AppState.TriggerNotification("New file received from " + m.From.Address);
                            });
                    }
                    catch (Exception exception)
                    {                        
                        Logger.Log("ReceiveMailPlugin","Error save incoming message", exception.Message,Logger.Level.Error);
                    }
                    
                }
            }
        }
コード例 #6
0
 void ImapConnection_NewMessage(object sender, IdleMessageEventArgs e)
 {
     this.recievedMessage(e.MessageUID);
 }