From edceae65576dd807cd07060f0448da5c4b622c81 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 4 Jul 2019 18:49:05 +0000 Subject: [PATCH] --- util/RfMail.cs | 45 ++++++++++++++++++++++++++++++++++---- wwwroot/js/app.mailEdit.js | 5 ++++- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/util/RfMail.cs b/util/RfMail.cs index 384dc12..a08e258 100644 --- a/util/RfMail.cs +++ b/util/RfMail.cs @@ -200,7 +200,7 @@ namespace rockfishCore.Util #endregion - #region handle read and move message + #region handle read and move message @@ -228,10 +228,14 @@ namespace rockfishCore.Util client.Authenticate(MAIL_ACCOUNT_SALES, MAIL_ACCOUNT_PASSWORD_SALES); } -//AyaNovaReceivedNOTSUB -//AyaNovaReceivedSubscribed + //AyaNovaReceivedNOTSUB + //AyaNovaReceivedSubscribed - var newFolder = client.GetFolder(toSubscribed?"AyaNovaReceivedSubscribed":"AyaNovaReceivedNOTSUB"); + //Flag as read + //flag the message as having been replied to + FlagMessageSeen(moveMessageId, replyFromAccount); + + var newFolder = client.GetFolder(toSubscribed ? "AyaNovaReceivedSubscribed" : "AyaNovaReceivedNOTSUB"); if (newFolder != null) { @@ -443,6 +447,39 @@ namespace rockfishCore.Util }//get message + + //Flag message as seen + public static bool FlagMessageSeen(uint uid, rfMailAccount inAccount = rfMailAccount.support) + { + using (var client = new ImapClient()) + { + // Accept all SSL certificates + client.ServerCertificateValidationCallback = (s, c, h, e) => true; + client.Connect(MAIL_IMAP_ADDRESS, MAIL_IMAP_PORT); + // Note: since we don't have an OAuth2 token, disable + // the XOAUTH2 authentication mechanism. + client.AuthenticationMechanisms.Remove("XOAUTH2"); + + if (inAccount == rfMailAccount.support) + { + client.Authenticate(MAIL_ACCOUNT_SUPPORT, MAIL_ACCOUNT_PASSWORD_SUPPORT); + } + else + { + client.Authenticate(MAIL_ACCOUNT_SALES, MAIL_ACCOUNT_PASSWORD_SALES); + } + + var inbox = client.Inbox; + inbox.Open(FolderAccess.ReadWrite); + inbox.AddFlags(new UniqueId(uid), MessageFlags.Seen, true); + // inbox.AddFlags(new UniqueId(uid), MessageFlags.Answered, true); + client.Disconnect(true); + return true; + } + }//get message + + + //////////////////////////////////////////////////// //Put a message in the drafts folder of support // diff --git a/wwwroot/js/app.mailEdit.js b/wwwroot/js/app.mailEdit.js index b81d7d8..6b489da 100644 --- a/wwwroot/js/app.mailEdit.js +++ b/wwwroot/js/app.mailEdit.js @@ -13,6 +13,8 @@ app.mailEdit = (function() { var stateMap = {}, onSend, onSpam, + onMoveToSub, + onMoveToNotSub, configModule, initModule; //----------------- END MODULE SCOPE VARIABLES --------------- @@ -241,7 +243,8 @@ app.mailEdit = (function() { //Context menu app.nav.contextAddButton("btn-generate", "IsSpam", "axe", onSpam); - app.nav.contextAddButton("btn-generate", "IsSpam", "axe", onSpam); + app.nav.contextAddButton("btn-movetosub", "MoveSub", "account-star", onMoveToSub); + app.nav.contextAddButton("btn-movetonotsub", "MoveNOTSub", "account-off-outline", onMoveToNotSub); //Move to subscribed or not subscribed