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/Application/Preferences/CIdentity.cp

    r54 r86  
    2323 
    2424#include "char_stream.h" 
     25#include "CCalendarAddress.h" 
    2526#include "CCalendarStoreNode.h" 
    2627#include "CMbox.h" 
     
    4849        mReplyTo.second = false; 
    4950        mSender.second = false; 
     51        mCalendar.second = false; 
    5052        mCopyTo.second = false; 
    5153        mCopyToNone = false; 
     
    7779        mReplyTo = copy.mReplyTo; 
    7880        mSender = copy.mSender; 
     81        mCalendar = copy.mCalendar; 
    7982        mCopyTo = copy.mCopyTo; 
    8083        mCopyToNone = copy.mCopyToNone; 
     
    111114                        (mFrom == test.mFrom) && 
    112115                        (mReplyTo == test.mReplyTo) && 
    113                         (mSender== test.mSender) && 
     116                        (mSender == test.mSender) && 
     117                        (mCalendar == test.mCalendar) && 
    114118                        (mCopyTo == test.mCopyTo) && 
    115119                        (mCopyToNone == test.mCopyToNone) && 
     
    388392        } 
    389393 
     394        if (::VersionTest(vers_prefs, VERS_4_1_0_A_1) >= 0) 
     395        { 
     396                MakePair(txt, mCalendar); 
     397        }        
     398         
    390399        // Expansion items: 
    391400         
     
    487496        item.ConvertFromOS(); 
    488497        all += item; 
     498 
     499        AddPair(all, mCalendar); 
     500        all += cSpace; 
    489501 
    490502        all += mFuture.GetInfo(); 
     
    602614        else 
    603615                return mSender.first; 
     616} 
     617 
     618const cdstring& CIdentity::GetCalendar(bool resolve) const 
     619{ 
     620        if (resolve) 
     621                return GetInheritedValue(&CIdentity::GetCalendar, &CIdentity::UseCalendar); 
     622        else 
     623                return mCalendar.first; 
     624} 
     625 
     626cdstring CIdentity::GetCalendarAddress() const 
     627{ 
     628        cdstring result = GetCalendar(true); 
     629        if (!result.empty()) 
     630                return result; 
     631        result = GetFrom(true); 
     632        if (!result.empty()) 
     633        { 
     634                CAddress addr(result); 
     635                result = addr.GetName(); 
     636                if (!result.empty()) 
     637                        result += " "; 
     638                result += "<"; 
     639                result += addr.GetMailAddress(); 
     640                result += ">"; 
     641        } 
     642        return result; 
    604643} 
    605644 
     
    872911         
    873912        return NULL; 
     913        } 
     914         
     915CIdentity* CIdentityList::GetIdentity(const CCalendarAddress& caladdr) const 
     916{ 
     917        // Match the Calendar address first 
     918        const cdstring& comp = caladdr.GetAddress(); 
     919        for(const_iterator iter = begin(); iter != end(); iter++) 
     920        { 
     921                cdstring test((*iter).GetCalendar(true)); 
     922                CCalendarAddress testc(test); 
     923                if (testc.GetAddress().compare(comp, true) == 0) 
     924                        return const_cast<CIdentity*>(&(*iter)); 
     925        } 
     926         
     927        // If calendar address is mailto, try to match a From address 
     928        if (comp.compare_start(cMailtoURLScheme)) 
     929        { 
     930                cdstring temp(comp, ::strlen(cMailtoURLScheme)); 
     931                CAddress addr(temp, caladdr.GetName()); 
     932                return GetIdentity(addr); 
     933        } 
     934        return NULL; 
    874935} 
    875936