Show
Ignore:
Timestamp:
07/09/07 10:02:18 (2 years ago)
Author:
daboo
Message:

Some 4.1 changes. Mostly vCard/CardDAV and CalDAV scheduling support.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Mulberry/branches/v4.1d1/Sources_Common/Mail/INET_Clients/IMSP/CIMSPClient.cp

    r19 r86  
    2121 
    2222#include "CAdbkACL.h" 
     23#include "CAddressBook.h" 
    2324#include "CCharSpecials.h" 
    2425#include "CGeneralException.h" 
     
    2728#include "CINETCommon.h" 
    2829#include "CMailControl.h" 
    29 #include "CRemoteAddressBook.h" 
    3030#include "CRFC822.h" 
    3131#include "CStatusWindow.h" 
    3232#include "CStringUtils.h" 
     33 
     34#include "CVCardMapper.h" 
     35 
     36#include "CVCardAddressBook.h" 
     37#include "CVCardVCard.h" 
    3338 
    3439#if __dest_os == __mac_os || __dest_os == __mac_os_x 
     
    217222        mAuthAnonAllowed = mLastResponse.CheckUntagged(cIMAP_AUTHANON, true); 
    218223        mSTARTTLSAllowed = mLastResponse.CheckUntagged(cSTARTTLS, true); 
     224         
     225        // IMSP always has ACLs 
     226        GetAdbkOwner()->SetHasACL(true); 
    219227} 
    220228 
     
    381389// Operations on address books 
    382390 
    383 // Find all adbks below this path 
    384 void CIMSPClient::_FindAllAdbks(const cdstring& path) 
     391void CIMSPClient::_ListAddressBooks(CAddressBook* root) 
    385392{ 
    386393        // Must add wildcard and quote value 
    387         cdstring qvalue = path; 
     394        cdstring qvalue = (root->IsProtocol() ? cdstring::null_str : root->GetName()); 
    388395        qvalue += cWILDCARD; 
    389396 
     
    396403} 
    397404 
     405// Find all adbks below this path 
     406void CIMSPClient::_FindAllAdbks(const cdstring& path) 
     407{ 
     408        // Must add wildcard and quote value 
     409        cdstring qvalue = path; 
     410        qvalue += cWILDCARD; 
     411 
     412        // Send ADDRESSBOOK message to server 
     413        INETStartSend("Status::IMSP::AddressBooks", "Error::IMSP::OSErrAddressBooks", "Error::IMSP::NoBadAddressBooks"); 
     414        INETSendString(cADDRESSBOOK); 
     415        INETSendString(cSpace); 
     416        INETSendString(qvalue, eQueueProcess); 
     417        INETFinishSend(); 
     418} 
     419 
    398420// Create adbk 
    399421void CIMSPClient::_CreateAdbk(const CAddressBook* adbk) 
     
    405427        INETSendString(adbk->GetName(), eQueueProcess); 
    406428        INETFinishSend(); 
     429} 
     430 
     431bool CIMSPClient::_AdbkChanged(const CAddressBook* adbk) 
     432{ 
     433        // No way to tell if there have been changes on the server, so return true to force entire sync 
     434        return true; 
    407435} 
    408436 
     
    431459} 
    432460 
     461void CIMSPClient::_SizeAdbk(CAddressBook* adbk) 
     462{ 
     463        // Does nothing 
     464} 
     465 
    433466// Operations with addresses 
     467 
     468// Find all addresses in adbk 
     469void CIMSPClient::_ReadFullAddressBook(CAddressBook* adbk) 
     470{ 
     471        _FindAllAddresses(adbk); 
     472} 
     473 
     474// Write all addresses in adbk 
     475void CIMSPClient::_WriteFullAddressBook(CAddressBook* adbk) 
     476{ 
     477         
     478} 
    434479 
    435480// Find all addresses in adbk 
     
    615660                } 
    616661 
     662                // Calendar 
     663                temp = addr->GetCalendar(); 
     664                temp.ConvertFromOS(); 
     665                if (!temp.empty()) 
     666                { 
     667                        INETSendString(cSpace); 
     668                        INETSendString(cADDRESS_CALENDAR); 
     669                        INETSendString(cSpace); 
     670                        INETSendString(temp, eQueueProcess); 
     671                } 
     672                 
    617673                // Company 
    618674                temp = addr->GetCompany(); 
     
    13691425        } 
    13701426 
    1371         if (noselect) 
    1372         { 
    1373                 // Add name only to list 
    1374                 cdstring* hier_name = new cdstring(adbk_name); 
    1375                 GetAdbkOwner()->GetAdbkList()->push_back(hier_name, noinferiors); 
    1376         } 
    1377         else 
    1378         { 
    13791427                // Add adress book to list 
    1380                 CRemoteAddressBook* adbk = new CRemoteAddressBook(GetAdbkOwner(), adbk_name); 
    1381                 GetAdbkOwner()->GetAdbkList()->push_back(adbk, noinferiors); 
    1382         } 
     1428        CAddressBook* adbk = new CAddressBook(GetAdbkOwner(), GetAdbkOwner()->GetStoreRoot(), !noselect, !noinferiors, adbk_name); 
     1429        GetAdbkOwner()->GetStoreRoot()->AddChildHierarchy(adbk); 
    13831430        delete adbk_name; 
    13841431 
     
    14161463        char* email = NULL; 
    14171464        char* members = NULL; 
     1465        char* calendar = NULL; 
    14181466        char* company = NULL; 
    14191467        char* address = NULL; 
     
    14371485                        eCodeEmail, 
    14381486                        eCodeMembers, 
     1487                        eCodeCalendar, 
    14391488                        eCodeCompany, 
    14401489                        eCodeAddress, 
     
    14581507                else if (::strcmpnocase(p, cADDRESS_MEMBERS) == 0) 
    14591508                        code = eCodeMembers; 
     1509                else if (::strcmpnocase(p, cADDRESS_CALENDAR) == 0) 
     1510                        code = eCodeCalendar; 
    14601511                else if (::strcmpnocase(p, cADDRESS_COMPANY) == 0) 
    14611512                        code = eCodeCompany; 
     
    14941545                else if (code == eCodeMembers) 
    14951546                        members = value; 
     1547                else if (code == eCodeCalendar) 
     1548                        calendar = value; 
    14961549                else if (code == eCodeCompany) 
    14971550                        company = value; 
     
    15881641 
    15891642                // Create address and add to address book or search list 
    1590                 CAdbkAddress* addr = new CAdbkAddress(name, email, name, alias, company, temp_addr, phone_work, phone_home, fax, urls, notes); 
     1643                CAdbkAddress* addr = new CAdbkAddress(name, email, name, alias, calendar, company, temp_addr, phone_work, phone_home, fax, urls, notes); 
    15911644                if (mSearchMode) 
    15921645                        mSearchResults->push_back(addr); 
    15931646                else if (mActionAdbk) 
     1647                { 
    15941648                        mActionAdbk->GetAddressList()->push_back(addr); 
     1649                        if (mActionAdbk->GetVCardAdbk() != NULL) 
     1650                                mActionAdbk->GetVCardAdbk()->AddCard(vcardstore::GenerateVCard(mActionAdbk->GetVCardAdbk()->GetRef(), addr)); 
     1651                } 
    15951652        } 
    15961653