Enable re-generation of broken Content-Id's that had no '@' sign in them (Zarafa).

This commit is contained in:
Vincent Richard 2008-07-11 21:37:38 +00:00
parent 689f99f7a6
commit f626c4fbe8
2 changed files with 9 additions and 4 deletions

View File

@ -118,7 +118,7 @@ void messageId::parse(const string& buffer, const string::size_type position,
// Extract left part // Extract left part
const string::size_type leftStart = position + (p - pstart); const string::size_type leftStart = position + (p - pstart);
while (p < pend && *p != '@') ++p; while (p < pend && *p != '@' && *p != '>') ++p;
m_left = string(buffer.begin() + leftStart, m_left = string(buffer.begin() + leftStart,
buffer.begin() + position + (p - pstart)); buffer.begin() + position + (p - pstart));
@ -178,6 +178,9 @@ ref <messageId> messageId::parseNext(const string& buffer, const string::size_ty
const string messageId::getId() const const string messageId::getId() const
{ {
if (m_right.empty())
return m_left;
return (m_left + '@' + m_right); return (m_left + '@' + m_right);
} }
@ -193,7 +196,9 @@ void messageId::generate(utility::outputStream& os, const string::size_type maxL
pos = NEW_LINE_SEQUENCE_LENGTH; pos = NEW_LINE_SEQUENCE_LENGTH;
} }
os << '<' << m_left << '@' << m_right << '>'; os << '<' << m_left;
if (m_right != "") os << '@' << m_right;
os << '>';
if (newLinePos) if (newLinePos)
*newLinePos = pos + m_left.length() + m_right.length() + 3; *newLinePos = pos + m_left.length() + m_right.length() + 3;

View File

@ -59,12 +59,12 @@ VMIME_TEST_SUITE_BEGIN
{ {
vmime::messageId m1; vmime::messageId m1;
VASSERT_EQ("1", "<@>", m1.generate()); VASSERT_EQ("1", "<>", m1.generate());
vmime::messageId m2; vmime::messageId m2;
m2.setLeft("a"); m2.setLeft("a");
VASSERT_EQ("2", "<a@>", m2.generate()); VASSERT_EQ("2", "<a>", m2.generate());
vmime::messageId m3; vmime::messageId m3;
m3.setRight("b"); m3.setRight("b");