MCPcopy Create free account
hub / github.com/Tripwire/tripwire-open-source / FormatNonAddressHeader

Method FormatNonAddressHeader

src/tripwire/mailmessage.cpp:425–457  ·  view source on GitHub ↗

TODO:BAM -- lines can only be 76 chars long -- enforce that!

Source from the content-addressed store, hash-verified

423
424// TODO:BAM -- lines can only be 76 chars long -- enforce that!
425std::string cMailMessageUtil::FormatNonAddressHeader(const std::string& name, const std::string& valC)
426{
427 cDebug d("cMailMessageUtil::FormatNonAddressHeader");
428
429 d.TraceDebug("name: %s, value: %s\n", name.c_str(), valC.c_str());
430
431 std::string val = valC;
432 ASSERT(val != "To");
433 ASSERT(val != "From");
434 ASSERT(val != "Sender");
435 ASSERT(val != "cc");
436 ASSERT(val != "bcc");
437 // ...
438
439 std::string s;
440
441 s += name;
442 s += ": ";
443
444 if (HasNonAsciiChars(val))
445 s += CreateEncodedText(val);
446 else
447 s += val;
448
449 s += "\r\n";
450
451
452 d.TraceDebug("came out as: %s\n", s.c_str());
453
454 ASSERT(s.length() < _MAX_RFC822_LINE_LEN - _EOL_LEN);
455
456 return s;
457}
458
459
460bool cMailMessageUtil::HasNonAsciiChars(const std::string& s)

Callers

nothing calls this directly

Calls 3

c_strMethod · 0.80
TraceDebugMethod · 0.60
lengthMethod · 0.45

Tested by

no test coverage detected