-rw-r--r-- | kabc/vcard/VCardv.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp index 391a69e..d19a004 100644 --- a/kabc/vcard/VCardv.cpp +++ b/kabc/vcard/VCardv.cpp @@ -143,103 +143,107 @@ VCard::_parse() } if (qstrnicmp(firstPart, "BEGIN", 5) != 0) { // No BEGIN ! vDebug("No BEGIN"); return; } if (qstrnicmp(valuePart, "VCARD", 5) != 0) { // Not a vcard ! vDebug("No VCARD"); return; } /////////////////////////////////////////////////////////////// // CONTENT LINES // vDebug("Content lines"); // Handle folded lines. QStrList refolded; QStrListIterator it(l); QCString cur; for (; it.current(); ++it) { cur = it.current(); ++it; while ( it.current() && it.current()[0] == ' ' && strlen(it.current()) != 1) { cur += it.current() + 1; ++it; } --it; refolded.append(cur); } QStrListIterator it2(refolded); for (; it2.current(); ++it2) { - - vDebug("New contentline using \"" + QCString(it2.current()) + "\""); + vDebug("New contentline using \"" + QCString(it2.current()) + "\""); ContentLine * cl = new ContentLine(it2.current()); cl->parse(); - - contentLineList_.append(cl); + if (cl->value() == 0) + { + qDebug("Content line could not be parsed. Discarded: %s" + QCString(it2.current())); + delete cl; + } + else + contentLineList_.append(cl); } /////////////////////////////////////////////////////////////// // LAST LINE split = endLine.find(':'); if (split == -1) // invalid, no END return; firstPart = endLine.left(split); valuePart = endLine.right(firstPart.length() - split - 1); split = firstPart.find('.'); if (split != -1) { group_ = firstPart.left(split); firstPart = firstPart.right(firstPart.length() - split - 1); } if (qstricmp(firstPart, "END") != 0) // No END ! return; if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! return; } void VCard::_assemble() { vDebug("Assembling vcard"); strRep_ = "BEGIN:VCARD\r\n"; strRep_ += "VERSION:3.0\r\n"; QPtrListIterator<ContentLine> it(contentLineList_); for (; it.current(); ++it) strRep_ += it.current()->asString() + "\r\n"; strRep_ += "END:VCARD\r\n"; } bool VCard::has(EntityType t) { parse(); return contentLine(t) == 0 ? false : true; } |