Changeset 148 for Mulberry/branches/v4.1d1/Sources_Common/HTTP/CardDAVClient/CCardDAVReportParser.cpp
- Timestamp:
- 01/02/08 00:03:39 (1 year ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
Mulberry/branches/v4.1d1/Sources_Common/HTTP/CardDAVClient/CCardDAVReportParser.cpp
r86 r148 40 40 using namespace xmllib; 41 41 42 CCardDAVReportParser::CCardDAVReportParser(vCard::CVCardAddressBook& vadbk) 43 { 44 mVAdbk = &vadbk; 45 mAdbk = NULL; 46 mAddrs = NULL; 47 mAddItems = false; 48 } 49 42 50 CCardDAVReportParser::CCardDAVReportParser(vCard::CVCardAddressBook& vadbk, CAddressBook* adbk, bool add) 43 51 { 44 52 mVAdbk = &vadbk; 45 53 mAdbk = adbk; 54 mAddrs = NULL; 55 mAddItems = add; 56 } 57 58 CCardDAVReportParser::CCardDAVReportParser(vCard::CVCardAddressBook& vadbk, CAddressList* addrs, bool add) 59 { 60 mVAdbk = &vadbk; 61 mAdbk = NULL; 62 mAddrs = addrs; 46 63 mAddItems = add; 47 64 } … … 71 88 else if ((*iter)->CompareFullName(cElement_propstat)) 72 89 { 73 ParsePropStat(*iter, etag); 74 } 75 76 // Is it adbk-data 77 else if ((*iter)->CompareFullName(cElement_adbkdata)) 78 { 79 ParseAdbkData(*iter, href, etag); 90 ParsePropStat(*iter, href, etag); 80 91 } 81 92 } 82 93 } 83 94 84 void CCardDAVReportParser::ParsePropStat(const xmllib::XMLNode* response, c dstring& etag)95 void CCardDAVReportParser::ParsePropStat(const xmllib::XMLNode* response, const cdstring& href, cdstring& etag) 85 96 { 86 97 // Scan the propstat node the status - we only process OK status … … 110 121 if ((*iter)->CompareFullName(webdav::cElement_prop)) 111 122 { 112 ParseProp(*iter, etag);123 ParseProp(*iter, href, etag); 113 124 } 114 125 } … … 118 129 } 119 130 120 void CCardDAVReportParser::ParseProp(const xmllib::XMLNode* response, c dstring& etag)131 void CCardDAVReportParser::ParseProp(const xmllib::XMLNode* response, const cdstring& href, cdstring& etag) 121 132 { 122 133 // Scan the prop node - each child is processed 123 134 for(XMLNodeList::const_iterator iter = response->Children().begin(); iter != response->Children().end(); iter++) 124 135 { 125 ParsePropElement(*iter, etag);136 ParsePropElement(*iter, href, etag); 126 137 } 127 138 } 128 139 129 void CCardDAVReportParser::ParsePropElement(const xmllib::XMLNode* response, c dstring& etag)140 void CCardDAVReportParser::ParsePropElement(const xmllib::XMLNode* response, const cdstring& href, cdstring& etag) 130 141 { 131 142 // Here we need to detect the type of element and dispatch accordingly … … 143 154 etag = response->Data(); 144 155 } 156 157 // Is it adbk-data 158 else if (response->CompareFullName(cElement_adbkdata)) 159 { 160 ParseAdbkData(response, href, etag); 161 } 145 162 } 146 163 … … 155 172 std::istrstream is(response->Data().c_str()); 156 173 vCard::CVCardVCard* vcard = mVAdbk->ParseComponent(is, last_path, etag); 157 if ((mAdbk != NULL) && mAddItems) 158 vcardstore::MapFromVCard(mAdbk, *vcard); 174 if ((vcard != NULL) && mAddItems) 175 { 176 if (mAdbk != NULL) 177 vcardstore::MapFromVCard(mAdbk, *vcard); 178 else if (mAddrs != NULL) 179 vcardstore::MapFromVCard(mAddrs, *vcard); 180 } 159 181 }