Skip to content

Commit

Permalink
fix issue with duplicated message parts upon changing html_to_text_cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Jun 29, 2024
1 parent ca49b7c commit 92d761d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ void Body::Parse()
size_t current_index = 0;
mailmime_parse(m_Data.c_str(), m_Data.size(), &current_index, &mime);

// clear all parsed members, in the event that it's a reparse due to version update
m_NumParts = 0;
m_PartInfos.clear();
m_PartDatas.clear();
m_TextPlainIndex = -1;
m_TextHtmlIndex = -1;
m_TextHtml.clear();
m_TextPlain.clear();
m_Html.clear();
m_HtmlParsed = false;
m_PartDatasParsed = false;

if (mime != NULL)
{
ParseMime(mime, 0);
Expand Down Expand Up @@ -502,7 +514,8 @@ size_t Body::GetCurrentParseVersion()
{
static std::hash<std::string> hashStr;
static size_t htmlToTextCmdHash = hashStr(Util::GetHtmlToTextConvertCmd());
static size_t parseVersion = 1 + htmlToTextCmdHash; // update offset when parsing changes
static size_t parseVersionOffset = 1; // bump version offset when parsing changes
static size_t parseVersion = parseVersionOffset + htmlToTextCmdHash;
return parseVersion;
}

Expand Down
2 changes: 1 addition & 1 deletion src/nmail.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NMAIL "1" "June 2024" "nmail v4.67" "User Commands"
.TH NMAIL "1" "June 2024" "nmail v4.68" "User Commands"
.SH NAME
nmail \- ncurses mail
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "version.h"

#define NMAIL_VERSION "4.67"
#define NMAIL_VERSION "4.68"

std::string Version::GetBuildOs()
{
Expand Down

0 comments on commit 92d761d

Please sign in to comment.