From cc29364f06178f8f6b457384f2ec37a042bd9d43 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 1 Sep 2010 00:37:02 +0000 Subject: * Massive set of changes to bring in all fixes and enhancements from the Enterprise PIM branch * Ensured that the Trinity changes were applied on top of those enhancements, and any redundancy removed * Added journal read support to the CalDAV resource * Fixed CalDAV resource to use events URL for tasks and journals when separate URL checkbox unchecked git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1170461 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- mimelib/COPYRIGHT | 13 +++++++++++ mimelib/datetime.cpp | 5 ++++- mimelib/dw_cte.cpp | 14 ++++++------ mimelib/dw_date.cpp | 54 ++++++++++++++++++++++++++++++---------------- mimelib/dw_mime.cpp | 9 ++++++++ mimelib/dwstring.cpp | 2 +- mimelib/mimelib/address.h | 3 +-- mimelib/mimelib/enum.h | 1 + mimelib/mimelib/headers.h | 1 - mimelib/mimelib/mailbox.h | 1 - mimelib/mimelib/mboxlist.h | 1 - mimelib/mimelib/msgcmp.h | 4 ++-- mimelib/mimelib/protocol.h | 1 + mimelib/test_boyermor.cpp | 1 + 14 files changed, 75 insertions(+), 35 deletions(-) create mode 100644 mimelib/COPYRIGHT (limited to 'mimelib') diff --git a/mimelib/COPYRIGHT b/mimelib/COPYRIGHT new file mode 100644 index 000000000..75ab5778d --- /dev/null +++ b/mimelib/COPYRIGHT @@ -0,0 +1,13 @@ +Copyright (c) 1996, 1997 Douglas W. Sauder +All rights reserved. + +IN NO EVENT SHALL DOUGLAS W. SAUDER BE LIABLE TO ANY PARTY FOR DIRECT, +INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF +THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF DOUGLAS W. SAUDER +HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +DOUGLAS W. SAUDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT +NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" +BASIS, AND DOUGLAS W. SAUDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE, +SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. diff --git a/mimelib/datetime.cpp b/mimelib/datetime.cpp index a704e127b..64f2eef2e 100644 --- a/mimelib/datetime.cpp +++ b/mimelib/datetime.cpp @@ -125,7 +125,10 @@ void DwDateTime::Init() DwUint32 t_local = my_inv_gmtime(&local); DwUint32 t_utc = my_inv_gmtime(&utc); sDefaultZone = (int) (t_local - t_utc)/60; - sIsDefaultZoneSet = 1; + + // do not flag this as it would never check the zone again, which + // would lead to wrong timediff on the DST/non-DST day change + //sIsDefaultZoneSet = 1; } // Set the time zone from the default time zone mZone = sDefaultZone; diff --git a/mimelib/dw_cte.cpp b/mimelib/dw_cte.cpp index 6ebf07f50..4498597d3 100644 --- a/mimelib/dw_cte.cpp +++ b/mimelib/dw_cte.cpp @@ -60,7 +60,7 @@ int DwToCrLfEol(const DwString& aSrcStr, DwString& aDestStr) char* destBuf = (char*) destStr.data(); // Encode source to destination - size_t destLen; + size_t destLen = 0; to_crlf(srcBuf, srcLen, destBuf, destSize, &destLen); aDestStr.assign(destStr, 0, destLen); return 0; @@ -78,7 +78,7 @@ int DwToLfEol(const DwString& aSrcStr, DwString& aDestStr) char* destBuf = (char*) destStr.data(); // Encode source to destination - size_t destLen; + size_t destLen = 0; to_lf(srcBuf, srcLen, destBuf, destSize, &destLen); aDestStr.assign(destStr, 0, destLen); return 0; @@ -96,7 +96,7 @@ int DwToCrEol(const DwString& aSrcStr, DwString& aDestStr) char* destBuf = (char*) destStr.data(); // Encode source to destination - size_t destLen; + size_t destLen = 0; to_cr(srcBuf, srcLen, destBuf, destSize, &destLen); aDestStr.assign(destStr, 0, destLen); return 0; @@ -129,7 +129,7 @@ int DwEncodeBase64(const DwString& aSrcStr, DwString& aDestStr) char* destBuf = (char*) destStr.data(); // Encode source to destination - size_t destLen; + size_t destLen = 0; int result = encode_base64(srcBuf, srcLen, destBuf, destSize, &destLen); aDestStr.assign(destStr, 0, destLen); @@ -149,7 +149,7 @@ int DwDecodeBase64(const DwString& aSrcStr, DwString& aDestStr) char* destBuf = (char*) destStr.data(); // Encode source to destination - size_t destLen; + size_t destLen = 0; int result = decode_base64(srcBuf, srcLen, destBuf, destSize, &destLen); aDestStr.assign(destStr, 0, destLen); @@ -170,7 +170,7 @@ int DwEncodeQuotedPrintable(const DwString& aSrcStr, DwString& aDestStr) char* destBuf = (char*) destStr.data(); // Encode source to destination - size_t destLen; + size_t destLen = 0; int result = encode_qp(srcBuf, srcLen, destBuf, destSize, &destLen); aDestStr.assign(destStr, 0, destLen); @@ -190,7 +190,7 @@ int DwDecodeQuotedPrintable(const DwString& aSrcStr, DwString& aDestStr) char* destBuf = (char*) destStr.data(); // Encode source to destination - size_t destLen; + size_t destLen = 0; int result = decode_qp(srcBuf, srcLen, destBuf, destSize, &destLen); aDestStr.assign(destStr, 0, destLen); diff --git a/mimelib/dw_date.cpp b/mimelib/dw_date.cpp index c8f89766c..e4436bbe7 100644 --- a/mimelib/dw_date.cpp +++ b/mimelib/dw_date.cpp @@ -246,7 +246,7 @@ int ParseRfc822Date(const char *str, struct tm *tms, int *z) case 'O': case 'o': /* Oct */ - if ((str[pos+1] == 'c' || str[pos+1] == 'c') + if ((str[pos+1] == 'c' || str[pos+1] == 'C') && (str[pos+2] == 't' || str[pos+2] == 'T')) { n = 9; pos += 3; @@ -713,6 +713,7 @@ int main() // "WWW MMM dd HH:MM:SS [Z] YYYY" zone is optional // e.g.: Fri Oct 14 09:21:49 CEST 2005 // or: Tue Mar 23 18:00:02 2004 +// also: Tue, Feb 04, 2003 00:01:20 +0000 #include #include @@ -733,6 +734,7 @@ int ParseDate(const char *str, struct tm *tms, int *z) int day=1, month=0, year=1970, hour=0, minute=0, second=0, zone=0; int i; + // check for week day for (i = 0; i < 7; i++) if ( strncmp(str, wdays[i], 3) == 0 ) break; @@ -740,8 +742,10 @@ int ParseDate(const char *str, struct tm *tms, int *z) if ( i == 7 ) return -1; + // check for month name + int offset = (str[3] == ',') ? 5 : 4; // allow weekday be terminated with "," for (i = 0; i < 12; i++) - if ( strncmp(str+4, months[i], 3) == 0 ) + if ( strncmp(str+offset, months[i], 3) == 0 ) break; if ( i == 12 ) @@ -749,27 +753,39 @@ int ParseDate(const char *str, struct tm *tms, int *z) month = i; - if ( sscanf(str+8, "%d %d:%d:%d", &day, &hour, &minute, &second) != 4 ) - return -1; - - if ( isdigit(str[20]) ) { // year without zone info, as in ctime() - if ( sscanf(str+20, "%d", &year) != 1 ) - return -1; + // try "dd, YYYY HH:MM:SS +ZZZZ" + int h, m; + char sign; + if ( sscanf(str+offset+4, "%d, %d %d:%d:%d %c%2d%2d", &day, &year, &hour, &minute, &second, &sign, &h, &m) == 8 ) { + // ok, worked, calculate zone + zone = h * 60 + m; + if ( sign == '-' ) + zone = -zone; } else { - if ( sscanf(str+20, "%*s %d", &year) != 1 ) + // try "dd HH:MM:SS" + if ( sscanf(str+8, "%d %d:%d:%d", &day, &hour, &minute, &second) != 4 ) return -1; - if ( strncmp(str+20, "EST" , 3) == 0 ) zone = -5 * 60; - else if ( strncmp(str+20, "EDT" , 3) == 0 ) zone = -4 * 60; - else if ( strncmp(str+20, "CST" , 3) == 0 ) zone = -6 * 60; - else if ( strncmp(str+20, "CDT" , 3) == 0 ) zone = -5 * 60; - else if ( strncmp(str+20, "MST" , 3) == 0 ) zone = -7 * 60; - else if ( strncmp(str+20, "MDT" , 3) == 0 ) zone = -6 * 60; - else if ( strncmp(str+20, "PST" , 3) == 0 ) zone = -8 * 60; - else if ( strncmp(str+20, "PDT" , 3) == 0 ) zone = -7 * 60; - else if ( strncmp(str+20, "CET" , 3) == 0 ) zone = 60; - else if ( strncmp(str+20, "CEST", 4) == 0 ) zone = 120; + if ( isdigit(str[20]) ) { // year without zone info, as in ctime() + if ( sscanf(str+20, "%d", &year) != 1 ) + return -1; + } + else { + if ( sscanf(str+20, "%*s %d", &year) != 1 ) + return -1; + + if ( strncmp(str+20, "EST" , 3) == 0 ) zone = -5 * 60; + else if ( strncmp(str+20, "EDT" , 3) == 0 ) zone = -4 * 60; + else if ( strncmp(str+20, "CST" , 3) == 0 ) zone = -6 * 60; + else if ( strncmp(str+20, "CDT" , 3) == 0 ) zone = -5 * 60; + else if ( strncmp(str+20, "MST" , 3) == 0 ) zone = -7 * 60; + else if ( strncmp(str+20, "MDT" , 3) == 0 ) zone = -6 * 60; + else if ( strncmp(str+20, "PST" , 3) == 0 ) zone = -8 * 60; + else if ( strncmp(str+20, "PDT" , 3) == 0 ) zone = -7 * 60; + else if ( strncmp(str+20, "CET" , 3) == 0 ) zone = 60; + else if ( strncmp(str+20, "CEST", 4) == 0 ) zone = 120; + } } if ( (day < 1) || (day > 31) || diff --git a/mimelib/dw_mime.cpp b/mimelib/dw_mime.cpp index 39f75f639..cca2fdede 100644 --- a/mimelib/dw_mime.cpp +++ b/mimelib/dw_mime.cpp @@ -215,6 +215,9 @@ int DwSubtypeStrToEnum(const DwString& aStr) if (DwStrcasecmp(aStr, "digest") == 0) { type = DwMime::kSubtypeDigest; } + if (DwStrcasecmp(aStr, "directory") == 0) { + type = DwMime::kSubtypeDirectory; + } else if (DwStrcasecmp(aStr, "disposition-notification") == 0 ) { type = DwMime::kSubtypeDispositionNotification; } @@ -341,6 +344,9 @@ int DwSubtypeStrToEnum(const DwString& aStr) if (DwStrcasecmp(aStr, "x-diff") == 0) { type = DwMime::kSubtypeXDiff; } + if (DwStrcasecmp(aStr, "x-vcalendar") == 0) { + type = DwMime::kSubtypeVCal; + } break; } return type; @@ -375,6 +381,9 @@ void DwSubtypeEnumToStr(int aEnum, DwString& aStr) case DwMime::kSubtypeXVCard: aStr = "X-VCard"; break; + case DwMime::kSubtypeDirectory: + aStr = "Directory"; + break; case DwMime::kSubtypeXDiff: aStr = "X-Diff"; break; diff --git a/mimelib/dwstring.cpp b/mimelib/dwstring.cpp index cd3c7b1ab..749f7c8ee 100644 --- a/mimelib/dwstring.cpp +++ b/mimelib/dwstring.cpp @@ -399,7 +399,7 @@ DwString::DwString(const char* aCstr) mStart = 0; mLength = 0; if ( aCstr ) { - size_t len = (aCstr) ? strlen(aCstr) : 0; + size_t len = strlen(aCstr); _replace(0, mLength, aCstr, len); } } diff --git a/mimelib/mimelib/address.h b/mimelib/mimelib/address.h index c384b949c..7ed56ba8c 100644 --- a/mimelib/mimelib/address.h +++ b/mimelib/mimelib/address.h @@ -36,7 +36,6 @@ #endif class DwAddressList; -class DwMailboxList; //============================================================================= //+ Name DwAddress -- Abstract class representing an RFC-822 address @@ -149,7 +148,7 @@ protected: inline DwBool DwAddress::IsValid() const { - return mIsValid; + return mIsValid != 0; } #endif diff --git a/mimelib/mimelib/enum.h b/mimelib/mimelib/enum.h index 9e2d0ee30..93cfe0106 100644 --- a/mimelib/mimelib/enum.h +++ b/mimelib/mimelib/enum.h @@ -78,6 +78,7 @@ enum { kSubtypeEnriched, kSubtypeHtml, kSubtypeXVCard, + kSubtypeDirectory, kSubtypeVCal, kSubtypeRtf, kSubtypeXDiff, diff --git a/mimelib/mimelib/headers.h b/mimelib/mimelib/headers.h index 8f802ce50..f545a3db2 100644 --- a/mimelib/mimelib/headers.h +++ b/mimelib/mimelib/headers.h @@ -67,7 +67,6 @@ #endif class DwMessage; -class DwBodyPart; class DwField; class DwFieldBody; class DwDateTime; diff --git a/mimelib/mimelib/mailbox.h b/mimelib/mimelib/mailbox.h index d5d376f26..7e38ae4b4 100644 --- a/mimelib/mimelib/mailbox.h +++ b/mimelib/mimelib/mailbox.h @@ -35,7 +35,6 @@ #include #endif -class DwGroup; //============================================================================= //+ Name DwMailbox -- Class representing an RFC-822 mailbox diff --git a/mimelib/mimelib/mboxlist.h b/mimelib/mimelib/mboxlist.h index 0487d7510..723a8c55d 100644 --- a/mimelib/mimelib/mboxlist.h +++ b/mimelib/mimelib/mboxlist.h @@ -35,7 +35,6 @@ #include #endif -class DwGroup; //============================================================================= diff --git a/mimelib/mimelib/msgcmp.h b/mimelib/mimelib/msgcmp.h index f1b284957..c9e6707ee 100644 --- a/mimelib/mimelib/msgcmp.h +++ b/mimelib/mimelib/msgcmp.h @@ -256,8 +256,8 @@ public: //. Returns a object id that is unique among all DwMessageComponent //. objects. - const char* partId() const { return mId.c_str(); }; - void SetPartId( DwString id ) { mId = id; }; + const char* partId() const { return mId.c_str(); } + void SetPartId( DwString id ) { mId = id; } // set or get a unique string for that part protected: diff --git a/mimelib/mimelib/protocol.h b/mimelib/mimelib/protocol.h index 151a68c5d..32186a82b 100644 --- a/mimelib/mimelib/protocol.h +++ b/mimelib/mimelib/protocol.h @@ -38,6 +38,7 @@ class DwObserver { public: + virtual ~DwObserver(){} virtual void Notify()=0; }; diff --git a/mimelib/test_boyermor.cpp b/mimelib/test_boyermor.cpp index 2140c4fdf..d2dcad80f 100644 --- a/mimelib/test_boyermor.cpp +++ b/mimelib/test_boyermor.cpp @@ -2,6 +2,7 @@ #include #include +#include using std::cerr; using std::cout; using std::endl; -- cgit v1.2.1