Changeset 169
- Timestamp:
- 07/04/08 14:57:53 (3 months ago)
- Location:
- Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Clients
- Files:
-
- 7 modified
-
CCalDAVCalendarClient.cpp (modified) (1 diff)
-
CCalDAVCalendarClient.h (modified) (1 diff)
-
CCalendarClient.h (modified) (1 diff)
-
CLocalCalendarClient.cpp (modified) (1 diff)
-
CLocalCalendarClient.h (modified) (1 diff)
-
CWebDAVCalendarClient.cpp (modified) (5 diffs)
-
CWebDAVCalendarClient.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Clients/CCalDAVCalendarClient.cpp
r113 r169 320 320 } 321 321 322 void CCalDAVCalendarClient::_ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal )322 void CCalDAVCalendarClient::_ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal, bool if_changed) 323 323 { 324 324 // Start UI action -
Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Clients/CCalDAVCalendarClient.h
r113 r169 64 64 virtual void _UpdateSyncToken(const CCalendarStoreNode& node, iCal::CICalendar& cal); 65 65 66 virtual void _ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal );66 virtual void _ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal, bool if_changed=false); 67 67 virtual void _WriteFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal); 68 68 -
Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Clients/CCalendarClient.h
r113 r169 63 63 virtual void _SizeCalendar(CCalendarStoreNode& node) = 0; 64 64 65 virtual void _ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal ) = 0;65 virtual void _ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal, bool if_changed=false) = 0; 66 66 virtual void _WriteFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal) = 0; 67 67 -
Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Clients/CLocalCalendarClient.cpp
r113 r169 526 526 } 527 527 528 void CLocalCalendarClient::_ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal )528 void CLocalCalendarClient::_ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal, bool if_changed) 529 529 { 530 530 // Get name for new file -
Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Clients/CLocalCalendarClient.h
r113 r169 71 71 virtual void _SizeCalendar(CCalendarStoreNode& node); 72 72 73 virtual void _ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal );73 virtual void _ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal, bool if_changed=false); 74 74 virtual void _WriteFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal); 75 75 -
Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Clients/CWebDAVCalendarClient.cpp
r113 r169 673 673 } 674 674 675 void CWebDAVCalendarClient::_ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal )675 void CWebDAVCalendarClient::_ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal, bool if_changed) 676 676 { 677 677 // Start UI action … … 692 692 acct->SetServerIP(parsed.Server()); 693 693 694 // Handle authentication 695 if (!parsed.User().empty()) 696 { 697 acct->GetAuthenticatorUserPswd()->SetUID(parsed.User()); 698 } 699 694 700 // Set TLS type 695 701 if ((parsed.SchemeType() == CURL::eHTTP) || (parsed.SchemeType() == CURL::eWebcal)) … … 713 719 // Create WebDAV GET 714 720 auto_ptr<http::webdav::CWebDAVGet> request(new http::webdav::CWebDAVGet(this, rurl)); 721 if (if_changed) 722 request->SetETag(cal.GetETag(), false); 715 723 http::CHTTPOutputDataString dout; 716 724 request->SetData(&dout); … … 719 727 RunSession(request.get()); 720 728 721 722 729 // Check response status 730 bool changed = true; 723 731 switch(request->GetStatusCode()) 724 732 { 725 733 case http::eStatus_OK: 726 734 // Do default action 735 break; 736 case http::eStatus_NotModified: 737 // Nothing more to do 738 changed = false; 727 739 break; 728 740 default: … … 732 744 } 733 745 734 // Read calendar from file 735 cdstring data = dout.GetData(); 736 std::istrstream is(data.c_str()); 737 cal.Parse(is); 738 739 // Update ETag 740 if (request->GetNewETag() != NULL) 741 { 742 cdstring temp(*request->GetNewETag()); 743 744 // Handle server bug: ETag value MUST be quoted per HTTP/1.1 €3.11 745 if (!temp.isquoted()) 746 temp.quote(true); 747 748 cal.SetETag(temp); 749 } 750 else 751 cal.SetETag(cdstring::null_str); 752 753 // Check read-only status 754 auto_ptr<http::webdav::CWebDAVOptions> optrequest(new http::webdav::CWebDAVOptions(this, rurl)); 755 756 // Process it 757 RunSession(optrequest.get()); 758 759 760 // Check response status 761 switch(optrequest->GetStatusCode()) 762 { 763 case http::eStatus_OK: 764 case http::eStatus_NoContent: 765 // Do default action 766 break; 767 case eStatus_NotImplemented: 768 // Ignore failure 769 return; 770 default: 771 // Handle error and exit here 772 HandleHTTPError(optrequest.get()); 773 return; 774 } 775 776 // Look for PUT 777 cal.SetReadOnly(!optrequest->IsAllowed(http::cRequestPUT)); 746 if (changed) 747 { 748 // Read calendar from file 749 cdstring data = dout.GetData(); 750 std::istrstream is(data.c_str()); 751 cal.Parse(is); 752 753 // Update ETag 754 if (request->GetNewETag() != NULL) 755 { 756 cdstring temp(*request->GetNewETag()); 757 758 // Handle server bug: ETag value MUST be quoted per HTTP/1.1 €3.11 759 if (!temp.isquoted()) 760 temp.quote(true); 761 762 cal.SetETag(temp); 763 } 764 else 765 cal.SetETag(cdstring::null_str); 766 767 // Check read-only status 768 auto_ptr<http::webdav::CWebDAVOptions> optrequest(new http::webdav::CWebDAVOptions(this, rurl)); 769 770 // Process it 771 RunSession(optrequest.get()); 772 773 774 // Check response status 775 switch(optrequest->GetStatusCode()) 776 { 777 case http::eStatus_OK: 778 case http::eStatus_NoContent: 779 // Do default action 780 break; 781 case eStatus_NotImplemented: 782 // Ignore failure 783 return; 784 default: 785 // Handle error and exit here 786 HandleHTTPError(optrequest.get()); 787 return; 788 } 789 790 // Look for PUT 791 cal.SetReadOnly(!optrequest->IsAllowed(http::cRequestPUT)); 792 } 778 793 } 779 794 -
Mulberry/branches/v4.1d1/Sources_Common/Calendar_Store/Clients/CWebDAVCalendarClient.h
r113 r169 80 80 virtual void _SizeCalendar(CCalendarStoreNode& node); 81 81 82 virtual void _ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal );82 virtual void _ReadFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal, bool if_changed=false); 83 83 virtual void _WriteFullCalendar(const CCalendarStoreNode& node, iCal::CICalendar& cal); 84 84