亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? syncmltransport.cpp

?? funambol windows mobile plugin source code, the source code is taken from the funambol site
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
/*
 * Copyright (C) 2003-2007 Funambol, Inc
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307  USA
 */

#include "StdAfx.h"
#include "SyncMLTransport.h"
#include "base/Log.h"
#include "base/startcmd.h"
#include "base/util/utils.h"
#include "processUtils.h"
#include "customization.h"
#include "localizationUtils.h"
#include "HwndFunctions.h"

#ifdef WIN32_PLATFORM_WFSP
#include "funresourcesp.h"
#endif
#ifdef WIN32_PLATFORM_PSPC
#include "funresourceppc.h"
#endif

//#include "MAPIHelper.h"

CAdviseSink* advise = NULL;

HRESULT Transport_OneStopFactory(
    IMailSyncHandler ** ppSyncHandler
    );

static HINSTANCE g_hInst = NULL;

IMailSyncCallBack* refToPCallBack;
LPWSTR             refToPProfile;

/////////////////////////////////////////////////////////////////////////////
//
// DllMain()
//
// DLL entry point.  Perform module initialization and clean-up.
//
/////////////////////////////////////////////////////////////////////////////

BOOL WINAPI DllMain(
    HANDLE hinstDLL,
    DWORD dwReason,
    LPVOID lpvReserved
    )
{
    switch(dwReason)
    {
    case DLL_PROCESS_ATTACH:
        // Save the DLL's handle
        g_hInst =(HINSTANCE) hinstDLL;

        // We don't need DLL_THREAD_ATTACH/DLL_THREAD_DETACH notifications here
        // so we can disable them.
        DisableThreadLibraryCalls((HMODULE) g_hInst);

        // If you use a resource DLL, load it here.
        // g_hInstRes = LoadLibrary(g_kszResDll);
        break;

    case DLL_PROCESS_DETACH:
        // Perform any clean-up here
        break;

    default:
        break;
    }

    return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
//
// OneStopFactory()
//
//  Description:
//      This DLL entry point is used by the Inbox to create an instance of
//      the transport object and to return the IMailSyncHandler interface
//      to it.
//
//  Parameters:
//      pszType         IN      String identifying the name of the transport
//                              to create(e.g. L"IMAP4", L"POP3", ...)
//                              This allows multiple transports to reside
//                              in a single DLL for efficiency.
//      ppSyncHandler   OUT     Pointer to the IMailSyncHandler interface
//                              for the requested transport.
//
//  Returns:    HRESULT
//
/////////////////////////////////////////////////////////////////////////////

extern "C" HRESULT WINAPI OneStopFactory(
    LPCWSTR pszType,
    IMailSyncHandler ** ppSyncHandler
    )
{
    return Transport_OneStopFactory(ppSyncHandler);
}


/////////////////////////////////////////////////////////////////////////////
//
// Transport_OneStopFactory()
//
//  Description:
//      Creates an instance of the transport class and returns a pointer
//      to its IMailSyncHandler interface.
//
//  Parameters:
//      ppSyncHandler   OUT     Pointer to the IMailSyncHandler interface
//                              for the requested transport.
//
//  Returns:    HRESULT
//
/////////////////////////////////////////////////////////////////////////////

HRESULT Transport_OneStopFactory(
    IMailSyncHandler ** ppSyncHandler
    )
{
    if(NULL == ppSyncHandler)
    {
        return E_INVALIDARG;
    }

    *ppSyncHandler = new CTransportSyncHandler;
    if(NULL == *ppSyncHandler)
    {
        return E_OUTOFMEMORY;
    }

    return S_OK;
}


/////////////////////////////////////////////////////////////////////////////
//
// CTransportSyncHandler::CTransportSyncHandler
//
//  Description:
//      Constructor
//
//  Parameters:
//
//  Returns:
//
/////////////////////////////////////////////////////////////////////////////

CTransportSyncHandler::CTransportSyncHandler() :
    m_cRef(1),
    m_pCallback(NULL),
    m_pMsgStore(NULL),
    m_fShutDown(FALSE),
    m_hEventShutdown(NULL),
    m_pszProfile(NULL),
    m_advise(NULL)
{
    ZeroMemory(&m_SyncProgressItemPending, sizeof(m_SyncProgressItemPending));
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    refToPCallBack = m_pCallback;
    refToPProfile = m_pszProfile;
}


/////////////////////////////////////////////////////////////////////////////
//
//  CTransportSyncHandler::~CTransportSyncHandler()
//
//  Description:
//      Destructor
//
//  Parameters:
//
//  Returns:
//
/////////////////////////////////////////////////////////////////////////////

CTransportSyncHandler::~CTransportSyncHandler()
{
    if(NULL != m_hEventShutdown)
    {
        CloseHandle(m_hEventShutdown);
    }

    MAPIFreeBuffer(m_pszProfile);

    if(NULL != m_advise)
    {
        m_advise->Release();
    }

    if(NULL != m_pMsgStore)
    {
        m_pMsgStore->Release();
    }

    if(NULL != m_pCallback)
    {
        m_pCallback->Release();
    }

    if (advise) {
        advise = NULL;
    }
}


/////////////////////////////////////////////////////////////////////////////
//
//  CTransportSyncHandler::Initialize()
//
//  Description:
//      Called by Inbox to initializes settings for the sync handler.
//
//  Parameters:
//      pCallback       IN  Pointer to callback interface used to retrieve
//                          configuration information from and pass status
//                          information back to Inbox during mail synchronization.
//      pszProfileName  IN  Name of active profile in Inbox.  Used in calls to
//                          some methods of IMailSyncCallBack.
//      pMsgStore       IN  Pointer to message store for this service
//
//  Returns:    HRESULT
//
/////////////////////////////////////////////////////////////////////////////

HRESULT CTransportSyncHandler::Initialize(
    IMailSyncCallBack* pCallback,
    LPCWSTR pszProfileName,
    IMsgStore*   pMsgStore
    )
{
    HRESULT         hr          =   S_OK;
    int             iProfileLen;
    //SizedSPropTagArray(1, spta) = { 1, PR_CE_SYNC_MANUALLY_WHEN_ROAMING }; 

    //LOG.setLevel(LOG_LEVEL_DEBUG);

    // Save a copy of the IMailSyncCallBack function pointer.
    // We'll use this to retrieve user credentials for the
    // account and to pass status info back to Inbox later.
    m_pCallback = pCallback;
    m_pCallback->AddRef();


    // Perform any transport initialization here
    // e.g.  creation of thread syncronization objects,
    // data structures used during mail syncronization, etc.
    // [ Omitted ]


    // Save a copy of the profile name for use later.
    iProfileLen =(lstrlen(pszProfileName) + 1 ) * sizeof(TCHAR);
    hr = MAPIAllocateBuffer(iProfileLen,(LPVOID *) &m_pszProfile);
    if(FAILED(hr))
    {
        goto Exit;
    }

    memcpy(m_pszProfile, pszProfileName, iProfileLen);

    // Save a copy of the message store pointer for this service
    if(NULL == pMsgStore)
    {
        hr = E_INVALIDARG;
        goto Exit;
    }
    /*
    MessageBox(NULL,  TEXT("Inside"), TEXT("Alert"), MB_ICONWARNING);

    SPropValue *pspv = NULL;
    ULONG cValues = 0;
    
    hr = pMsgStore->GetProps((SPropTagArray *) &spta, MAPI_UNICODE, &cValues, &pspv);
    long ll = pspv[0].Value.l;

    MAPIFreeBuffer(pspv);

    //
    // Set property to messagestore
    //
    LPSPropValue rgpMsgProperties = NULL;  // A structure for holding a MAPI property. This is treated as an array of MAPI properties.
    int          cbMsgProperties  = 0;     // The size of the array of properties (measured as a count of bytes).
    int          cMsgProperties   = 1;     // The number of properties for the message (for example, one)
    
    cbMsgProperties = sizeof(SPropTagArray) + 
                        cMsgProperties * (sizeof(SPropValue) );

    hr = MAPIAllocateBuffer(cbMsgProperties, (LPVOID FAR *)&rgpMsgProperties);  // Allocate memory for the properties.
    memset(rgpMsgProperties, 0, cbMsgProperties);                               // Erase the allocated memory.

    rgpMsgProperties[0].ulPropTag   = PR_CE_SYNC_MANUALLY_WHEN_ROAMING;   // Set values for the properties.
    rgpMsgProperties[0].Value.l = 1;
        
    hr = pMsgStore->SetProps(cMsgProperties, rgpMsgProperties, NULL);  // Add the properties to the message.
    hr = MAPIFreeBuffer((void *)rgpMsgProperties);                // Free resources.
     
    hr = pMsgStore->GetProps((SPropTagArray *) &spta, MAPI_UNICODE, &cValues, &pspv);
    ll = 0;
    ll = pspv[0].Value.l;

    MAPIFreeBuffer(pspv);
    */

    m_pMsgStore = pMsgStore; //set to the mail store.
    pMsgStore->AddRef();     //add one to the ref counter.


    // Load settings for the specified profile name.  These may
    // be stored in the registry, or as named properties on the
    // message store, or wherever is convenient.
    // [ Omitted ]


    // Most transports will want to register for an advise
    // in order to receive CEMAPI notifications to track
    // message creates/deletes/modifications/moves.
    // [ Omitted ]

    advise = new CAdviseSink();
    m_advise = advise;
    advise->AddRef();

    ULONG m_ulAdviseConnection = 0;
    pMsgStore->Advise(
        0,
        NULL,//notify on entire store
        fnevObjectModified,
        (IMAPIAdviseSink *)advise,
        &m_ulAdviseConnection);

    // Some transports may need to know the Entry IDs for
    // system folders(Inbox, Outbox, Drafts, Sent Items,
    // Deleted Items(Wastebasket)).  This is a good place
    // to query the IMsgStore* to get those.
    // [ Omitted ]

Exit:
    return hr;
}


/////////////////////////////////////////////////////////////////////////////
//
//  CTransportSyncHandler::Synchronize()
//
//  Description:
//      This DLL entry point is called by Inbox to synchronize the
//      current service
//
//  Parameters:
//      pRqst   IN  Sync options requested by Inbox
//
//  Returns:    HRESULT
//
/////////////////////////////////////////////////////////////////////////////

HRESULT CTransportSyncHandler::Synchronize(
    MAILSYNCREQUEST * pRqst
    )
{
    HRESULT hr = MAPI_E_INVALID_PARAMETER;

    //SetCursor(LoadCursor(NULL, IDC_WAIT));

    //Get sources from registry
    
   // MessageBox(NULL,  TEXT("Inside"), TEXT("Alert"), MB_ICONWARNING);
    
    wchar_t* sources = NULL;

    sources = getValueFromReg(TEXT("transportSources"));
    unsigned long pid;
    if(!sources) {
        //pid = startcmd(SYNCAPP, TEXT("transport mail"));
        pid = startProgram(SYNCAPP, TEXT("transport mail"));  // start sync process
    } else {        
        wchar_t* value = NULL;
        int sizew = 0;
        wchar_t* transportCommand = getValueFromReg(TEXT("transportCommand"));
        
        if (!transportCommand) {
            transportCommand = wstrdup(TEXT("transport"));
        }
        sizew = wcslen(transportCommand) + 1 + wcslen(sources); // +1 is the space between "command values"
        value = new wchar_t[sizew + 1];
        wcscpy(value, transportCommand);
        wcscat(value, TEXT(" "));
        wcscat(value, sources);         
        pid = startProgram(SYNCAPP, value);	 // start sync process
        //pid = startcmd(SYNCAPP, value);   
        delete [] value; value = NULL;
        if (sources) { delete [] sources; sources = NULL;}

        
    }
    if (pid) {
        SetStatusText(IDS_STRING_SYNC_IN_PROGRESS);
        waitProcess(pid, FIVE_MINUTES_MSEC);
    }
    else {
        //SetStatusText(IDS_STRING_PLUG_IN_NOT_INSTALLED);
    }
    //SetCursor(NULL);
   
    if(NULL == pRqst)
    {
        // Inbox is requesting a full sync.
        // Synchronize all folders and messages.
        // [ Omitted ]
        // [ Assumed to return hr ]
    }
    else
    {
        switch(pRqst->ffFlags)
        {
        case SYNC_NORMAL:
            // Inbox is requesting a full sync.
            // Synchronize all folders and messages.
            // [ Omitted ]
            // [ Assumed to return hr ]
            break;

        case SYNC_FOLDER:
            // Inbox is requesting to synchronize a specific folder.
            // [ Omitted ]
            // [ Assumed to return hr ]
            break;

        case SYNC_RESETHIERARCHY:
            // Inbox is requesting to synchronize the folder hierarchy.
            // [ Omitted ]
            // [ Assumed to return hr ]
            break;

        case SYNC_CREATE_FOLDER:
            // The user created a folder, and Inbox is asking the
            // transport to create the local and server folders for it.
            // [ Omitted ]
            // [ Assumed to return hr ]
            break;

        case SYNC_RENAME_FOLDER:
            // The user renamed a folder, and Inbox is asking the
            // transport to rename the local and server folders for it.
            // [ Omitted ]
            // [ Assumed to return hr ]
            break;

        case SYNC_DELETE_FOLDER:
            // The user deleted a folder, and Inbox is asking the
            // transport to delete the local and server folders for it.
            // [ Omitted ]

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩黄色免费网站| 国产亚洲精品bt天堂精选| 99视频在线观看一区三区| 成人午夜大片免费观看| 国产精品一区二区x88av| 久久99热这里只有精品| 精品在线你懂的| 国产大陆亚洲精品国产| 国产.欧美.日韩| 播五月开心婷婷综合| 91视频com| 8x8x8国产精品| 精品国产伦理网| 欧美国产欧美综合| 亚洲欧美日韩久久精品| 亚洲成人综合在线| 美国毛片一区二区| 国产精品69久久久久水密桃 | 欧美日韩国产大片| 欧美日韩国产大片| 国产亚洲短视频| 亚洲人成网站色在线观看| 亚洲在线成人精品| 久久精品999| www.在线成人| 欧美日韩精品免费观看视频| 欧美电影免费观看高清完整版 | 亚洲人成人一区二区在线观看 | 91福利在线观看| 日韩一区二区在线看| 国产校园另类小说区| 亚洲免费在线播放| 蜜桃视频一区二区三区| 夫妻av一区二区| 欧美亚洲日本一区| 久久综合久久鬼色| 亚洲国产婷婷综合在线精品| 国内一区二区在线| 色偷偷一区二区三区| 欧美mv和日韩mv的网站| 日韩精品一级二级 | 精品国产免费一区二区三区香蕉| 国产精品午夜在线观看| 亚洲电影中文字幕在线观看| 国产精品羞羞答答xxdd| 91极品美女在线| 日本一区二区成人| 日本亚洲电影天堂| 在线视频你懂得一区| 久久久久久久久久久久久女国产乱 | 国内精品免费在线观看| 欧美色网站导航| 中文字幕高清不卡| 国产一区二区0| 欧美高清你懂得| 亚洲四区在线观看| 国产一区二区不卡在线| 日韩视频一区在线观看| 亚洲一区精品在线| 日本精品一级二级| 亚洲少妇30p| 成人免费的视频| 国产日韩欧美在线一区| 久久精品国产77777蜜臀| 精品视频在线视频| 亚洲人123区| 99久久精品费精品国产一区二区| 精品国产制服丝袜高跟| 美女视频黄a大片欧美| 91精品国产入口| 偷拍亚洲欧洲综合| 欧美久久婷婷综合色| 天天综合色天天综合| 欧美午夜精品一区二区三区| 樱花草国产18久久久久| 99国产精品视频免费观看| 中文字幕不卡的av| 成人免费看视频| 国产目拍亚洲精品99久久精品| 国产精品2024| 亚洲国产精品传媒在线观看| 成人久久久精品乱码一区二区三区| 久久精品在线免费观看| 国产成人亚洲精品青草天美| 国产精品人人做人人爽人人添 | 欧美日韩黄视频| 亚洲高清免费观看高清完整版在线观看| 91首页免费视频| 亚洲激情在线播放| 欧美高清激情brazzers| 日韩高清在线不卡| 精品国产污污免费网站入口| 国产精品亚洲一区二区三区在线 | 国产精品久久久久久久岛一牛影视 | 91久久线看在观草草青青| 中文字幕一区二区三区不卡在线 | 精品久久久久久久久久久久久久久久久| 极品美女销魂一区二区三区免费| 精品国产99国产精品| 成人性生交大片免费看视频在线| 国产精品―色哟哟| 精品污污网站免费看| 国产在线国偷精品产拍免费yy| 久久久久久久久99精品| 91啪在线观看| 免费高清视频精品| 成人免费在线视频观看| 制服丝袜日韩国产| 国产精品456| 午夜伊人狠狠久久| 久久精品视频在线免费观看 | 午夜精品福利视频网站| 精品久久久久久久久久久久久久久 | 亚洲免费观看高清完整版在线观看| 欧美精品在欧美一区二区少妇| 国产另类ts人妖一区二区| 亚洲午夜视频在线| 国产欧美一区二区精品性色超碰| 欧美无砖砖区免费| 国产精品亚洲专一区二区三区| 一区二区三区高清不卡| 久久嫩草精品久久久精品一| 日本久久一区二区| 顶级嫩模精品视频在线看| 天天操天天综合网| 1024成人网色www| 久久久久久久久久美女| 欧美人狂配大交3d怪物一区| 成人h版在线观看| 国产一区在线看| 日韩av电影天堂| 亚洲天堂成人在线观看| 国产亚洲成年网址在线观看| 日韩一区二区麻豆国产| 色综合天天天天做夜夜夜夜做| 国产主播一区二区三区| 婷婷一区二区三区| 亚洲另类春色校园小说| 中文久久乱码一区二区| 精品国产免费一区二区三区香蕉| 欧美老肥妇做.爰bbww| 在线观看av一区二区| youjizz国产精品| 成人av资源在线| 成人涩涩免费视频| 成人蜜臀av电影| 粗大黑人巨茎大战欧美成人| 韩国一区二区在线观看| 国内精品第一页| 国产一区不卡在线| 国产69精品久久久久毛片| 国产成人亚洲综合a∨婷婷| 国产精品一卡二卡在线观看| 久久99久久久久| 激情伊人五月天久久综合| 精品亚洲免费视频| 国内外成人在线| 国产成人综合自拍| 成人黄色综合网站| 福利一区二区在线| 成人午夜电影久久影院| 91麻豆国产福利在线观看| 91浏览器在线视频| 欧美日韩一卡二卡| 日韩欧美国产午夜精品| 欧美精品一区二区高清在线观看| 亚洲综合精品自拍| 午夜伦理一区二区| 另类小说色综合网站| 国产精品一二三| 色综合久久综合网欧美综合网 | 视频一区视频二区在线观看| 日韩专区欧美专区| 极品少妇xxxx精品少妇| 成人美女在线视频| 欧美系列日韩一区| 精品国产91洋老外米糕| 国产精品久久久久一区二区三区共| 最近中文字幕一区二区三区| 午夜精品久久久久久不卡8050| 老司机一区二区| 成人免费视频免费观看| 欧美色涩在线第一页| 欧美成人艳星乳罩| 亚洲人成网站在线| 另类小说视频一区二区| 99国产精品99久久久久久| 欧美日本韩国一区| 亚洲国产精品二十页| 亚洲成av人片观看| 国产麻豆视频一区| 欧美视频中文字幕| 久久精品在这里| 爽爽淫人综合网网站| 成人听书哪个软件好| 日韩三级电影网址| 一区二区三区不卡视频在线观看| 国产中文字幕一区| 91精品国产综合久久精品 | 午夜一区二区三区在线观看|