This commit is contained in:
@@ -69,10 +69,10 @@ namespace rockfishCore.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpPost("isspam/{account}/{id}")]
|
[HttpPost("isspam/{account}/{id}")]
|
||||||
public JsonResult IsSpam([FromRoute] string account, [FromRoute] uint id)
|
public JsonResult IsSpam([FromRoute] string account, [FromRoute] uint id)
|
||||||
{
|
{
|
||||||
|
|
||||||
RfMail.rfMailAccount acct = RfMail.rfMailAccount.support;
|
RfMail.rfMailAccount acct = RfMail.rfMailAccount.support;
|
||||||
if (account.Contains("sales"))
|
if (account.Contains("sales"))
|
||||||
{
|
{
|
||||||
@@ -89,6 +89,51 @@ namespace rockfishCore.Controllers
|
|||||||
return Json(new { msg = ex.Message, error = 1 });
|
return Json(new { msg = ex.Message, error = 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost("movetosub/{account}/{id}")]
|
||||||
|
public JsonResult MoveToSub([FromRoute] string account, [FromRoute] uint id)
|
||||||
|
{
|
||||||
|
|
||||||
|
RfMail.rfMailAccount acct = RfMail.rfMailAccount.support;
|
||||||
|
if (account.Contains("sales"))
|
||||||
|
{
|
||||||
|
acct = RfMail.rfMailAccount.sales;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RfMail.MoveAndMarkRead(id, acct, true);
|
||||||
|
return Json(new { msg = "message processed as spam", ok = 1 });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Json(new { msg = ex.Message, error = 1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("movetonotsub/{account}/{id}")]
|
||||||
|
public JsonResult MoveToNotSub([FromRoute] string account, [FromRoute] uint id)
|
||||||
|
{
|
||||||
|
|
||||||
|
RfMail.rfMailAccount acct = RfMail.rfMailAccount.support;
|
||||||
|
if (account.Contains("sales"))
|
||||||
|
{
|
||||||
|
acct = RfMail.rfMailAccount.sales;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RfMail.MoveAndMarkRead(id, acct, false);
|
||||||
|
return Json(new { msg = "message processed as spam", ok = 1 });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Json(new { msg = ex.Message, error = 1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// //------------------------------------------------------
|
// //------------------------------------------------------
|
||||||
|
|
||||||
public class dtoReplyMessageItem
|
public class dtoReplyMessageItem
|
||||||
|
|||||||
@@ -200,6 +200,51 @@ namespace rockfishCore.Util
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region handle read and move message
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Move to sub or unsub mail folder and mark as read
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="moveMessageId"></param>
|
||||||
|
/// <param name="replyFromAccount"></param>
|
||||||
|
public static void MoveAndMarkRead(uint moveMessageId, rfMailAccount replyFromAccount, bool toSubscribed)
|
||||||
|
{
|
||||||
|
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 (replyFromAccount == rfMailAccount.support)
|
||||||
|
{
|
||||||
|
client.Authenticate(MAIL_ACCOUNT_SUPPORT, MAIL_ACCOUNT_PASSWORD_SUPPORT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
client.Authenticate(MAIL_ACCOUNT_SALES, MAIL_ACCOUNT_PASSWORD_SALES);
|
||||||
|
}
|
||||||
|
|
||||||
|
//AyaNovaReceivedNOTSUB
|
||||||
|
//AyaNovaReceivedSubscribed
|
||||||
|
|
||||||
|
var newFolder = client.GetFolder(toSubscribed?"AyaNovaReceivedSubscribed":"AyaNovaReceivedNOTSUB");
|
||||||
|
|
||||||
|
if (newFolder != null)
|
||||||
|
{
|
||||||
|
client.Inbox.Open(FolderAccess.ReadWrite);
|
||||||
|
client.Inbox.MoveTo(new UniqueId(moveMessageId), newFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
client.Disconnect(true);
|
||||||
|
}
|
||||||
|
}//spaminator
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,80 @@ app.mailEdit = (function() {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////
|
||||||
|
// MOVE TO SUB HANDLER
|
||||||
|
//
|
||||||
|
onMoveToSub = function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
$.gevent.publish("app-clear-error");
|
||||||
|
|
||||||
|
//is this a new record?
|
||||||
|
if (stateMap.id == "new") {
|
||||||
|
alert("New message MOVE handling makes no sense - figure it out!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
app.api.create(
|
||||||
|
"mail/movetosub/" +
|
||||||
|
stateMap.context.params.mail_account +
|
||||||
|
"/" +
|
||||||
|
stateMap.context.params.mail_id,
|
||||||
|
null,
|
||||||
|
function(res) {
|
||||||
|
if (res.error) {
|
||||||
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
|
} else {
|
||||||
|
page("#!/inbox");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////
|
||||||
|
// MOVE TO SUB HANDLER
|
||||||
|
//
|
||||||
|
onMoveToNotSub = function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
$.gevent.publish("app-clear-error");
|
||||||
|
|
||||||
|
//is this a new record?
|
||||||
|
if (stateMap.id == "new") {
|
||||||
|
alert("New message MOVE handling makes no sense - figure it out!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
app.api.create(
|
||||||
|
"mail/movetonotsub/" +
|
||||||
|
stateMap.context.params.mail_account +
|
||||||
|
"/" +
|
||||||
|
stateMap.context.params.mail_id,
|
||||||
|
null,
|
||||||
|
function(res) {
|
||||||
|
if (res.error) {
|
||||||
|
$.gevent.publish("app-show-error", res.msg);
|
||||||
|
} else {
|
||||||
|
page("#!/inbox");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//new move routes:
|
||||||
|
//movetosub
|
||||||
|
//movetonotsub
|
||||||
|
|
||||||
|
|
||||||
//-------------------- END EVENT HANDLERS --------------------
|
//-------------------- END EVENT HANDLERS --------------------
|
||||||
|
|
||||||
//------------------- BEGIN PUBLIC METHODS -------------------
|
//------------------- BEGIN PUBLIC METHODS -------------------
|
||||||
@@ -167,6 +241,13 @@ app.mailEdit = (function() {
|
|||||||
|
|
||||||
//Context menu
|
//Context menu
|
||||||
app.nav.contextAddButton("btn-generate", "IsSpam", "axe", onSpam);
|
app.nav.contextAddButton("btn-generate", "IsSpam", "axe", onSpam);
|
||||||
|
app.nav.contextAddButton("btn-generate", "IsSpam", "axe", onSpam);
|
||||||
|
|
||||||
|
//Move to subscribed or not subscribed
|
||||||
|
|
||||||
|
//id, title, icon, clickhandler
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//NEW email options
|
//NEW email options
|
||||||
var $group = $("#sendToGroup");
|
var $group = $("#sendToGroup");
|
||||||
|
|||||||
Reference in New Issue
Block a user