Skip to content

Commit

Permalink
Fixing mail reply
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Dec 29, 2022
1 parent 863425c commit 7c7e807
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions js/core-mail-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@
General Public License for more details.
*/

Luwrain.addHook("luwrain.mail.reply", (message)=>{
const to = message.getTo().full;
const t = message.getTextAsArray();
const text = ["", ""];
for(let i of t) {
if (i.trim() == "--")
break;
text.push(">" + i);
}
var subject = message.getSubject();
subject = "Re: " + subject;
const arg = {to, subject, text};
Luwrain.launchApp("message", [JSON.stringify(arg)]);
return true;
});


function stripRe(text)
{
return text.replaceAll('^[Rr][Ee](\\[[0-9]+\\])*: ', '').trim();
Expand Down Expand Up @@ -87,10 +104,3 @@ Luwrain.addHook("luwrain.mail.summary.organize", function(messages){
return res;
});

Luwrain.addHook("luwrain.mail.reply", function(message){
var to = message.from.full;
var subject = message.subject;
var text = message.text;
Luwrain.launchApp("message", [to, "", subject, text]);
return true;
});

0 comments on commit 7c7e807

Please sign in to comment.