Skip to content

Commit

Permalink
Added deletion of non-standard headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
karastojko committed Jun 3, 2021
1 parent 1c2011d commit afc9332
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 13 additions & 2 deletions include/mailio/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,25 @@ class MAILIO_EXPORT message : public mime
void attachment(std::size_t index, std::ostream& att_strm, std::string& att_name) const;

/**
Adding another header. Adding a header defined by other methods leads to the undefined behaviour.
Adding another header.
Adding a header defined by other methods leads to the undefined behaviour.
@param name Header name.
@param value Header value.
@todo Disallowing already defined headers?
@todo Disallowing standard headers defined elsewhere?
**/
void add_header(const std::string& name, const std::string& value);

/**
Removing another header.
Removing a header defined by other methods leads to the undefined behaviour.
@param name Header to remove.
**/
void remove_header(const std::string& name);

/**
Returning the other headers.
Expand Down
6 changes: 6 additions & 0 deletions src/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,12 @@ void message::add_header(const string& name, const string& value)
}


void message::remove_header(const std::string& name)
{
_headers.erase(name);
}


multimap<string, string> message::headers() const
{
return _headers;
Expand Down

0 comments on commit afc9332

Please sign in to comment.